Fix outdated docker local dev suite (#2200)

* deps(dev): Upgrade golang to 1.20 in dev Dockerfile

* feat(dev): Make dev's config.toml conform to prod's

* fix(dev): Use dev db credentials in config

* feat(dev): Add support for devcontainer

* docs: How to set up dev env in different ways
This commit is contained in:
Po-Ru, Lin
2024-12-11 01:35:12 +08:00
committed by GitHub
parent 97fde64461
commit 98934e601e
5 changed files with 44 additions and 15 deletions

View File

@@ -0,0 +1,8 @@
{
"name": "listmonk",
"dockerComposeFile": "../dev/docker-compose.yml",
"service": "backend",
"workspaceFolder": "/app",
"forwardPorts": [9000],
"postStartCommand": "make dist && ./listmonk --install --idempotent --yes --config dev/config.toml"
}

View File

@@ -1,4 +1,4 @@
FROM golang:1.17 AS go FROM golang:1.20 AS go
FROM node:16 AS node FROM node:16 AS node
@@ -8,4 +8,4 @@ ENV CGO_ENABLED=0
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
WORKDIR /app WORKDIR /app
ENTRYPOINT [ "" ] CMD [ "sleep infinity" ]

View File

@@ -1,6 +1,3 @@
# IMPORTANT: This configuration is meant for development only
### DO NOT USE IN PRODUCTION ###
[app] [app]
# Interface and port where the app will run its webserver. The default value # Interface and port where the app will run its webserver. The default value
# of localhost will only listen to connections from the current machine. To # of localhost will only listen to connections from the current machine. To
@@ -8,21 +5,20 @@
# port, use port 80 (this will require running with elevated permissions). # port, use port 80 (this will require running with elevated permissions).
address = "0.0.0.0:9000" address = "0.0.0.0:9000"
# BasicAuth authentication for the admin dashboard. This will eventually
# be replaced with a better multi-user, role-based authentication system.
# IMPORTANT: Leave both values empty to disable authentication on admin
# only where an external authentication is already setup.
admin_username = "listmonk"
admin_password = "listmonk"
# Database. # Database.
[db] [db]
host = "db" host = "db"
port = 5432 port = 5432
user = "listmonk-dev" user = "listmonk-dev"
password = "listmonk-dev" password = "listmonk-dev"
# Ensure that this database has been created in Postgres.
database = "listmonk-dev" database = "listmonk-dev"
ssl_mode = "disable" ssl_mode = "disable"
max_open = 25 max_open = 25
max_idle = 25 max_idle = 25
max_lifetime = "300s" max_lifetime = "300s"
# Optional space separated Postgres DSN params. eg: "application_name=listmonk gssencmode=disable"
params = ""

View File

@@ -1,11 +1,21 @@
version: "3" version: "3"
services: services:
adminer:
image: adminer:4.8.1-standalone
restart: always
ports:
- 8070:8080
networks:
- listmonk-dev
mailhog: mailhog:
image: mailhog/mailhog:v1.0.1 image: mailhog/mailhog:v1.0.1
ports: ports:
- "1025:1025" # SMTP - "1025:1025" # SMTP
- "8025:8025" # UI - "8025:8025" # UI
networks:
- listmonk-dev
db: db:
image: postgres:13 image: postgres:13

View File

@@ -18,9 +18,24 @@ The app has two distinct components, the Go backend and the VueJS frontend. In t
### Running the dev environment ### Running the dev environment
1. Run `make run` to start the listmonk dev server on `:9000`. You can run your dev environment locally or inside containers.
2. Run `make run-frontend` to start the Vue frontend in dev mode using yarn on `:8080`. All `/api/*` calls are proxied to the app running on `:9000`. Refer to the [frontend README](https://github.com/knadh/listmonk/blob/master/frontend/README.md) for an overview on how the frontend is structured.
3. Visit `http://localhost:8080` After setting up the dev environment, you can visit `http://localhost:8080`.
1. Locally
- Run `make run` to start the listmonk dev server on `:9000`.
- Run `make run-frontend` to start the Vue frontend in dev mode using yarn on `:8080`. All `/api/*` calls are proxied to the app running on `:9000`. Refer to the [frontend README](https://github.com/knadh/listmonk/blob/master/frontend/README.md) for an overview on how the frontend is structured.
2. Inside containers (Using Makefile)
- Run `make init-dev-docker` to setup container for db.
- Run `make dev-docker` to setup docker container suite.
- Run `make rm-dev-docker` to clean up docker container suite.
3. Inside containers (Using devcontainer)
- Open repo in vscode, open command palette, and select "Dev Containers: Rebuild and Reopen in Container".
It will set up db, and start frontend/backend for you.
# Production build # Production build