From 0abe05dc008007494149fdf7bca52636f4e00e9e Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Thu, 2 Dec 2021 14:28:26 +0100 Subject: [PATCH] Serve mailman3 on lists.binary-kitchen.de/mailman3/ --- roles/mail/files/mailman/uwsgi.ini | 52 +++++++++++++++++++++++++++++ roles/mail/tasks/main.yml | 4 +++ roles/mail/templates/nginx/vhost.j2 | 13 ++++++++ 3 files changed, 69 insertions(+) create mode 100644 roles/mail/files/mailman/uwsgi.ini diff --git a/roles/mail/files/mailman/uwsgi.ini b/roles/mail/files/mailman/uwsgi.ini new file mode 100644 index 0000000..c5b4cbc --- /dev/null +++ b/roles/mail/files/mailman/uwsgi.ini @@ -0,0 +1,52 @@ +[uwsgi] +# Port on which uwsgi will be listening. +uwsgi-socket = /run/mailman3-web/uwsgi.sock + +#Enable threading for python +enable-threads = true + +# Move to the directory wher the django files are. +chdir = /usr/share/mailman3-web + +# Use the wsgi file provided with the django project. +#wsgi-file = wsgi.py +mount = /mailman3=wsgi.py +manage-script-name = true + +# Setup default number of processes and threads per process. +master = true +process = 2 +threads = 2 + +# Drop privielges and don't run as root. +uid = www-data +gid = www-data + +plugins = python3 + +# Setup the django_q related worker processes. +attach-daemon = python3 manage.py qcluster + +# Setup hyperkitty's cron jobs. +#unique-cron = -1 -1 -1 -1 -1 ./manage.py runjobs minutely +#unique-cron = -15 -1 -1 -1 -1 ./manage.py runjobs quarter_hourly +#unique-cron = 0 -1 -1 -1 -1 ./manage.py runjobs hourly +#unique-cron = 0 0 -1 -1 -1 ./manage.py runjobs daily +#unique-cron = 0 0 1 -1 -1 ./manage.py runjobs monthly +#unique-cron = 0 0 -1 -1 0 ./manage.py runjobs weekly +#unique-cron = 0 0 1 1 -1 ./manage.py runjobs yearly + +# Setup the request log. +#req-logger = file:/var/log/mailman3/web/mailman-web.log + +# Log cron seperately. +#logger = cron file:/var/log/mailman3/web/mailman-web-cron.log +#log-route = cron uwsgi-cron + +# Log qcluster commands seperately. +#logger = qcluster file:/var/log/mailman3/web/mailman-web-qcluster.log +#log-route = qcluster uwsgi-daemons + +# Last log and it logs the rest of the stuff. +#logger = file:/var/log/mailman3/web/mailman-web-error.log +logto = /var/log/mailman3/web/mailman-web.log diff --git a/roles/mail/tasks/main.yml b/roles/mail/tasks/main.yml index 9774da2..4e8e4f3 100644 --- a/roles/mail/tasks/main.yml +++ b/roles/mail/tasks/main.yml @@ -147,6 +147,10 @@ template: src=mailman/mailman-web.py.j2 dest=/etc/mailman3/mailman-web.py notify: Restart mailman3web +- name: Configure mailman3-web uwsgi + copy: src=mailman/uwsgi.ini dest=/etc/mailman3/uwsgi.ini + notify: Restart mailman3web + - name: Run mailman3-web migration script command: cmd: ./manage.py migrate diff --git a/roles/mail/templates/nginx/vhost.j2 b/roles/mail/templates/nginx/vhost.j2 index a4bbcb9..70aa0b4 100644 --- a/roles/mail/templates/nginx/vhost.j2 +++ b/roles/mail/templates/nginx/vhost.j2 @@ -35,4 +35,17 @@ server { alias /var/lib/mailman/archives/public; autoindex on; } + + location /mailman3/ { + include /etc/nginx/uwsgi_params; + uwsgi_pass unix:/run/mailman3-web/uwsgi.sock; + } + + location /mailman3/static { + alias /var/lib/mailman3/web/static; + } + + location /mailman3/static/favicon.ico { + alias /var/lib/mailman3/web/static/postorius/img/favicon.ico; + } }