catcrafts.net/deploy/catcrafts-deploy.service

30 lines
1.3 KiB
SYSTEMD
Raw Normal View History

2026-08-05 04:18:37 +02:00
# Triggered by catcrafts-deploy.path when CI touches the deploy marker.
#
# Deliberately does exactly one thing. It is reachable from anything that can
# write the marker file, so it must not be a general-purpose hook — no scripts
# from the deployed tree, no arguments derived from the marker's contents.
[Unit]
Description=Restart catcrafts.net backend after a deploy
Documentation=https://forgejo.catcrafts.net/Catcrafts/catcrafts.net
[Service]
Type=oneshot
2026-08-15 00:54:05 +02:00
# Verify the freshly deployed binary before cutting over. The unit tests run
# in CI (crafter-build test) before anything is shipped, so what this gate
# checks is the part CI cannot: that THIS binary executes on THIS host — the
# dynamic loader finds libmsquic (the first real deploy died exactly there,
# exit 127) — and renders a page from the deployed content. If it fails, the
# currently-running (working) server is left alone rather than replaced with
# a broken one.
#
# WorkingDirectory because --render loads ./content; StandardOutput=null so
# the rendered HTML does not land in the journal on every deploy (stderr,
# where failures speak, still does).
WorkingDirectory=/srv/catcrafts-app
StandardOutput=null
StandardError=journal
ExecStartPre=/srv/catcrafts-app/catcrafts-server --render /
2026-08-05 04:18:37 +02:00
ExecStart=/usr/bin/systemctl restart catcrafts-server.service