Initial setup to have a mailman server running

This includes running containers for mailman-core and mailman-web, both
connecting to the same database used by the boost web site.

The branch proposes a minor refactoring for the shared usage of the
compose-start.sh script, allowing both the boost web server and the mailman-web
server to wait for the db, run migrations, collect assets and run the django
devserver.
This commit is contained in:
Natalia
2023-05-04 22:59:11 -03:00
parent 7aaa36cb95
commit 762975930d
8 changed files with 57 additions and 6 deletions

View File

@@ -25,11 +25,14 @@ services:
build: build:
context: . context: .
dockerfile: docker/Dockerfile dockerfile: docker/Dockerfile
command: [ "/bin/bash", "/code/compose-start.sh" ] command: [ "/bin/bash", "/code/docker/compose-start.sh" ]
depends_on: depends_on:
- db - db
environment: environment:
- "LOCAL_DEVELOPMENT=true" - "LOCAL_DEVELOPMENT=true"
- "DOCKER_DIR=/code/docker"
- "PYTHON=python"
- "WEB_PORT=8000"
env_file: env_file:
- .env - .env
init: true init: true
@@ -43,6 +46,42 @@ services:
- ../website2022/:/website - ../website2022/:/website
stop_signal: SIGKILL stop_signal: SIGKILL
mailman-core:
image: maxking/mailman-core
stop_grace_period: 30s
env_file:
- .env
depends_on:
- db
ports:
- "8001:8001" # API
- "8024:8024" # LMTP - incoming emails
volumes:
- ./mailman/core:/opt/mailman/
networks:
- backend
mailman-web:
image: maxking/mailman-web
entrypoint: /opt/mailman-docker/compose-start.sh
environment:
- "DOCKER_DIR=/opt/mailman-docker"
- "PYTHON=python3"
- "WEB_PORT=8008"
env_file:
- .env
depends_on:
- db
ports:
- "8008:8008" # HTTP
- "8080:8080" # uwsgi
volumes:
- ./mailman/web:/opt/mailman-web-data
- ./docker:/opt/mailman-docker
networks:
- backend
networks: networks:
backend: backend:
frontend: frontend:

View File

@@ -4,9 +4,9 @@
# for use with docker-compose. In deployed or production scenarios you would # for use with docker-compose. In deployed or production scenarios you would
# not necessarily use this exact setup. # not necessarily use this exact setup.
# #
./docker/wait-for-it.sh -h db -p 5432 -t 20 -- python manage.py migrate --noinput $DOCKER_DIR/wait-for-it.sh -h db -p $PGPORT -t 20 -- $PYTHON manage.py migrate --noinput
python manage.py collectstatic --noinput $PYTHON manage.py collectstatic --noinput
# gunicorn -c gunicorn.conf.py --log-level INFO --reload -b 0.0.0.0:8000 config.wsgi # gunicorn -c gunicorn.conf.py --log-level INFO --reload -b 0.0.0.0:$WEB_PORT config.wsgi
python manage.py runserver 0.0.0.0:8000 $PYTHON manage.py runserver 0.0.0.0:$WEB_PORT

View File

@@ -146,7 +146,7 @@ WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH) WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
WAITFORIT_ISBUSY=1 WAITFORIT_ISBUSY=1
WAITFORIT_BUSYTIMEFLAG="-t" WAITFORIT_BUSYTIMEFLAG=""
else else
WAITFORIT_ISBUSY=0 WAITFORIT_ISBUSY=0

View File

@@ -20,3 +20,11 @@ AWS_ACCESS_KEY_ID="changeme"
AWS_SECRET_ACCESS_KEY="changeme" AWS_SECRET_ACCESS_KEY="changeme"
BUCKET_NAME="stage.boost.org" BUCKET_NAME="stage.boost.org"
# Mailman database settings
DATABASE_URL="postgresql://postgres@db:5432/postgres"
DATABASE_TYPE="postgres"
DATABASE_CLASS="mailman.database.postgresql.PostgreSQLDatabase"
HYPERKITTY_API_KEY="changeme!"
MAILMAN_ADMIN_USER=""
MAILMAN_ADMIN_EMAIL=""
SERVE_FROM_DOMAIN=localhost

1
mailman/core/README Normal file
View File

@@ -0,0 +1 @@
This directory will hold mailman-core config and related.

1
mailman/web/README Normal file
View File

@@ -0,0 +1 @@
This directory will hold mailman-web config, collected static assets and related.

1
mailman/web/logs/README Normal file
View File

@@ -0,0 +1 @@
This directory will hold mailman-web logs.

View File

@@ -0,0 +1 @@
# Override local settings here