From d317ab48ea2767be6ac4fafaaf68f0aa7b485714 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 14 Feb 2023 14:27:17 +0100 Subject: [PATCH] update mailman --- seed/mailman/templates/mailman-hyperkitty.cfg | 26 +++++++++ seed/mailman/templates/mailman3-web.service | 7 +++ seed/mailman/templates/uwsgi.ini | 53 +++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 seed/mailman/templates/mailman-hyperkitty.cfg create mode 100644 seed/mailman/templates/mailman3-web.service create mode 100644 seed/mailman/templates/uwsgi.ini diff --git a/seed/mailman/templates/mailman-hyperkitty.cfg b/seed/mailman/templates/mailman-hyperkitty.cfg new file mode 100644 index 00000000..5e2362fc --- /dev/null +++ b/seed/mailman/templates/mailman-hyperkitty.cfg @@ -0,0 +1,26 @@ +# This is the mailman extension configuration file to enable HyperKitty as an +# archiver. Remember to add the following lines in the mailman.cfg file: +# +# [archiver.hyperkitty] +# class: mailman_hyperkitty.Archiver +# enable: yes +# configuration: /etc/mailman3/mailman-hyperkitty.cfg +# + +[general] + +# This is your HyperKitty installation, preferably on the localhost. This +# address will be used by Mailman to forward incoming emails to HyperKitty +# for archiving. It does not need to be publicly available, in fact it's +# better if it is not. +%set %%revprox_client_external_domainname = %%revprox_client_external_domainnames[0] +%set %%location = %%domainname.revprox_client_location +base_url: http://%%domainname%%location%slurp +%if not %%location.endswith('/') +/%slurp +%end if +hyperkitty/ + +# Shared API key, must be the identical to the value in HyperKitty's +# settings. +api_key: %%postorius_secret_key diff --git a/seed/mailman/templates/mailman3-web.service b/seed/mailman/templates/mailman3-web.service new file mode 100644 index 00000000..b5efba94 --- /dev/null +++ b/seed/mailman/templates/mailman3-web.service @@ -0,0 +1,7 @@ +[Service] +WorkingDirectory=/usr/share/mailman3-web +ExecStartPre=/usr/bin/python3 manage.py migrate +ExecStartPre=/usr/bin/python3 manage.py shell -c 'from django.contrib.sites.models import Site; site=Site.objects.first(); site.name="%%{revprox_client_external_domainnames[0]}"; site.domain="%%{revprox_client_external_domainnames[0]}"; site.save()' +ExecStartPre=/usr/bin/python3 manage.py shell -c 'from allauth.socialaccount.models import SocialApp; SocialApp.objects.create() if SocialApp.objects.count() == 0 else print("social app already exists"); a=SocialApp.objects.first(); a.name = "%%domain_name_eth0"; a.provider = "risotto"; a.client_id = "%%oauth2_client_id"; a.secret = "%%oauth2_client_secret"; a.sites.set([1]); a.save()' +ExecStartPre=-/usr/bin/python3 manage.py createsuperuser --username "%%mailman_mail_owner" --email "%%mailman_mail_owner" --noinput + diff --git a/seed/mailman/templates/uwsgi.ini b/seed/mailman/templates/uwsgi.ini new file mode 100644 index 00000000..6f19abb1 --- /dev/null +++ b/seed/mailman/templates/uwsgi.ini @@ -0,0 +1,53 @@ +[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 + +# 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,syslog + +# 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 +#>GNUNUX +#logto = /var/log/mailman3/web/mailman-web.log +logger = local0 syslog +#