docker-mailman
docker-mailman copied to clipboard
Implement Postfix into Mailman 3
I try to implement Postfix with a docker-compose.yml into Mailman 3. There is no MTA on the local Server installed. The reason is there are running only Docker container on it.
Here are the error messages:
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+---------+----------+------------+------------+---------------------
mailmandb | mailman | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | mailman | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | mailman | UTF8 | en_US.utf8 | en_US.utf8 | =c/mailman +
| | | | | mailman=CTc/mailman
template1 | mailman | UTF8 | en_US.utf8 | en_US.utf8 | =c/mailman +
| | | | | mailman=CTc/mailman
(4 rows)
No MTA environment variable found, defaulting to Exim
HYPERKITTY_URL not set, using the default value of http://mailman-web:8000/hyperkitty
the docker-compose.yml
version: '2'
services:
postfix:
image: instrumentisto/postfix:3
restart: unless-stopped
volumes:
- /opt/mailman/postfix:/etc/postfix/main.cf.d
- /opt/mailman/mailman-core:/opt/mailman
ports:
- "25:25"
networks:
mailman:
ipv4_address: 172.19.199.1
services:
mailman-core:
image: maxking/mailman-core:0.3
restart: unless-stopped
stop_grace_period: 30s
container_name: mailman-core
hostname: mailman-core
volumes:
- /opt/mailman-core:/opt/mailman/
links:
- database:database
depends_on:
- database
environment:
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- DATABASE_TYPE=postgres
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
- SMTP_HOST=172.19.199.1
- HYPERKITTY_API_KEY=ZawB3NGBUgbmQcMGhZ0kYIW0WRNw8P9osEudsGiFZWv
networks:
mailman:
ipv4_address: 172.19.199.2
mailman-web:
image: maxking/mailman-web:0.3
container_name: mailman-web
restart: unless-stopped
hostname: mailman-web
ports:
- "8000:8000"
depends_on:
- database
links:
- mailman-core:mailman-core
- database:database
volumes:
- /opt/mailman/mailman-web:/opt/mailman-web-data
environment:
- DATABASE_TYPE=postgres
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- HYPERKITTY_API_KEY=ZawB3NGBUgbmQcMGhZ0kYIW0WRNw8P9osEudsGiFZWv
- UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
- SERVE_FROM_DOMAIN=lists.example.com
- MAILMAN_ADMIN_USER=admin
- [email protected]
- SECRET_KEY=mailmangeheim
networks:
mailman:
ipv4_address: 172.19.199.3
database:
image: postgres:9.6-alpine
restart: unless-stopped
environment:
POSTGRES_DB: mailmandb
POSTGRES_USER: mailman
POSTGRES_PASSWORD: mailmanpass
volumes:
- /opt/mailman/database:/var/lib/postgresql/data
networks:
mailman:
ipv4_address: 172.19.199.4
networks:
mailman:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.19.199.0/24
the mailman/core/mailman-extra.cfg
[mta]
incoming: mailman.mta.postfix.LMTP
outgoing: mailman.mta.deliver.deliver
lmtp_host: 172.19.199.2
lmtp_port: 8024
smtp_host: 172.19.199.1
smtp_port: 25
configuration: /etc/postfix-mailman.cfg
the mailman/web/settings.local.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = '172.19.199.1'
EMAIL_PORT = 25
USE_SSL = False
DEFAULT_FROM_EMAIL = "[email protected]"
SERVER_EMAIL = "[email protected]"
the mailman/postfix/base.cf
myhostname = lists.example.com
mynetworks = 127.0.0.1/32 172.19.199.0/24
the mailman/postfix/main.cf
# Support the default VERP delimiter.
recipient_delimiter = +
unknown_local_recipient_reject_code = 550
owner_request_special = no
transport_maps = regexp:/opt/mailman/var/data/postfix_lmtp
local_recipient_maps = regexp:/opt/mailman/var/data/postfix_lmtp
relay_domains = regexp:/opt/mailman/var/data/postfix_domains
I am not sure if I completely understand, did you install Postfix in the mailman container? Because the existing container doesn't come with postfix installed.
The messages that you mentioned are simply info logs, they are using default values since you haven't overridden them.
The idea is to use postfix inside the contaner. I don't have a MTA installed on my host. I think it could be a good idea to run mailman without external MTA's. On this computer runs only Docker Container. Please take a look at the docker-compose.yml in the post.
My first question is, is postfix installed correctly? My second question is are the config files correct to run Postfix inside the container?
Who has postfix inside a mailman 3 container running?
AFAIK, .1 network is assigned to the host, so you might have to pick a different IP for the postfix container in:
networks:
mailman:
ipv4_address: 172.19.199.1
secondly, the volume mounts seem to be a bit inconsistent:
postfix:
volumes:
- /opt/mailman/postfix:/etc/postfix/main.cf.d
- /opt/mailman/mailman-core:/opt/mailman
core:
volumes:
- /opt/mailman-core:/opt/mailman/
You probably need the mailman core’s config path to be same in both case for them to share the postfix tansport maps.
Other than that, I think the config files look correct. I am not sure if I have examples of anyone specific running postfix inside a container, but someone else might comment here who has it running :)
I changed the docker-compose.yml, but it doesn*t work. Is it possible to run mailman over a sntp host? I have a discourse forum up and running. In this config file is asked for
DISCOURSE_SMTP_ADDRESS: xxxx.mailout.server-he.de
DISCOURSE_SMTP_PORT: 25
DISCOURSE_SMTP_USER_NAME: username
DISCOURSE_SMTP_PASSWORD: "Password"
DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
Is it a good idea and has someone mailman up and running?
Here the docker-compose.yml with my changes.
version: '2'
services:
postfix:
image: mailu/postfix
restart: unless-stopped
container_name: postfix
volumes:
- /opt/mailman/postfix:/etc/postfix/main.cf.d
- /opt/mailman/core:/opt/mailman
ports:
- "25:25"
networks:
mailman:
ipv4_address: 172.19.199.1
services:
mailman-core:
image: maxking/mailman-core:0.3
restart: unless-stopped
stop_grace_period: 30s
container_name: mailman-core
hostname: mailman-core
volumes:
- /opt/mailman/core:/opt/mailman
links:
- database:database
depends_on:
- database
environment:
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- DATABASE_TYPE=postgres
- DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
- SMTP_HOST=172.19.199.1
- HYPERKITTY_API_KEY=ZawB3NGBUgbmQcMGhZ0kYIW0WRNw8P9osEudsGiFZWv
networks:
mailman:
ipv4_address: 172.19.199.2
mailman-web:
image: maxking/mailman-web:0.3
container_name: mailman-web
restart: unless-stopped
hostname: mailman-web
ports:
- "8000:8000"
depends_on:
- database
links:
- mailman-core:mailman-core
- database:database
volumes:
- /opt/mailman/web:/opt/mailman-web-data
environment:
- DATABASE_TYPE=postgres
- DATABASE_URL=postgres://mailman:mailmanpass@database/mailmandb
- HYPERKITTY_API_KEY=ZawB3NGBUgbmQcMGhZ0kYIW0WRNw8P9osEudsGiFZWv
- UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
- SERVE_FROM_DOMAIN=lists.example.com
- MAILMAN_ADMIN_USER=admin
- [email protected]
- SECRET_KEY=mailmangeheim
networks:
mailman:
ipv4_address: 172.19.199.3
database:
image: postgres:9.6-alpine
restart: unless-stopped
environment:
POSTGRES_DB: mailmandb
POSTGRES_USER: mailman
POSTGRES_PASSWORD: mailmanpass
volumes:
- /opt/mailman/database:/var/lib/postgresql/data
networks:
mailman:
ipv4_address: 172.19.199.4
networks:
mailman:
ipv4_address: 172.19.199.1
driver: bridge
ipam:
driver: default
config:
- subnet: 172.19.199.0/24
When you say it doesn’t work, what issues are you seeing?
Mailman can send emails over SMTP, but it receives emails over LMTP. So you can setup a remote SMTP relay for sending out emails but you still need some way to actually receive emails sent to the mailing list.
I try to set the admin password with forget password. The error message is Server error An error occurred while processing your request.
I try to sign up as another user and the error message is the same.
I don't know if my configuration guide can help you configuring postfix correctly in the container. But I've documented my setup here: https://github.com/gangefors/aws-mailman3#configure-mta
However, I run the MTA directly on the host and not in a container. But as long as you pick up mails through port 25 mapped to your postfix container and that container can talk to mailman-core I don't see why it woudln't work.
My installation in AWS works fine based on that guide. If you find any issues with it, or if you successfully get postfix to run in a container feel free to share your setup. I would be happy to move both MTA and webproxy into containers and update my guide with it. I just haven't had the time or motivation to do it yet.
Hi Stefan, thanks for the guide, it looks great. Yes, please update if you end up implementing a full container system. Ultimately, I'd like to run the entire solution inside of a container. Thanks again!
@gangefors just as an FYI, the compose files and entrypoint scripts in this repo have been updated to remove static IPs and bound to localhost ports instead. You can checkout https://github.com/maxking/docker-mailman/pull/441 for the changes.
This issue has not been updated for more than 1year