prosody: Make component registration more robust

This commit is contained in:
Alex Palaistras 2023-10-21 17:26:18 +01:00
parent a5ce4675d5
commit 5131d1d93c
2 changed files with 4 additions and 6 deletions

View File

@ -75,6 +75,7 @@ modules_enabled = {
"conversejs"; -- Web-based frontend for XMPP
"bookmarks"; -- Next-generation group-chat bookmarks
"turn_external"; -- Connect to TURN/STUN server
"reload_components"; -- Automatically reload components when they are added and removed.
}
-- These modules are auto-loaded, but should you want

View File

@ -12,13 +12,10 @@ Environment=COMPONENT_CONF=%E/coreos-home-server/prosody/service/component.cfg.l
EnvironmentFile=-%E/coreos-home-server/%i/%i.env
ExecStartPre=/bin/install --mode 0700 --directory /tmp/%N
ExecStartPre=/bin/sh -c "envsubst < ${COMPONENT_CONF} > /tmp/%N/component.cfg.lua"
ExecStartPre=/bin/podman cp --archive=false /tmp/%N/component.cfg.lua prosody:/etc/prosody/conf.d/10-%i.cfg.lua
ExecStartPre=/bin/podman exec prosody prosodyctl shell config reload
ExecStartPre=/bin/sh -c 'podman exec prosody prosodyctl shell host deactivate "$PROSODY_COMPONENT_NAME" || true'
ExecStart=/bin/podman exec prosody prosodyctl shell host activate "$PROSODY_COMPONENT_NAME"
ExecStart=/bin/podman cp --archive=false /tmp/%N/component.cfg.lua prosody:/etc/prosody/conf.d/10-%i.cfg.lua
ExecStartPost=/bin/podman exec prosody prosodyctl shell config reload
ExecStartPost=/bin/rm -Rf /tmp/%N
ExecStop=/bin/podman exec prosody prosodyctl shell host deactivate "$PROSODY_COMPONENT_NAME"
ExecStopPost=/bin/podman exec --user=root prosody rm -f /etc/prosody/conf.d/10-%i.cfg.lua
ExecStop=/bin/podman exec --user=root prosody rm -f /etc/prosody/conf.d/10-%i.cfg.lua
ExecStopPost=/bin/podman exec prosody prosodyctl shell config reload
[Install]