Skip to content

Commit

Permalink
Move configuration variables from docker-compose.yaml into a dedicate…
Browse files Browse the repository at this point in the history
…d file.
  • Loading branch information
jakicoll committed Nov 9, 2023
1 parent f45adbf commit ce02630
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 14 deletions.
1 change: 1 addition & 0 deletions .env
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ For other systems, you can read the official Docker documentation to install

## Configuration

Most of the common configuration is handled through environment variables in the
`docker-compose.yaml`. However, there is need for some extra configuration that
Most of the common configuration is defined in `mailman.cfg`. Further custom
environment variables should be set via a newly created docker-compose.override.yaml.

Additionally, there is need for some extra configuration that
interacts directly with the application. There are two configuration files on
the host that interact directly with Mailman's settings. These files exist on
the host running the containers and are imported at runtime in the containers.
Expand Down Expand Up @@ -151,7 +153,7 @@ mounted inside the containers.
container.

### Mailman-web
These are the settings that you MUST change in your docker-compose.yaml before deploying:
These are the settings that you MUST change in your mailman.cfg before deploying:

- `SERVE_FROM_DOMAIN`: The domain name from which Django will be served. To be
added to `ALLOWED_HOSTS` in django settings. Default value is not set. This
Expand Down Expand Up @@ -190,7 +192,7 @@ For more details on how to configure this image, please look at

### Mailman-Core

These are the variables that you MUST change in your docker-compose.yaml before deploying:
These are the variables that you MUST change in your mailman.cfg before deploying:

- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value as
set for the mailman-web. Skip the variable in case of non-Hyperkitty deployment.
Expand Down
26 changes: 16 additions & 10 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ services:
depends_on:
- database
environment:
- DATABASE_URL=postgresql://mailman:mailmanpass@database/mailmandb
- DATABASE_TYPE=postgres
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
- HYPERKITTY_API_KEY=someapikey
- DATABASE_URL=${DATABASE_URL_SCHEMA}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
- DATABASE_TYPE=${DATABASE_TYPE}
- DATABASE_CLASS=${DATABASE_CLASS}
- HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY}
- TZ=${TZ}
ports:
- "127.0.0.1:8001:8001" # API
- "127.0.0.1:8024:8024" # LMTP - incoming emails
Expand All @@ -35,9 +36,14 @@ services:
volumes:
- /opt/mailman/web:/opt/mailman-web-data
environment:
- DATABASE_TYPE=postgres
- DATABASE_URL=postgresql://mailman:mailmanpass@database/mailmandb
- HYPERKITTY_API_KEY=someapikey
- DATABASE_URL=${DATABASE_URL_SCHEMA}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
- DATABASE_TYPE=${DATABASE_TYPE}
- HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY}
- SECRET_KEY=${DJANGO_SECRET_KEY}
- TZ=${TZ}
- SERVE_FROM_DOMAIN=${SERVE_FROM_DOMAIN}
- MAILMAN_ADMIN_USER=${MAILMAN_ADMIN_USER}
- MAILMAN_ADMIN_EMAIL=${MAILMAN_ADMIN_EMAIL}
ports:
- "127.0.0.1:8000:8000" # HTTP
- "127.0.0.1:8080:8080" # uwsgi
Expand All @@ -46,9 +52,9 @@ services:

database:
environment:
- POSTGRES_DB=mailmandb
- POSTGRES_USER=mailman
- POSTGRES_PASSWORD=mailmanpass
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
image: postgres:11-alpine
volumes:
- /opt/mailman/database:/var/lib/postgresql/data
Expand Down
22 changes: 22 additions & 0 deletions mailman.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Please set these as explained in README.md
SERVE_FROM_DOMAIN=
MAILMAN_ADMIN_USER=
MAILMAN_ADMIN_EMAIL=

# only use URL safe characters for the secrets, else you will break at least the DATABASE_URL
# i.e. do not use blanks ; / ? : @ = & < > # % { } | \ ^ ~ [ ] `
# you can use a commandline like `openssl rand -hex 24` to generate pseudo-random values for these secrets
HYPERKITTY_API_KEY=
POSTGRES_PASSWORD=
DJANGO_SECRET_KEY=

# you might want to change the timezone to your local one
TZ=UTC

# likely, you don't need to change these:
DATABASE_URL_SCHEMA=postgresql
DATABASE_TYPE=postgres
DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
POSTGRES_DB=mailmandb
POSTGRES_USER=mailman

0 comments on commit ce02630

Please sign in to comment.