From 7097e15ae96e58ded9a97151751a92b11079f8d7 Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Fri, 22 Dec 2023 16:43:33 +0100 Subject: [PATCH] Deploy supervisor config for new RQ worker --- .../scripts/files/modoboa/supervisor-rq-base.tpl | 9 +++++++++ .../{supervisor-rq.tpl => supervisor-rq-dkim.tpl} | 0 modoboa_installer/scripts/modoboa.py | 10 ++++++---- 3 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 modoboa_installer/scripts/files/modoboa/supervisor-rq-base.tpl rename modoboa_installer/scripts/files/modoboa/{supervisor-rq.tpl => supervisor-rq-dkim.tpl} (100%) diff --git a/modoboa_installer/scripts/files/modoboa/supervisor-rq-base.tpl b/modoboa_installer/scripts/files/modoboa/supervisor-rq-base.tpl new file mode 100644 index 00000000..ec50f05d --- /dev/null +++ b/modoboa_installer/scripts/files/modoboa/supervisor-rq-base.tpl @@ -0,0 +1,9 @@ +[program:modoboa-base-worker] +autostart=true +autorestart=true +command=%{venv_path}/bin/python %{home_dir}/instance/manage.py rqworker modoboa +directory=%{home_dir} +user=%{user} +redirect_stderr=true +numprocs=1 +stopsignal=TERM diff --git a/modoboa_installer/scripts/files/modoboa/supervisor-rq.tpl b/modoboa_installer/scripts/files/modoboa/supervisor-rq-dkim.tpl similarity index 100% rename from modoboa_installer/scripts/files/modoboa/supervisor-rq.tpl rename to modoboa_installer/scripts/files/modoboa/supervisor-rq-dkim.tpl diff --git a/modoboa_installer/scripts/modoboa.py b/modoboa_installer/scripts/modoboa.py index 0aae5f73..a2eab3af 100644 --- a/modoboa_installer/scripts/modoboa.py +++ b/modoboa_installer/scripts/modoboa.py @@ -44,7 +44,7 @@ class Modoboa(base.Installer): def __init__(self, *args, **kwargs): """Get configuration.""" - super(Modoboa, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.venv_path = self.config.get("modoboa", "venv_path") self.instance_path = self.config.get("modoboa", "instance_path") self.extensions = self.config.get("modoboa", "extensions").split() @@ -194,7 +194,7 @@ def _deploy_instance(self): def setup_database(self): """Additional config.""" - super(Modoboa, self).setup_database() + super().setup_database() if not self.amavis_enabled: return self.backend.grant_access( @@ -202,7 +202,7 @@ def setup_database(self): def get_packages(self): """Include extra packages if needed.""" - packages = super(Modoboa, self).get_packages() + packages = super().get_packages() condition = ( package.backend.FORMAT == "rpm" and sys.version_info.major == 2 and @@ -228,7 +228,9 @@ def get_config_files(self): # Add worker for dkim if needed if self.modoboa_2_2_or_greater: config_files.append( - "supervisor-rq=/etc/supervisor/conf.d/modoboa-worker.conf") + "supervisor-rq-dkim=/etc/supervisor/conf.d/modoboa-dkim-worker.conf") + config_files.append( + "supervisor-rq-base=/etc/supervisor/conf.d/modoboa-base-worker.conf") return config_files def get_template_context(self):