Mailman Web
To install and run the web UI for the Mailman 3 suite using Unit:
-
Install Unit with a Python 3.7+ language module.
-
Follow Mailman’s guide to install its prerequisites and core files, but stop at setting up a WSGI server; we’ll use Unit instead. Also, note the following settings (values from the guide are given after the colon):
- Virtual environment path: /opt/mailman/venv/
- Installation path: /etc/mailman3/
- Static file path: /opt/mailman/web/static/
- User and group: mailman:mailman
These are needed to configure Unit.
-
Run the following command (as root) so Unit can access Mailman’s static files:
# chown -R unit:unit /opt/mailman/web/static/ # User and group that Unit's router runs as by default | Mailman's static file path
Note:
The unit:unit user-group pair is available only with official packages, Docker images , and some third-party repos. Otherwise, account names may differ; run theps aux | grep unitd
command to be sure.
Alternatively, add Unit’s unprivileged user account to Mailman’s group so Unit can access the static files. Run the following command as root:
# usermod -a -G mailman unit # Mailman's user group noted in Step 2 | User that Unit's router runs as by default
-
Next, prepare the Mailman configuration for Unit (use values from Step 2 for share, path, and home):
{ "listeners": { "*:80": { "pass": "routes" } }, "routes": [ { "match": { "uri": "/static/*" }, "_comment_match": "Matches requests for web UI's static content", "action": { "share": "/opt/mailman/web/$uri" }, "_comment_action": "Mailman's static file path without the 'static/' part; URIs starting with /static/ are thus served from /opt/mailman/web/static/" }, { "action": { "pass": "applications/mailman_web" } } ], "applications": { "mailman_web": { "type": "python 3.X", "_comment_type": "Must match language module version and virtual environment version", "path": "/etc/mailman3/", "_comment_path": "Mailman's installation path you noted in Step 2", "home": "/opt/mailman/venv/", "_comment_home": "Mailman's virtual environment path you noted in Step 2", "module": "mailman_web.wsgi", "_comment_module": "Qualified name of the WSGI module, relative to installation path", "user": "mailman", "_comment_user": "Mailman's user group noted in Step 2", "environment": { "DJANGO_SETTINGS_MODULE": "settings" }, "_comment_environment": "App-specific environment variables", "_comment_DJANGO_SETTINGS_MODULE": "Web configuration module name, relative to installation path" } } }
-
Upload the updated configuration.
Assuming the JSON above was added to
config.json
. Run the following command as root:# curl -X PUT --data-binary @config.json --unix-socket \ /path/to/control.unit.sock \ # Path to Unit's control socket in your installation http://localhost/config/ # Path to the config section in Unit's control API
After a successful update, Mailman’s web UI should be available on the listener’s IP address and port: