Skip to content

Commit ce02630

Browse files
committed
Move configuration variables from docker-compose.yaml into a dedicated file.
1 parent f45adbf commit ce02630

File tree

4 files changed

+45
-14
lines changed

4 files changed

+45
-14
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mailman.cfg

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,10 @@ For other systems, you can read the official Docker documentation to install
121121

122122
## Configuration
123123

124-
Most of the common configuration is handled through environment variables in the
125-
`docker-compose.yaml`. However, there is need for some extra configuration that
124+
Most of the common configuration is defined in `mailman.cfg`. Further custom
125+
environment variables should be set via a newly created docker-compose.override.yaml.
126+
127+
Additionally, there is need for some extra configuration that
126128
interacts directly with the application. There are two configuration files on
127129
the host that interact directly with Mailman's settings. These files exist on
128130
the host running the containers and are imported at runtime in the containers.
@@ -151,7 +153,7 @@ mounted inside the containers.
151153
container.
152154

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

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

191193
### Mailman-Core
192194

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

195197
- `HYPERKITTY_API_KEY`: Hyperkitty's API Key, should be set to the same value as
196198
set for the mailman-web. Skip the variable in case of non-Hyperkitty deployment.

docker-compose.yaml

+16-10
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ services:
1313
depends_on:
1414
- database
1515
environment:
16-
- DATABASE_URL=postgresql://mailman:mailmanpass@database/mailmandb
17-
- DATABASE_TYPE=postgres
18-
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
19-
- HYPERKITTY_API_KEY=someapikey
16+
- DATABASE_URL=${DATABASE_URL_SCHEMA}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
17+
- DATABASE_TYPE=${DATABASE_TYPE}
18+
- DATABASE_CLASS=${DATABASE_CLASS}
19+
- HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY}
20+
- TZ=${TZ}
2021
ports:
2122
- "127.0.0.1:8001:8001" # API
2223
- "127.0.0.1:8024:8024" # LMTP - incoming emails
@@ -35,9 +36,14 @@ services:
3536
volumes:
3637
- /opt/mailman/web:/opt/mailman-web-data
3738
environment:
38-
- DATABASE_TYPE=postgres
39-
- DATABASE_URL=postgresql://mailman:mailmanpass@database/mailmandb
40-
- HYPERKITTY_API_KEY=someapikey
39+
- DATABASE_URL=${DATABASE_URL_SCHEMA}://${POSTGRES_USER}:${POSTGRES_PASSWORD}@database/${POSTGRES_DB}
40+
- DATABASE_TYPE=${DATABASE_TYPE}
41+
- HYPERKITTY_API_KEY=${HYPERKITTY_API_KEY}
42+
- SECRET_KEY=${DJANGO_SECRET_KEY}
43+
- TZ=${TZ}
44+
- SERVE_FROM_DOMAIN=${SERVE_FROM_DOMAIN}
45+
- MAILMAN_ADMIN_USER=${MAILMAN_ADMIN_USER}
46+
- MAILMAN_ADMIN_EMAIL=${MAILMAN_ADMIN_EMAIL}
4147
ports:
4248
- "127.0.0.1:8000:8000" # HTTP
4349
- "127.0.0.1:8080:8080" # uwsgi
@@ -46,9 +52,9 @@ services:
4652

4753
database:
4854
environment:
49-
- POSTGRES_DB=mailmandb
50-
- POSTGRES_USER=mailman
51-
- POSTGRES_PASSWORD=mailmanpass
55+
- POSTGRES_DB=${POSTGRES_DB}
56+
- POSTGRES_USER=${POSTGRES_USER}
57+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
5258
image: postgres:11-alpine
5359
volumes:
5460
- /opt/mailman/database:/var/lib/postgresql/data

mailman.cfg

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Please set these as explained in README.md
2+
SERVE_FROM_DOMAIN=
3+
MAILMAN_ADMIN_USER=
4+
MAILMAN_ADMIN_EMAIL=
5+
6+
# only use URL safe characters for the secrets, else you will break at least the DATABASE_URL
7+
# i.e. do not use blanks ; / ? : @ = & < > # % { } | \ ^ ~ [ ] `
8+
# you can use a commandline like `openssl rand -hex 24` to generate pseudo-random values for these secrets
9+
HYPERKITTY_API_KEY=
10+
POSTGRES_PASSWORD=
11+
DJANGO_SECRET_KEY=
12+
13+
# you might want to change the timezone to your local one
14+
TZ=UTC
15+
16+
# likely, you don't need to change these:
17+
DATABASE_URL_SCHEMA=postgresql
18+
DATABASE_TYPE=postgres
19+
DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
20+
POSTGRES_DB=mailmandb
21+
POSTGRES_USER=mailman
22+

0 commit comments

Comments
 (0)