mirror of
https://github.com/chatmail/relay.git
synced 2026-08-27 10:33:14 +00:00
chore: un-hardcode executable paths in some systemd service files
makes it consistent with the other services.
This commit is contained in:
@@ -4,6 +4,8 @@ from ..basedeploy import Deployer
|
||||
|
||||
|
||||
class AcmetoolDeployer(Deployer):
|
||||
bin_path = "/usr/bin/acmetool"
|
||||
|
||||
def __init__(self, email, domains):
|
||||
self.domains = domains
|
||||
self.email = email
|
||||
@@ -41,8 +43,12 @@ class AcmetoolDeployer(Deployer):
|
||||
domains=self.domains,
|
||||
)
|
||||
|
||||
self.ensure_systemd_unit("acmetool/acmetool-redirector.service")
|
||||
self.ensure_systemd_unit("acmetool/acmetool-reconcile.service")
|
||||
self.ensure_systemd_unit(
|
||||
"acmetool/acmetool-redirector.service.j2", bin_path=self.bin_path
|
||||
)
|
||||
self.ensure_systemd_unit(
|
||||
"acmetool/acmetool-reconcile.service.j2", bin_path=self.bin_path
|
||||
)
|
||||
self.ensure_systemd_unit("acmetool/acmetool-reconcile.timer")
|
||||
|
||||
def activate(self):
|
||||
@@ -52,5 +58,5 @@ class AcmetoolDeployer(Deployer):
|
||||
|
||||
server.shell(
|
||||
name=f"Reconcile certificates for: {', '.join(self.domains)}",
|
||||
commands=["acmetool --batch --xlog.severity=debug reconcile"],
|
||||
commands=[f"{self.bin_path} --batch --xlog.severity=debug reconcile"],
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,5 +4,5 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/acmetool --batch reconcile
|
||||
ExecStart={{ bin_path }} --batch reconcile
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ Description=acmetool HTTP redirector
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/bin/acmetool redirector --service.uid=daemon --bind=127.0.0.1:402
|
||||
ExecStart={{ bin_path }} redirector --service.uid=daemon --bind=127.0.0.1:402
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
|
||||
@@ -51,7 +51,7 @@ def get_resource(arg, pkg=__package__):
|
||||
return importlib.resources.files(pkg).joinpath(arg)
|
||||
|
||||
|
||||
def configure_remote_units(deployer, mail_domain, units) -> None:
|
||||
def configure_remote_units(deployer, mail_domain, units, **kwargs) -> None:
|
||||
remote_base_dir = "/usr/local/lib/chatmaild"
|
||||
remote_venv_dir = f"{remote_base_dir}/venv"
|
||||
remote_chatmail_inipath = f"{remote_base_dir}/chatmail.ini"
|
||||
@@ -63,6 +63,7 @@ def configure_remote_units(deployer, mail_domain, units) -> None:
|
||||
config_path=remote_chatmail_inipath,
|
||||
remote_venv_dir=remote_venv_dir,
|
||||
mail_domain=mail_domain,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
basename = fn if "." in fn else f"{fn}.service"
|
||||
|
||||
@@ -301,6 +301,8 @@ def check_config(config):
|
||||
|
||||
|
||||
class TurnDeployer(Deployer):
|
||||
bin_path = "/usr/local/bin/chatmail-turn"
|
||||
|
||||
def __init__(self, mail_domain):
|
||||
self.mail_domain = mail_domain
|
||||
self.units = ["turnserver"]
|
||||
@@ -316,16 +318,21 @@ class TurnDeployer(Deployer):
|
||||
"0fb3e792419494e21ecad536464929dba706bb2c88884ed8f1788141d26fc756",
|
||||
),
|
||||
}[host.get_fact(facts.server.Arch)]
|
||||
self.download_executable(url, "/usr/local/bin/chatmail-turn", sha256sum)
|
||||
self.download_executable(url, self.bin_path, sha256sum)
|
||||
|
||||
def configure(self):
|
||||
configure_remote_units(self, self.mail_domain, self.units)
|
||||
configure_remote_units(
|
||||
self, self.mail_domain, self.units, bin_path=self.bin_path
|
||||
)
|
||||
|
||||
def activate(self):
|
||||
activate_remote_units(self, self.units)
|
||||
|
||||
|
||||
class IrohDeployer(Deployer):
|
||||
bin_path = "/usr/local/bin/iroh-relay"
|
||||
config_path = "/etc/iroh-relay.toml"
|
||||
|
||||
def __init__(self, enable_iroh_relay):
|
||||
self.enable_iroh_relay = enable_iroh_relay
|
||||
|
||||
@@ -342,14 +349,18 @@ class IrohDeployer(Deployer):
|
||||
}[host.get_fact(facts.server.Arch)]
|
||||
self.download_executable(
|
||||
url,
|
||||
"/usr/local/bin/iroh-relay",
|
||||
self.bin_path,
|
||||
sha256sum,
|
||||
extract="gunzip | tar -xf - ./iroh-relay -O",
|
||||
)
|
||||
|
||||
def configure(self):
|
||||
self.ensure_systemd_unit("iroh-relay.service")
|
||||
self.put_file("iroh-relay.toml", "/etc/iroh-relay.toml")
|
||||
self.ensure_systemd_unit(
|
||||
"iroh-relay.service.j2",
|
||||
bin_path=self.bin_path,
|
||||
config_path=self.config_path,
|
||||
)
|
||||
self.put_file("iroh-relay.toml", self.config_path)
|
||||
|
||||
def activate(self):
|
||||
self.ensure_service(
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
Description=Iroh relay
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/iroh-relay --config-path /etc/iroh-relay.toml
|
||||
ExecStart={{ bin_path }} --config-path {{ config_path }}
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
User=iroh
|
||||
@@ -5,6 +5,9 @@ from cmdeploy.basedeploy import Deployer
|
||||
|
||||
|
||||
class MtailDeployer(Deployer):
|
||||
bin_path = "/usr/local/bin/mtail"
|
||||
progs_dir = "/etc/mtail"
|
||||
|
||||
def __init__(self, mtail_address):
|
||||
self.mtail_address = mtail_address
|
||||
|
||||
@@ -24,7 +27,7 @@ class MtailDeployer(Deployer):
|
||||
}[host.get_fact(facts.server.Arch)]
|
||||
self.download_executable(
|
||||
url,
|
||||
"/usr/local/bin/mtail",
|
||||
self.bin_path,
|
||||
sha256sum,
|
||||
extract="gunzip | tar -xf - mtail -O",
|
||||
)
|
||||
@@ -36,8 +39,12 @@ class MtailDeployer(Deployer):
|
||||
"mtail/mtail.service.j2",
|
||||
address=self.mtail_address or "127.0.0.1",
|
||||
port=3903,
|
||||
bin_path=self.bin_path,
|
||||
progs_dir=self.progs_dir,
|
||||
)
|
||||
self.put_file(
|
||||
"mtail/delivered_mail.mtail", f"{self.progs_dir}/delivered_mail.mtail"
|
||||
)
|
||||
self.put_file("mtail/delivered_mail.mtail", "/etc/mtail/delivered_mail.mtail")
|
||||
|
||||
def activate(self):
|
||||
active = bool(self.mtail_address)
|
||||
|
||||
@@ -5,7 +5,7 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/bin/sh -c "journalctl -f -o short-iso -n 0 | /usr/local/bin/mtail --address={{ address }} --port={{ port }} --progs /etc/mtail --logtostderr --logs -"
|
||||
ExecStart=/bin/sh -c "journalctl -f -o short-iso -n 0 | {{ bin_path }} --address={{ address }} --port={{ port }} --progs {{ progs_dir }} --logtostderr --logs -"
|
||||
Restart=on-failure
|
||||
RestartSec=2s
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ After=network.target
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=vmail
|
||||
ExecStart=/usr/local/lib/chatmaild/venv/bin/chatmail-expire /usr/local/lib/chatmaild/chatmail.ini -v --remove
|
||||
ExecStart={execpath} {config_path} -v --remove
|
||||
|
||||
|
||||
@@ -5,5 +5,5 @@ After=network.target
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=vmail
|
||||
ExecStart=/usr/local/lib/chatmaild/venv/bin/chatmail-fsreport /usr/local/lib/chatmaild/chatmail.ini
|
||||
ExecStart={execpath} {config_path}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ After=network.target
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/local/bin/chatmail-turn --realm {mail_domain} --socket /run/chatmail-turn/turn.socket
|
||||
ExecStart={bin_path} --realm {mail_domain} --socket /run/chatmail-turn/turn.socket
|
||||
|
||||
# Create /run/chatmail-turn
|
||||
RuntimeDirectory=chatmail-turn
|
||||
|
||||
Reference in New Issue
Block a user