chore(deploy): add OpenRC support and deployment helpers

Add OpenRC service and configuration files to support automated server
updates on systems without systemd timers.

- Add `deploy/update-loop.sh` to handle periodic updates for OpenRC.
- Add `deploy/burrow-update.openrc` and `deploy/burrow-update.conf`.
- Update `deploy/update.sh` to support both systemd and OpenRC service
  restarts.
- Add `deploy/README.md` with installation instructions.
- Update `.gitignore` to allow the deployment documentation.
This commit is contained in:
Snipzil committed 2026-10-20 19:16:04 -04:00
1 parent 9f69b3511b
commit d20920dc3c
6 files changed
+105 -3

No files matched your search

+23 -3
View File
@@ -1,15 +1,35 @@
#!/usr/bin/env bash
# brings the server to origin's main and restarts it when the change needs it.
# run as root by burrow-update.timer; git itself runs as the server's user.
# Brings the server to origin's main and restarts it when the change needs it.
# Run as root by either burrow-update.timer or the OpenRC updater service; git
# itself runs as the server's user.
set -euo pipefail
dir=${BURROW_DIR:-/home/aj/ajc-private-server}
user=${BURROW_USER:-aj}
service=${BURROW_SERVICE:-burrow}
branch=${BURROW_BRANCH:-main}
init=${BURROW_INIT:-}
git() { runuser -u "$user" -- git -C "$dir" "$@"; }
restart_service() {
case "$init" in
systemd) systemctl restart "$service" ;;
openrc) rc-service "$service" restart ;;
"")
if [ -d /run/openrc ] || [ -n "${RC_SVCNAME:-}" ]; then
rc-service "$service" restart
else
systemctl restart "$service"
fi
;;
*)
echo "unknown BURROW_INIT value: $init (expected systemd or openrc)" >&2
return 2
;;
esac
}
git fetch --quiet origin "$branch"
old=$(git rev-parse HEAD)
new=$(git rev-parse "origin/$branch")
@@ -33,7 +53,7 @@ done
# pipefail read as nothing to restart for.
changed=$(git diff --name-only "$old" "$new")
if grep -qvE '^(public/|client-updates/|test/|tools/|deploy/|[^/]+\.md$|\.gitignore$)' <<<"$changed"; then
systemctl restart "$service"
restart_service
echo "updated $old -> $new, restarted $service"
else
echo "updated $old -> $new, no restart needed"