Taking another run at packaging this thing

This commit is contained in:
decentral1se
2021-05-08 18:26:32 +02:00
parent b2662c316f
commit 7d744b3d5d
6 changed files with 89 additions and 17 deletions

View File

@ -1,20 +1,20 @@
APP=mailman3 TYPE=mailman3
DOMAIN=lists.autonomic.zone DOMAIN=lists.example.com
LETS_ENCRYPT_ENV=production LETS_ENCRYPT_ENV=production
# mailman-core # mailman-core
MTA=postfix MTA=postfix
SMTP_HOST=mail.autonomic.zone SMTP_HOST=mail.example.com
SMTP_PORT=25 SMTP_PORT=25
# mailman-web # mailman-web
DJANGO_ALLOWED_HOSTS=lists.autonomic.zone DJANGO_ALLOWED_HOSTS=lists.example.com
MAILMAN_ADMIN_EMAIL=helo@autonomic.zone MAILMAN_ADMIN_EMAIL=helo@example.com
MAILMAN_ADMIN_USER=autonomic MAILMAN_ADMIN_USER=autonomic
SERVE_FROM_DOMAIN=lists.autonomic.zone SERVE_FROM_DOMAIN=lists.example.com
SMTP_HOST=mail.autonomic.zone SMTP_HOST=mail.example.com
SMTP_HOST_USER=mailman@lists.autonomic.zone SMTP_HOST_USER=mailman@lists.example.com
SMTP_PORT=25 SMTP_PORT=25
SMTP_USE_TLS=True SMTP_USE_TLS=True

View File

@ -1,2 +1,5 @@
export CORE_ENTRYPOINT_CONF_VERSION=v1 export CORE_ENTRYPOINT_CONF_VERSION=v1
export MAILMAN_EXTRA_CFG_VERSION=v1
export NGINX_CONF_VERSION=v1
export SETTINGS_LOCAL_VERSION=v1
export WEB_ENTRYPOINT_CONF_VERSION=v1 export WEB_ENTRYPOINT_CONF_VERSION=v1

View File

@ -7,6 +7,8 @@ services:
hostname: mailman-core hostname: mailman-core
volumes: volumes:
- "core:/opt/mailman/" - "core:/opt/mailman/"
networks:
- internal
secrets: secrets:
- db_password - db_password
- hyperkitty_api_key - hyperkitty_api_key
@ -32,9 +34,20 @@ services:
mode: 0555 mode: 0555
entrypoint: /usr/local/bin/docker-entrypoint-custom.sh entrypoint: /usr/local/bin/docker-entrypoint-custom.sh
web: mail:
image: "mailu/postfix:1.7"
networks:
- internal
volumes:
- "mailqueue:/queue"
healthcheck:
disable: true
front:
image: "maxking/mailman-web:0.3" image: "maxking/mailman-web:0.3"
hostname: mailman-web hostname: mailman-web
networks:
- internal
volumes: volumes:
- "web:/opt/mailman-web-data" - "web:/opt/mailman-web-data"
secrets: secrets:
@ -62,19 +75,33 @@ services:
mode: 0555 mode: 0555
entrypoint: /usr/local/bin/docker-entrypoint-custom.sh entrypoint: /usr/local/bin/docker-entrypoint-custom.sh
nginx: [] web:
image: "nginx:1.20.0"
smtp: environment:
image: "mailu/postfix:1.7" - DOMAIN
volumes: - STACK_NAME
- "mailqueue:/queue" configs:
healthcheck: - source: nginx_conf
disable: true target: /etc/nginx/nginx.conf
networks:
- proxy
- internal
deploy:
update_config:
failure_action: rollback
labels:
- "traefik.enable=true"
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=80"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
db: db:
image: "postgres:13-alpine" image: "postgres:13-alpine"
secrets: secrets:
- db_password - db_password
networks:
- internal
environment: environment:
POSTGRES_DB: mailman POSTGRES_DB: mailman
POSTGRES_USER: mailman POSTGRES_USER: mailman
@ -82,6 +109,11 @@ services:
volumes: volumes:
- "db:/var/lib/postgresql/data" - "db:/var/lib/postgresql/data"
networks:
internal:
proxy:
external: true
volumes: volumes:
core: core:
web: web:
@ -113,3 +145,15 @@ configs:
name: ${STACK_NAME}_web_entrypoint_conf_${WEB_ENTRYPOINT_CONF_VERSION} name: ${STACK_NAME}_web_entrypoint_conf_${WEB_ENTRYPOINT_CONF_VERSION}
file: entrypoint.web.sh.tmpl file: entrypoint.web.sh.tmpl
template_driver: golang template_driver: golang
nginx_conf:
name: ${STACK_NAME}_nginx_conf_${NGINX_CONF_VERSION}
file: nginx.conf.tmpl
template_driver: golang
settings_local:
name: ${STACK_NAME}_settings_local_${SETTINGS_LOCAL_VERSION}
file: settings_local.py.tmpl
template_driver: golang
mailmain_extra_cfg:
name: ${STACK_NAME}_mailman_extra_cfg_${MAILMAN_EXTRA_CFG_VERSION}
file: mailman-extra.cfg.tmpl
template_driver: golang

0
mailman-extra.cfg.tmpl Normal file
View File

25
nginx.conf.tmpl Normal file
View File

@ -0,0 +1,25 @@
user www-data;
events {
worker_connections 768;
}
http {
upstream webuwsgi {
server {{ env "STACK_NAME" }}_front:8080;
}
server_name {{ env "DOMAIN" }};
location / {
uwsgi_pass webuwsgi;
include uwsgi_params;
uwsgi_read_timeout 300;
}
location /static/ {
alias /opt/mailman/web/static/;
autoindex off;
}
}

0
settings_local.py.tmpl Normal file
View File