First stab at wiring things up

This commit is contained in:
Luke Murphy 2020-11-07 14:22:17 +01:00
parent 09e2853d1e
commit ac9e887b92
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
2 changed files with 88 additions and 0 deletions

87
compose.yml Normal file
View File

@ -0,0 +1,87 @@
---
version: "3.8"
# TODO(decentral1se):
# - healthchecks
# - how do i expose multiple ports, core and web both need to have open ports
# - core receives relayed emails, web receives typical http traffic
# - ahhh! do $name-http, $name-ltmp, "name-$proto" for entrypoints on same service
# - inspect if we need a nginx proxy for mailman-web, it is currently using uwsgi
# but apparently it can serve http but in a very limited way, need to investigate
# this
# - re-wire up all that static IP stuff so things know where each other are in
# the stack, e.g. https://github.com/maxking/docker-mailman/blob/master/docker-compose.yaml#L55
services:
# TODO(decentral1se): https://github.com/maxking/docker-mailman#mailman-core-1
core:
image: "maxking/mailman-core:0.3"
volumes:
- "core:/opt/mailman/"
configs:
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
# TODO(decentral1se): https://github.com/maxking/docker-mailman/blob/master/core/Dockerfile
# build up the right env vars required in the entrypoint via the secrets loading
entrypoint: /docker-entrypoint.sh
environment:
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
- DATABASE_DB=mailman
- DATABASE_NAME=mailman
- DATABASE_TYPE=postgres
- DATABASE_USER=mailman
# TODO(decentral1se): https://github.com/maxking/docker-mailman/blob/master/core/Dockerfile
# TODO(decentral1se): https://github.com/maxking/docker-mailman#mailman-web-1
web:
image: "maxking/mailman-web:0.3"
volumes:
- "web:/opt/mailman-web-data"
configs:
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
# TODO(decentral1se): https://github.com/maxking/docker-mailman/blob/master/core/Dockerfile
# build up the right env vars required in the entrypoint via the secrets loading
entrypoint: /docker-entrypoint.sh
environment:
- DATABASE_TYPE=postgres
deploy:
update_config:
failure_action: rollback
order: start-first
labels:
- "traefik.enable=true"
# TODO(decentral1se): https://github.com/maxking/docker-mailman/blob/master/web/Dockerfile
- "traefik.http.services.${STACK_NAME}.loadbalancer.server.port=${8000}"
- "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:
image: "postgres:13-alpine"
secrets:
- db_password
environment:
POSTGRES_DB: mailman
POSTGRES_USER: mailman
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
volumes:
- "db:/var/lib/postgresql/data"
volumes:
core:
web:
db:
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_root_password_${DB_ROOT_PASSWORD_VERSION}
configs:
entrypoint_conf:
name: ${STACK_NAME}_entrypoint_conf_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang

1
entrypoint.sh.tmpl Normal file
View File

@ -0,0 +1 @@
#!/bin/bash