Deploy supervisor config for new RQ worker
This commit is contained in:
@@ -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
|
||||||
@@ -44,7 +44,7 @@ class Modoboa(base.Installer):
|
|||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
"""Get configuration."""
|
"""Get configuration."""
|
||||||
super(Modoboa, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.venv_path = self.config.get("modoboa", "venv_path")
|
self.venv_path = self.config.get("modoboa", "venv_path")
|
||||||
self.instance_path = self.config.get("modoboa", "instance_path")
|
self.instance_path = self.config.get("modoboa", "instance_path")
|
||||||
self.extensions = self.config.get("modoboa", "extensions").split()
|
self.extensions = self.config.get("modoboa", "extensions").split()
|
||||||
@@ -194,7 +194,7 @@ class Modoboa(base.Installer):
|
|||||||
|
|
||||||
def setup_database(self):
|
def setup_database(self):
|
||||||
"""Additional config."""
|
"""Additional config."""
|
||||||
super(Modoboa, self).setup_database()
|
super().setup_database()
|
||||||
if not self.amavis_enabled:
|
if not self.amavis_enabled:
|
||||||
return
|
return
|
||||||
self.backend.grant_access(
|
self.backend.grant_access(
|
||||||
@@ -202,7 +202,7 @@ class Modoboa(base.Installer):
|
|||||||
|
|
||||||
def get_packages(self):
|
def get_packages(self):
|
||||||
"""Include extra packages if needed."""
|
"""Include extra packages if needed."""
|
||||||
packages = super(Modoboa, self).get_packages()
|
packages = super().get_packages()
|
||||||
condition = (
|
condition = (
|
||||||
package.backend.FORMAT == "rpm" and
|
package.backend.FORMAT == "rpm" and
|
||||||
sys.version_info.major == 2 and
|
sys.version_info.major == 2 and
|
||||||
@@ -228,7 +228,9 @@ class Modoboa(base.Installer):
|
|||||||
# Add worker for dkim if needed
|
# Add worker for dkim if needed
|
||||||
if self.modoboa_2_2_or_greater:
|
if self.modoboa_2_2_or_greater:
|
||||||
config_files.append(
|
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
|
return config_files
|
||||||
|
|
||||||
def get_template_context(self):
|
def get_template_context(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user