From 9150fd028fbc74cff95d877e2bc22f24938c06dd Mon Sep 17 00:00:00 2001 From: Sasi Olin Date: Feb 15 2022 10:59:28 +0000 Subject: Update the lists to use the package config --- diff --git a/salt/profile/mailman3/config.sls b/salt/profile/mailman3/config.sls index d15dee2..39caaaf 100644 --- a/salt/profile/mailman3/config.sls +++ b/salt/profile/mailman3/config.sls @@ -1,160 +1,72 @@ -mailman_conf_dir: - file.directory: - - name: /etc/mailman/ - -mailman_var_dir: - file.directory: - - name: /var/lib/mailman/ - -mailman_webui_dir: - file.directory: - - name: /var/lib/mailman_webui/ - -mailman_log_dir: - file.directory: - - name: /var/log/mailman/ - - user: mailman - -mailman_lock_dir: - file.directory: - - name: /var/lock/mailman/ - - user: mailman - -mailman_run_dir: - file.directory: - - name: /var/run/mailman/ - - user: mailman - -mailman_spool_dir: - file.directory: - - name: /var/spool/mailman/ - - user: mailman - mailman_conf_file: file.managed: - - name: /etc/mailman/mailman.cfg + - name: /etc/mailman.cfg - source: salt://profile/mailman3/files/mailman.cfg - template: jinja - - require: - - file: mailman_conf_dir - - require_in: - - service: mailman_service - - watch_in: - - module: mailman_restart - -mailman_conf_symlink_var: - file.symlink: - - name: /var/lib/mailman/var/etc/mailman.cfg - - target: /etc/mailman/mailman.cfg - -mailman_conf_symlink_etc: - file.symlink: - - name: /etc/mailman.cfg - - target: /etc/mailman/mailman.cfg - -mailman_webui_manage_file: - file.managed: - - name: /var/lib/mailman_webui/manage.py - - source: salt://profile/mailman3/files/manage.py - - require: - - file: mailman_webui_dir - require_in: - service: mailman_service - watch_in: - module: mailman_restart -mailman_webui_settings_file: +mailman_hyperkitty_settings_file: file.managed: - - name: /var/lib/mailman_webui/settings.py + - name: /srv/www/webapps/mailman/hyperkitty/settings.py - source: salt://profile/mailman3/files/settings.py - template: jinja - - require: - - file: mailman_webui_dir - - require_in: - - service: mailman_webui_service - - watch_in: - - module: mailman_webui_restart - -mailman_webui_urls_file: - file.managed: - - name: /var/lib/mailman_webui/urls.py - - source: salt://profile/mailman3/files/urls.py - - require: - - file: mailman_webui_dir - require_in: - - service: mailman_webui_service + - service: mailman_hyperkitty_service - watch_in: - - module: mailman_webui_restart + - module: mailman_hyperkitty_restart -mailman_webui_wsgi_file: +mailman_postorius_settings_file: file.managed: - - name: /var/lib/mailman_webui/wsgi.py - - source: salt://profile/mailman3/files/wsgi.py - - require: - - file: mailman_webui_dir + - name: /srv/www/webapps/mailman/postorius/settings_local.py + - source: salt://profile/mailman3/files/settings_local.py + - template: jinja - require_in: - - service: mailman_webui_service + - service: mailman_postorius_service - watch_in: - - module: mailman_webui_restart + - module: mailman_postorius_restart -mailman_disable_signup: +mailman_postorius_disable_signup: file.managed: - - name: /var/lib/mailman_webui/django_fedora_nosignup.py + - name: /srv/www/webapps/mailman/postorius/django_fedora_nosignup.py - source: salt://profile/mailman3/files/django_fedora_nosignup.py - - require: - - file: mailman_webui_dir - -mailman_uwsgi_conf: - file.managed: - - name: /etc/mailman/uwsgi.ini - - source: salt://profile/mailman3/files/uwsgi.ini - - require: - - file: mailman_conf_dir - - require_in: - - service: mailman_webui_service - - watch_in: - - module: mailman_webui_restart - -{% set logfiles = ['uwsgi', 'uwsgi-cron', 'uwsgi-error', 'uwsgi-qcluster'] %} -{% for logfile in logfiles %} -mailman_{{ logfile }}_file: +mailman_hyperkitty_disable_signup: file.managed: - - name: /var/log/mailman/{{ logfile }}.log - - user: mailman - - replace: False - - require: - - file: mailman_log_dir - - require_in: - - service: mailman_service - - watch_in: - - module: mailman_restart -{% endfor %} + - name: /srv/www/webapps/mailman/hyperkitty/django_fedora_nosignup.py + - source: salt://profile/mailman3/files/django_fedora_nosignup.py mailman_hyperkitty_conf: file.managed: - - name: /etc/mailman/hyperkitty.cfg + - name: /etc/hyperkitty.cfg - source: salt://profile/mailman3/files/hyperkitty.cfg - template: jinja - - require: - - file: mailman_conf_dir - require_in: - - service: mailman_webui_service + - service: mailman_hyperkitty_service - watch_in: - - module: mailman_webui_restart + - module: mailman_hyperkitty_restart + +/srv/www/webapps/mailman/postorius/secret.txt: + file.managed: + - contents_pillar: profile:mailman3:secret_txt + - mode: 640 + - user: postorius + - group: postorius -/var/lib/mailman_webui/secret.txt: +/srv/www/webapps/mailman/hyperkitty/secret.txt: file.managed: - contents_pillar: profile:mailman3:secret_txt - mode: 640 - - user: mailman - - group: mailman + - user: hyperkitty + - group: hyperkitty mailman_nginx_conf: file.managed: - name: /etc/nginx/conf.d/lists.opensuse.org.conf - source: salt://profile/mailman3/files/nginx.conf - require_in: - - service: mailman_webui_service + - service: mailman_hyperkitty_service - watch_in: - - module: mailman_webui_restart + - module: mailman_hyperkitty_restart diff --git a/salt/profile/mailman3/files/mailman.service b/salt/profile/mailman3/files/mailman.service deleted file mode 100644 index 1d37861..0000000 --- a/salt/profile/mailman3/files/mailman.service +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=GNU Mailman Service - -[Service] -Type=forking -Restart=on-failure -RestartSec=3 - -User=mailman -Group=mailman -WorkingDirectory=/var/lib/mailman/ -ExecStart=/usr/bin/mailman start -ExecStop=/usr/bin/mailman stop - -[Install] -WantedBy=multi-user.target diff --git a/salt/profile/mailman3/files/mailman_webui.service b/salt/profile/mailman3/files/mailman_webui.service deleted file mode 100644 index eba4acf..0000000 --- a/salt/profile/mailman3/files/mailman_webui.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=GNU Mailman Service - -[Service] -Type=simple -Restart=on-failure -RestartSec=3 - -User=mailman -Group=mailman -WorkingDirectory=/var/lib/mailman_webui/ -ExecStart=/usr/sbin/uwsgi --ini /etc/mailman/uwsgi.ini - -[Install] -WantedBy=multi-user.target diff --git a/salt/profile/mailman3/files/manage.py b/salt/profile/mailman3/files/manage.py deleted file mode 100644 index dc7af6b..0000000 --- a/salt/profile/mailman3/files/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/python3 -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/salt/profile/mailman3/files/urls.py b/salt/profile/mailman3/files/urls.py deleted file mode 100644 index 04f13ed..0000000 --- a/salt/profile/mailman3/files/urls.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 1998-2016 by the Free Software Foundation, Inc. -# -# This file is part of Postorius. -# -# Postorius is free software: you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free -# Software Foundation, either version 3 of the License, or (at your option) -# any later version. -# -# Postorius is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License along with -# Postorius. If not, see . - - -from django.conf.urls import include, url -from django.contrib import admin -from django.urls import reverse_lazy -from django.views.generic import RedirectView - -urlpatterns = [ - url(r'^$', RedirectView.as_view( - url=reverse_lazy('hk_root'), - permanent=True)), - url(r'^manage/', include('postorius.urls')), - url(r'^archives/', include('hyperkitty.urls')), - url(r'', include('django_mailman3.urls')), - url(r'^accounts/', include('allauth.urls')), - # Django admin - url(r'^admin/', admin.site.urls), -] diff --git a/salt/profile/mailman3/files/uwsgi.ini b/salt/profile/mailman3/files/uwsgi.ini deleted file mode 100644 index e78710a..0000000 --- a/salt/profile/mailman3/files/uwsgi.ini +++ /dev/null @@ -1,39 +0,0 @@ -# uwsgi.ini -# -[uwsgi] -# Port on which uwsgi will be listening. -uwsgi-socket = 0.0.0.0:8000 - -plugin = python3, logfile - -# Move to the directory wher the django files are. -chdir = /var/lib/mailman_webui - -# 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 = 4200 -gid = 4200 - -# Setup the django_q related worker processes. -attach-daemon = python3 ./manage.py qcluster - -# Setup the request log. -req-logger = file://var/log/mailman/uwsgi.log - -# Log cron seperately. -logger = cron file://var/log/mailman/uwsgi-cron.log -log-route = cron uwsgi-cron - -# Log qcluster commands seperately. -logger = qcluster file://var/log/mailman/uwsgi-qcluster.log -log-route = qcluster uwsgi-daemons - -# Last log and it logs the rest of the stuff. -logger = file://var/log/mailman/uwsgi-error.log diff --git a/salt/profile/mailman3/files/wsgi.py b/salt/profile/mailman3/files/wsgi.py deleted file mode 100644 index 8e59cd8..0000000 --- a/salt/profile/mailman3/files/wsgi.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -WSGI config for HyperKitty project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/{{ docs_version }}/howto/deployment/wsgi/ -""" - -import os - -# import sys -# import site - -# For some unknown reason, sometimes mod_wsgi fails to set the python paths to -# the virtualenv, with the 'python-path' option. You can do it here too. -# -# # Remember original sys.path. -# prev_sys_path = list(sys.path) -# # Add here, for the settings module -# site.addsitedir(os.path.abspath(os.path.dirname(__file__))) -# # Add the virtualenv -# venv = os.path.join(os.path.abspath(os.path.dirname(__file__)), -# '..', 'lib', 'python2.6', 'site-packages') -# site.addsitedir(venv) -# # Reorder sys.path so new directories at the front. -# new_sys_path = [] -# for item in list(sys.path): -# if item not in prev_sys_path: -# new_sys_path.append(item) -# sys.path.remove(item) -# sys.path[:0] = new_sys_path - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") - -application = get_wsgi_application() diff --git a/salt/profile/mailman3/init.sls b/salt/profile/mailman3/init.sls index 256aa0a..8d5f44a 100644 --- a/salt/profile/mailman3/init.sls +++ b/salt/profile/mailman3/init.sls @@ -3,15 +3,6 @@ include: - profile.mailman3.config - profile.mailman3.master -mailman_service_file: - file.managed: - - name: /etc/systemd/system/mailman.service - - source: salt://profile/mailman3/files/mailman.service - - require_in: - - service: mailman_service - - watch_in: - - module: mailman_restart - mailman_service: service.running: - name: mailman @@ -24,23 +15,26 @@ mailman_restart: - require: - service: mailman_service -mailman_webui_service_file: - file.managed: - - name: /etc/systemd/system/mailman_webui.service - - source: salt://profile/mailman3/files/mailman_webui.service - - require_in: - - service: mailman_webui_service - - watch_in: - - module: mailman_webui_restart +mailman_hyperkitty_service: + service.running: + - name: hyperkitty + - enable: True + +mailman_hyperkitty_restart: + module.wait: + - name: service.restart + - m_name: hyperkitty + - require: + - service: mailman_hyperkitty_service -mailman_webui_service: +mailman_postorius_service: service.running: - - name: mailman_webui + - name: postorius - enable: True -mailman_webui_restart: +mailman_postorius_restart: module.wait: - name: service.restart - - m_name: mailman_webui + - m_name: postorius - require: - - service: mailman_webui_service + - service: mailman_postorius_service diff --git a/salt/profile/mailman3/mailman.sls b/salt/profile/mailman3/mailman.sls index f890375..ccd9c45 100644 --- a/salt/profile/mailman3/mailman.sls +++ b/salt/profile/mailman3/mailman.sls @@ -10,86 +10,9 @@ mailman_pgks: - python3-mailman-web - python3-HyperKitty - python3-mailman-hyperkitty + - HyperKitty-web + - postorius-web # html => text for mailman - lynx - memcached - nginx-rewrite-lists-openSUSE - -mailman: - user.present: - - home: /var/lib/mailman - - uid: 4200 - group.present: - - system: True - - gid: 4200 - - members: - - mailman - -mailman_digest: - cron.present: - - name: /usr/bin/mailman digests --periodic - - user: mailman - - minute: 0 - - hour: 0 - -mailman_notify: - cron.present: - - name: /usr/bin/mailman notify - - user: mailman - - minute: 0 - - hour: 8 - -mailman_aliases: - cron.present: - - name: /usr/bin/mailman aliases - - user: mailman - - minute: 0 - -mailman_hourly: - cron.present: - - name: django-admin runjobs hourly --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: 0 - -mailman_daily: - cron.present: - - name: django-admin runjobs daily --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: 0 - - hour: 0 - -mailman_weekly: - cron.present: - - name: django-admin runjobs weekly --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: 0 - - hour: 0 - - dayweek: 0 - -mailman_monthly: - cron.present: - - name: django-admin runjobs monthly --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: 0 - - hour: 0 - - daymonth: 1 - -mailman_yearly: - cron.present: - - name: django-admin runjobs yearly --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: 0 - - hour: 0 - - daymonth: 1 - - month: 1 - -mailman_minutely: - cron.present: - - name: django-admin runjobs minutely --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - -mailman_quarter_hourly: - cron.present: - - name: django-admin runjobs quarter_hourly --pythonpath /var/lib/mailman_webui --settings settings - - user: mailman - - minute: '0,15,30,45' diff --git a/salt/profile/mailman3/master.sls b/salt/profile/mailman3/master.sls index 1f15151..93a4ded 100644 --- a/salt/profile/mailman3/master.sls +++ b/salt/profile/mailman3/master.sls @@ -15,11 +15,19 @@ https://github.com/openSUSE/lists-o-o.git: file.symlink: - target: /var/lib/mailman/lists-o-o/mailman-templates -/var/lib/mailman_webui/templates: +/srv/www/webapps/mailman/hyperkitty/templates: file.symlink: - target: /var/lib/mailman/lists-o-o/webui-templates -/var/lib/mailman_webui/static-openSUSE: +/srv/www/webapps/mailman/hyperkitty/static-openSUSE: + file.symlink: + - target: /var/lib/mailman/lists-o-o/webui-assets + +/srv/www/webapps/mailman/postorius/templates: + file.symlink: + - target: /var/lib/mailman/lists-o-o/webui-templates + +/srv/www/webapps/mailman/postorius/static-openSUSE: file.symlink: - target: /var/lib/mailman/lists-o-o/webui-assets