Skip to content

Commit

Permalink
Deploy supervisor config for new RQ worker
Browse files Browse the repository at this point in the history
  • Loading branch information
tonioo committed Dec 22, 2023
1 parent b7f378f commit 7097e15
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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
10 changes: 6 additions & 4 deletions modoboa_installer/scripts/modoboa.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -194,15 +194,15 @@ 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(
self.config.get("amavis", "dbname"), self.dbuser)

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
Expand All @@ -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):
Expand Down

0 comments on commit 7097e15

Please sign in to comment.