Added support for Modoboa 1.16
This commit is contained in:
8
modoboa_installer/scripts/files/modoboa/supervisor.tpl
Normal file
8
modoboa_installer/scripts/files/modoboa/supervisor.tpl
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[program:policyd]
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
command=%{venv_path}/bin/python %{home_dir}/instance/manage.py policy_daemon
|
||||||
|
directory=%{home_dir}
|
||||||
|
redirect_stderr=true
|
||||||
|
user=%{user}
|
||||||
|
numprocs=1
|
||||||
@@ -121,6 +121,7 @@ smtpd_sender_login_maps =
|
|||||||
|
|
||||||
# Recipient restriction rules
|
# Recipient restriction rules
|
||||||
smtpd_recipient_restrictions =
|
smtpd_recipient_restrictions =
|
||||||
|
check_policy_service inet:127.0.0.1:9999
|
||||||
permit_mynetworks
|
permit_mynetworks
|
||||||
permit_sasl_authenticated
|
permit_sasl_authenticated
|
||||||
check_recipient_access
|
check_recipient_access
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import sys
|
|||||||
from .. import compatibility_matrix
|
from .. import compatibility_matrix
|
||||||
from .. import package
|
from .. import package
|
||||||
from .. import python
|
from .. import python
|
||||||
|
from .. import system
|
||||||
from .. import utils
|
from .. import utils
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
@@ -24,11 +25,12 @@ class Modoboa(base.Installer):
|
|||||||
"deb": [
|
"deb": [
|
||||||
"build-essential", "python3-dev", "libxml2-dev", "libxslt-dev",
|
"build-essential", "python3-dev", "libxml2-dev", "libxslt-dev",
|
||||||
"libjpeg-dev", "librrd-dev", "rrdtool", "libffi-dev", "cron",
|
"libjpeg-dev", "librrd-dev", "rrdtool", "libffi-dev", "cron",
|
||||||
"libssl-dev"
|
"libssl-dev", "redis-server", "supervisor"
|
||||||
],
|
],
|
||||||
"rpm": [
|
"rpm": [
|
||||||
"gcc", "gcc-c++", "python3-devel", "libxml2-devel", "libxslt-devel",
|
"gcc", "gcc-c++", "python3-devel", "libxml2-devel", "libxslt-devel",
|
||||||
"libjpeg-turbo-devel", "rrdtool-devel", "rrdtool", "libffi-devel",
|
"libjpeg-turbo-devel", "rrdtool-devel", "rrdtool", "libffi-devel",
|
||||||
|
"supervisor", "redis"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
config_files = [
|
config_files = [
|
||||||
@@ -182,6 +184,16 @@ class Modoboa(base.Installer):
|
|||||||
packages += ["openssl-devel"]
|
packages += ["openssl-devel"]
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
def get_config_files(self):
|
||||||
|
"""Return appropriate path."""
|
||||||
|
config_files = super().get_config_files()
|
||||||
|
if package.backend.FORMAT == "deb":
|
||||||
|
path = "supervisor=/etc/supervisor/conf.d/policyd.conf"
|
||||||
|
else:
|
||||||
|
path = "supervisor=/etc/supervisord.d/policyd.ini"
|
||||||
|
config_files.append(path)
|
||||||
|
return config_files
|
||||||
|
|
||||||
def get_template_context(self):
|
def get_template_context(self):
|
||||||
"""Additional variables."""
|
"""Additional variables."""
|
||||||
context = super(Modoboa, self).get_template_context()
|
context = super(Modoboa, self).get_template_context()
|
||||||
@@ -216,7 +228,7 @@ class Modoboa(base.Installer):
|
|||||||
"modoboa_amavis": {
|
"modoboa_amavis": {
|
||||||
"am_pdp_mode": "inet",
|
"am_pdp_mode": "inet",
|
||||||
},
|
},
|
||||||
"modoboa_stats": {
|
"maillog": {
|
||||||
"rrd_rootdir": rrd_root_dir,
|
"rrd_rootdir": rrd_root_dir,
|
||||||
},
|
},
|
||||||
"modoboa_pdfcredentials": {
|
"modoboa_pdfcredentials": {
|
||||||
@@ -231,7 +243,7 @@ class Modoboa(base.Installer):
|
|||||||
}
|
}
|
||||||
for path in ["/var/log/maillog", "/var/log/mail.log"]:
|
for path in ["/var/log/maillog", "/var/log/mail.log"]:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
settings["modoboa_stats"]["logfile"] = path
|
settings["maillog"]["logfile"] = path
|
||||||
if self.config.getboolean("opendkim", "enabled"):
|
if self.config.getboolean("opendkim", "enabled"):
|
||||||
settings["admin"]["dkim_keys_storage_dir"] = (
|
settings["admin"]["dkim_keys_storage_dir"] = (
|
||||||
self.config.get("opendkim", "keys_storage_dir"))
|
self.config.get("opendkim", "keys_storage_dir"))
|
||||||
@@ -249,3 +261,13 @@ class Modoboa(base.Installer):
|
|||||||
self._deploy_instance()
|
self._deploy_instance()
|
||||||
if not self.upgrade:
|
if not self.upgrade:
|
||||||
self.apply_settings()
|
self.apply_settings()
|
||||||
|
|
||||||
|
if 'centos' in utils.dist_name():
|
||||||
|
supervisor = "supervisord"
|
||||||
|
system.enable_and_start_service("redis")
|
||||||
|
else:
|
||||||
|
supervisor = "supervisor"
|
||||||
|
# Restart supervisor
|
||||||
|
system.enable_service(supervisor)
|
||||||
|
utils.exec_cmd("service {} stop".format(supervisor))
|
||||||
|
utils.exec_cmd("service {} start".format(supervisor))
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import stat
|
|||||||
|
|
||||||
from .. import package
|
from .. import package
|
||||||
from .. import python
|
from .. import python
|
||||||
|
from .. import system
|
||||||
from .. import utils
|
from .. import utils
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
@@ -77,5 +78,6 @@ class Radicale(base.Installer):
|
|||||||
daemon_name = (
|
daemon_name = (
|
||||||
"supervisor" if package.backend.FORMAT == "deb" else "supervisord"
|
"supervisor" if package.backend.FORMAT == "deb" else "supervisord"
|
||||||
)
|
)
|
||||||
|
system.enable_service(daemon_name)
|
||||||
utils.exec_cmd("service {} stop".format(daemon_name))
|
utils.exec_cmd("service {} stop".format(daemon_name))
|
||||||
utils.exec_cmd("service {} start".format(daemon_name))
|
utils.exec_cmd("service {} start".format(daemon_name))
|
||||||
|
|||||||
Reference in New Issue
Block a user