Skip to content

Commit 3f05a9a

Browse files
committed
simplify cert loading and triggering, add a note for cross-bind mounts
1 parent 821ae5b commit 3f05a9a

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

cmdeploy/src/cmdeploy/external/deployer.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,5 @@ def activate(self):
6363
restarted=self.need_restart,
6464
daemon_reload=self.need_restart,
6565
)
66-
# Trigger the oneshot service so services pick up the current cert.
67-
# The path unit handles future changes via inotify.
68-
systemd.service(
69-
name="Reload TLS services for current certificate",
70-
service="tls-cert-reload.service",
71-
running=True,
72-
daemon_reload=False,
73-
)
66+
# No explicit reload needed here: dovecot/nginx read the cert
67+
# on startup, and the .path watcher handles live changes.

cmdeploy/src/cmdeploy/external/tls-cert-reload.path.f

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Watch the TLS certificate file for changes.
22
# When the cert is updated (e.g. renewed by an external process),
3-
# this triggers tls-cert-reload.service to restart the affected services.
3+
# this triggers tls-cert-reload.service to reload the affected services.
4+
#
5+
# NOTE: changes to the certificates are not detected if they cross bind-mount boundaries.
6+
# After cert renewal, you must then trigger the reload explicitly:
7+
# systemctl start tls-cert-reload.service
48
[Unit]
59
Description=Watch TLS certificate for changes
610

cmdeploy/src/cmdeploy/external/tls-cert-reload.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ Description=Reload TLS services after certificate change
1111

1212
[Service]
1313
Type=oneshot
14-
ExecStart=/bin/systemctl reload dovecot
15-
ExecStart=/bin/systemctl reload nginx
14+
ExecStart=/bin/systemctl try-reload-or-restart dovecot
15+
ExecStart=/bin/systemctl try-reload-or-restart nginx

doc/source/getting_started.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ The deploy will verify that both files exist on the server.
229229
You are responsible for certificate renewal.
230230
When the certificate file changes on disk,
231231
all relay services pick up the new certificate automatically
232-
(via a systemd path watcher installed during deploy).
232+
via a systemd path watcher installed during deploy.
233+
The watcher uses inotify, which does not cross bind-mount boundaries.
234+
If you use such a setup, you must trigger the reload explicitly after renewal::
235+
236+
systemctl start tls-cert-reload.service
233237

234238

235239
Migrating to a new build machine

0 commit comments

Comments
 (0)