Innstall and run Mailman 3 with Postfix in a Docker enviroment
## Install Mailman 3
The idea is to install Mailman 3 in ad docker container. Also I want to install Postfix in a container. All the mail which will send and receive should handled in a docker container. The reason is, that on the server only applications in a docker environment working. There is no MTA installed. On the server are Discourse as forum, wikijs, portainer, watchtower, homepage, and the NGINX Proxy Manager installed. At next I need Mailman 3.
I don't know how to install and run Postfix for Mailman in a docker environment.
Here is my first try. I can visit the site lists.example.com, but I can not set the Admin password. I think the reason is, that the MTA not working.
I have a gitlab repo. If you like please look here: https://gitlab.com/joklein/mailman
### Configure the docker-compose.yml file
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.6
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
    - MAILMAN_ADMIN_EMAIL=lists@example.com
    - 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
#### Build the API Key für Hyperkitty and SECRET_KEY
You can build a key with pwgen -s 128
#### Make some directorys
mkdir -p /opt/mailman/core
mkdir -p /opt/mailman/web
mkdir -p /opt/mailman/mailman-web-data/static
#### Make a file in /opt/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 = "<E-MAIL>"
SERVER_EMAIL = "<E-MAIL>"
Change the <E-MAIL> with your server address. For example
mailman@lists.example.com
So that Postfix also sends your e-mails, you create the file
/opt/mailman/core/mailman-extra.cfg with the following content:
[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
Now you are ready to start your container:
sudo su -
cd /root/mailman-docker
docker-compose up -d
#### Check the mailman images
docker ps -a
CONTAINER ID   IMAGE                     COMMAND                  CREATED              STATUS          PORTS                NAMES
f6990a2f808f   maxking/mailman-web:0.3   "docker-entrypoint.s…"   55 seconds ago       Up 52 seconds   8000/tcp, 8080/tcp   mailman-web
a7fa6334b2b8   maxking/mailman-core:0.3  "docker-entrypoint.s…"   58 seconds ago       Up 54 seconds   8001/tcp, 8024/tcp   mailman-core
e8812dc42663   postgres:9.6-alpine       "docker-entrypoint.s…"   About a minute ago   Up 57 seconds   5432/tcp             docker-mailman_database_1
#### Check the conection
curl http://172.19.199.3:8000/postorius/lists/
    I have forgotten to write, that I get this error message: Server error An error occurred while processing your request.
Hi,
kwp.klein@gmail.com a écrit le 09/02/2021 à 10:46 :
## Install Mailman 3
The idea is to install Mailman 3 in ad docker container. Also I want to install Postfix in a container. All the mail which will send and receive should handled in a docker container. The reason is, that on the server only applications in a docker environment working. There is no MTA installed. On the server are Discourse as forum, wikijs, portainer, watchtower, homepage, and the NGINX Proxy Manager installed. At next I need Mailman 3.
I don't know how to install and run Postfix for Mailman in a docker environment.
I have no experience with postfix, but a working dockerized mailman [1]
- exim4 [2] configuration with no post-install in case you're interested.
 
[1] maxking/mailman-core, maxking/mailman-web, postgres [2] pinidh/exim4
_g.
participants (2)
- 
                
Gilles Filippini - 
                
kwp.klein@gmail.com