Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

feat: Add docker demo setup

karan728d1c26e739
diff --git a/.goreleaser.yml b/.goreleaser.yml
index 74251a8f..8c306234 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -1,5 +1,6 @@
env:
- GO111MODULE=on
+ - CGO_ENABLED=0
- RELEASE_BUILDS=dist/listmonk_darwin_amd64/listmonk dist/listmonk_linux_amd64/listmonk dist/listmonk_windows_amd64//listmonk.exe
before:
@@ -34,8 +35,8 @@ dockers:
binaries:
- listmonk
image_templates:
- - "knadh/listmonk:latest"
- - "knadh/listmonk:{{ .Tag }}"
+ - "listmonk/listmonk:latest"
+ - "listmonk/listmonk:{{ .Tag }}"
dockerfile: Dockerfile
extra_files:
- config.toml.sample
diff --git a/Dockerfile b/Dockerfile
index 6b556921..9f37f8e7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM alpine:latest AS deploy
RUN apk --no-cache add ca-certificates
-COPY listmonk /
-COPY config.toml.sample /etc/listmonk/config.toml
-VOLUME ["/etc/listmonk"]
-CMD ["./listmonk", "--config", "/etc/listmonk/config.toml"]
+WORKDIR /listmonk
+COPY listmonk .
+COPY config.toml.sample config.toml
+CMD ["./listmonk"]
diff --git a/INSTALL.md b/INSTALL.md
index 14ef5c5b..525b252a 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -3,3 +3,20 @@
- Run `./listmonk --new-config` to generate a sample `config.toml` and add your configuration (SMTP and Postgres DB credentials primarily).
- `./listmonk --install` to setup the DB.
- Visit `http://localhost:9000`.
+
+## Running on Docker
+
+You can checkout the [docker-compose.yml](docker-compose.yml) to get an idea of how to run `listmonk` with `PostgreSQL` together using Docker.
+
+- `docker-compose up -d` to run all the services together.
+- `docker-compose run --rm app ./listmonk --install` to setup the DB.
+- Visit `http://localhost:9000`.
+
+### Demo Setup
+
+`docker-compose.yml` includes a demo setup to quickly try out `listmonk`. It spins up PostgreSQL and listmonk app containers without any persistent data.
+
+- Run `docker-compose up -d demo-db demo-app`.
+- Visit `http://localhost:9000`.
+
+_NOTE_: This setup will delete the data once you kill and remove the containers. This setup is NOT intended for production use.
diff --git a/README.md b/README.md
index 962a7b15..eee7321a 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,11 @@ listmonk is a standalone, self-hosted, newsletter and mailing list manager. It i
You can checkout the [docker-compose.yml](docker-compose.yml) to get an idea of how to run `listmonk` with `PostgreSQL` together using Docker.
- `docker-compose up -d` to run all the services together.
-- `docker-compose run --rm app ./listmonk --install --config /etc/listmonk/config.toml` to setup the DB.
+- `docker-compose run --rm app ./listmonk --install` to setup the DB.
- Visit `http://localhost:9000`.
+Alternatively, to run a demo of listmonk, you can quickly spin up a container `docker-compose up -d demo-db demo-app`. NOTE: This doesn't persist Postgres data after you stop and remove the container, this setup is intended only for demo. _DO NOT_ use the demo setup in production.
+
### Help and docs
[Help and documentation](https://listmonk.app/docs) (work in progress).
diff --git a/config.toml.sample b/config.toml.sample
index 1b9f12bf..8ac65612 100644
--- a/config.toml.sample
+++ b/config.toml.sample
@@ -46,10 +46,10 @@ max_send_errors = 1000
# Database.
[db]
-host = "localhost"
+host = "demo-db"
port = 5432
user = "listmonk"
-password = ""
+password = "listmonk"
database = "listmonk"
ssl_mode = "disable"
diff --git a/docker-compose.yml b/docker-compose.yml
index e093f315..cc99b510 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,15 +4,18 @@
version: "3.7"
-services:
- db:
+x-app-defaults: &app-defaults
+ restart: unless-stopped
+ image: listmonk/listmonk:latest
+ ports:
+ - "9000:9000"
+ networks:
+ - listmonk
+
+x-db-defaults: &db-defaults
image: postgres:11
ports:
- - "5432:5432"
- volumes:
- - type: volume
- source: listmonk-data
- target: /var/lib/postgresql/data
+ - "9432:5432"
networks:
- listmonk
environment:
@@ -21,19 +24,27 @@ services:
- POSTGRES_DB=listmonk
restart: unless-stopped
+services:
+ db:
+ <<: *db-defaults
+ volumes:
+ - type: volume
+ source: listmonk-data
+ target: /var/lib/postgresql/data
+
app:
- restart: unless-stopped
+ <<: *app-defaults
depends_on:
- db
- image: knadh/listmonk:latest
- volumes:
- - type: bind
- source: ./config.toml
- target: /etc/listmonk/config.toml
- ports:
- - "9000:9000"
- networks:
- - listmonk
+
+ demo-db:
+ <<: *db-defaults
+
+ demo-app:
+ <<: *app-defaults
+ command: [sh, -c, "yes | ./listmonk --install && ./listmonk"]
+ depends_on:
+ - demo-db
networks:
listmonk: