summaryrefslogtreecommitdiff
path: root/deployment
diff options
context:
space:
mode:
Diffstat (limited to 'deployment')
-rw-r--r--deployment/doot-health.service18
-rw-r--r--deployment/doot-health.timer14
2 files changed, 32 insertions, 0 deletions
diff --git a/deployment/doot-health.service b/deployment/doot-health.service
new file mode 100644
index 0000000..33e8e77
--- /dev/null
+++ b/deployment/doot-health.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=doot.terst.org health check (gateway routes + sub-services)
+Documentation=file:///site/doot.terst.org/app-scripts/health-check
+After=network-online.target
+
+[Service]
+Type=oneshot
+# Runs as root: recovery needs systemctl start and chmod on www-data files.
+User=root
+ExecStart=/site/doot.terst.org/app-scripts/health-check
+
+# A failed run should be visible in `systemctl --failed`, so do not swallow the
+# exit code. The unit going failed is a large part of the alerting here, given
+# there is no mail/ntfy on this host.
+SuccessExitStatus=0
+
+[Install]
+WantedBy=multi-user.target
diff --git a/deployment/doot-health.timer b/deployment/doot-health.timer
new file mode 100644
index 0000000..22b687f
--- /dev/null
+++ b/deployment/doot-health.timer
@@ -0,0 +1,14 @@
+[Unit]
+Description=Run the doot.terst.org health check every 5 minutes
+
+[Timer]
+# 2 minutes after boot: the failure this exists for first appeared at a reboot,
+# when sub-services could not exec and systemd gave up on them.
+OnBootSec=2min
+OnUnitActiveSec=5min
+# Spread the load off exact-minute boundaries.
+RandomizedDelaySec=30s
+Unit=doot-health.service
+
+[Install]
+WantedBy=timers.target