Adds deploy/server-backup/install-flows.sh — een idempotent installer die
de ops-agent-zijde van de server-backup feature aan elkaar plakt:
1. wrappers/*.sh → /srv/backups/scripts/wrappers/
2. flows.example/server_backup_* → /etc/ops-agent/flows/
3. commands.yml.example commands → /etc/ops-agent/commands.yml (append, met backup)
4. NOPASSWD-regels voor wrappers → /etc/sudoers.d/ops-agent (visudo-validated)
5. systemctl restart ops-agent
6. systemctl enable --now server-backup.timer
Wat het bewust *niet* doet (staat in scriptheader): restic env/password
aanmaken, repos initialiseren, base-scripts of systemd-units plaatsen —
die secrets-stappen blijven handwerk per README "Snelle installatie".
Re-run safe:
- cmp-check per file in stappen 1-2 (skip als identiek)
- grep-check op command-name in stap 3 (skip als al aanwezig)
- visudo-validatie in stap 4 voorkomt lockout bij syntax-fout
- backups van mutaties: commands.yml.bak.<ts> en sudoers.d/ops-agent.bak.<ts>
Regex-fix t.o.v. eerste handmatige run vandaag: command-block-extractie
gebruikt nu [a-z0-9_]+ ipv [a-z_]+, zodat namen met digits (restic_*_b2)
als losse blocks gezien worden. Het oude pattern miste ze maar sleepte
ze toevallig mee in het vorige block — eindresultaat correct, output
misleidend. Nieuwe versie faalt expliciet als een command echt ontbreekt.
README aangevuld met sectie "Ops-agent wiring (na stap 1-7)" die naar
het script verwijst.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a server-wide backup capability beyond the existing ops_dashboard
pg_dump flow:
- Daily systemd timer (03:30) runs pg_dumpall + Forgejo dump, then restic
to a local NAS repo and an offsite Backblaze B2 repo with Object Lock.
Phase-based script with single-instance flock, structured statusfile,
systemd hardening, and live-datadir excludes (Postgres / Forgejo) so
the dumps stay authoritative.
- Ops-agent gets nine new read-only/trigger commands (snapshots, stats,
status, logs, plus two triggers) backed by sudoers-whitelisted wrapper
scripts that source /etc/restic-backup.env so the agent never sees the
restic password or B2 keys.
- Two new flows (server_backup_full, server_backup_restore_test) drive
the dashboard's "Backup now" and "Restore test" buttons.
- /settings/backups gains a Server backup section with overall + per-phase
status, NAS / B2 snapshot tables, restore-size / raw-data / dedup-ratio
stats, and the last restore-test result. The existing pg_dump section
is preserved unchanged.
- Runbook docs/runbooks/server-backup.md follows the tailscale-setup
pattern (plan + addendum) and covers B2 Object Lock + scoped keys,
Forgejo subplan with isolated restore-test stack, the off-server
maintenance flow for B2 prune, and the integrity-check schedule.
Code-only change — installation on scrum4me-srv follows the runbook.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>