initial commit

This commit is contained in:
Franz Heinzmann (Frando) 2022-09-29 14:27:49 +02:00
commit 1d0a78ac08
5 changed files with 104 additions and 0 deletions

7
.env.sample Normal file
View File

@ -0,0 +1,7 @@
TYPE=listmonk
DOMAIN={{ .Domain }}
LETS_ENCRYPT_ENV=production
SECRET_DB_PASSWORD_VERSION=v1
SECRET_ADMIN_PASSWORD_VERSION=v1

2
abra.sh Normal file
View File

@ -0,0 +1,2 @@
export CONFIG_TOML_VERSION=v1
export APP_ENTRYPOINT_VERSION=v1

75
compose.yml Normal file
View File

@ -0,0 +1,75 @@
---
version: "3.7"
services:
app:
restart: unless-stopped
image: listmonk/listmonk:latest
networks:
- internal
- proxy
environment:
- TZ=Etc/UTC
- LISTMONK_DB_HOST=db
depends_on:
- db
configs:
- source: config_toml
target: /listmonk/config.toml
- source: app_entrypoint
target: /docker_entrypoint.sh
entrypoint: /docker-entrypoint.sh
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=9000"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
db:
image: postgres:13
networks:
- internal
secrets:
- db_password
environment:
- POSTGRES_PASSWORD_FILE=/run/secrets/db_password
- POSTGRES_USER=listmonk
- POSTGRES_DB=listmonk
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U listmonk"]
interval: 10s
timeout: 5s
retries: 6
volumes:
- "postgres_data:/var/lib/postgresql/data"
secrets:
db_password:
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
external: true
admin_password:
name: ${STACK_NAME}_admin_password_${SECRET_ADMIN_PASSWORD_VERSION}
external: true
networks:
internal:
proxy:
external: true
volumes:
postgres_data:
configs:
config_toml:
name: ${STACK_NAME}_config_toml_${CONFIG_TOML_VERSION}
file: config.toml.tmpl
template_driver: golang
app_entrypoint:
name: ${STACK_NAME}_app_entrypoint_${APP_ENTRYPOINT_VERSION}
file: docker-entrypoint.sh

16
config.toml.tmpl Normal file
View File

@ -0,0 +1,16 @@
[app]
address = "0.0.0.0:9000"
admin_username = "admin"
admin_password = "{{ secret "admin_password" }}"
# Database.
[db]
host = "{{ env "LISTMONK_DB_HOST" }} "
port = 5432
user = "listmonk"
password = "{{ secret "db_password" }}"
database = "listmonk"
ssl_mode = "disable"
max_open = 25
max_idle = 25
max_lifetime = "300s"

4
docker-entrypoint.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/sh
cd /listmonk
./listmonk --install || ./listmonk --upgrade
./listmonk