feat(backup): add forgejo dump systemd timer + wire into runbook

Daily 'forgejo dump' (tar.zst) to /opt/backups/forgejo with 14-day retention,
via a oneshot service + timer. Maintenance section now documents both backup
layers (Codeberg push-mirror for git, dump timer for full state).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Josh Bairstow 2026-06-03 00:55:03 +10:00
parent d326670b1f
commit 892601f65b
4 changed files with 70 additions and 3 deletions

View file

@ -267,9 +267,21 @@ No changes to this repo. In the new project:
## Maintenance / hardening
- **Backups:** the `forgejo_data` volume is now the source of truth (repos, DB,
registry blobs). Run `docker compose exec forgejo forgejo dump` on a schedule,
and set a **push-mirror** on each repo to a cloud host (GitLab/GitHub) for
off-box git backup.
registry blobs). Two layers:
- *Off-box git:* a **push-mirror** of each repo to Codeberg (repo → Settings →
Mirror Settings → Add Push Mirror; HTTPS URL + a `write:repository` token).
- *Full dump:* the systemd timer in [`backup/`](backup/) runs `forgejo dump`
daily and keeps 14 days under `/opt/backups/forgejo`. Install on the VPS:
```sh
sudo install -m 0755 backup/forgejo-backup.sh /usr/local/bin/forgejo-backup.sh
sudo cp backup/forgejo-backup.{service,timer} /etc/systemd/system/
sudo systemctl daemon-reload && sudo systemctl enable --now forgejo-backup.timer
sudo systemctl start forgejo-backup.service # test once
ls -lh /opt/backups/forgejo # confirm an archive landed
systemctl list-timers forgejo-backup.timer # confirm next run scheduled
```
Copy the dumps off-box too (they're useless if the VPS dies). Add
`--skip-package` in the script to exclude registry blobs if dumps get large.
- **Registry GC:** per-commit `:sha` tags accumulate. Enable Forgejo's package
cleanup rules / run periodic GC so the VPS disk doesn't fill.
- **Certs:** never delete the `caddy_data` volume — losing it re-issues every