Add nightly restic backups to Scaleway Object Storage #4

Merged
reudy merged 1 commit from agent/restic-backups into main 2026-10-27 10:22:56 +01:00
Member

Adds nightly restic backups of the VPS to the Scaleway bucket, including the panel's apps. See BACKUPS.md for setup, day-to-day use and a full disaster-recovery runbook.

What it does

One restic repository with three jobs (backups.nix):

Job When What
panel daily 03:30 /var/lib/containers + rootless named volumes. Running containers are stopped during the backup (usually under a minute) and started again afterwards, even if the backup fails, so DBs inside apps are copied consistently.
system daily 04:00 /etc, /home, /root, /var/lib, /var/backup. Before it runs, Forgejo/Nextcloud/Authelia/panel SQLite DBs are .dumped (consistent while services run).
maintenance Sun 05:30 forget --prune (7 daily / 4 weekly / 6 monthly) + check --with-cache --read-data-subset=2G

Cost choices

Scaleway charges nothing for requests, only for stored GB-hours, egress over 75 GB/month, and Glacier restores. So:

  • objects go to One Zone (ONEZONE_IA), half the price of Multi-AZ;
  • /nix/store, container images, caches and Nextcloud previews are excluded (all rebuildable);
  • all jobs share /var/cache/restic, so metadata is downloaded once;
  • prune is weekly, and check reads a fixed 2 GB sample instead of the whole repo;
  • no Glacier: every restore and every repack would need a paid, hours-long thaw.

Before merging / deploying

This won't build until two agenix secrets exist: secrets/restic-password.age and secrets/restic-env.age (repo URL + Scaleway keys). Steps are in BACKUPS.md → One-time setup. Keep the restic password and keys in a password manager as well.

Testing

  • Evaluated the full nixosConfigurations.vps to a derivation in a Nix container (with dummy .age files and the panel input overridden to local main). Also built and read the generated unit files and prepare/cleanup scripts, and ran bash -n on them.
  • Not tested on the VPS: no real backup has run, and I haven't seen the container stop/start or the S3 access run live. The first manual run in BACKUPS.md covers that.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HA82gUd5tW9VHStkEKmgqu

Adds nightly restic backups of the VPS to the Scaleway bucket, including the panel's apps. See `BACKUPS.md` for setup, day-to-day use and a full disaster-recovery runbook. ## What it does One restic repository with three jobs (`backups.nix`): | Job | When | What | |---|---|---| | `panel` | daily 03:30 | `/var/lib/containers` + rootless named volumes. Running containers are **stopped during the backup** (usually under a minute) and started again afterwards, even if the backup fails, so DBs inside apps are copied consistently. | | `system` | daily 04:00 | `/etc`, `/home`, `/root`, `/var/lib`, `/var/backup`. Before it runs, Forgejo/Nextcloud/Authelia/panel SQLite DBs are `.dump`ed (consistent while services run). | | `maintenance` | Sun 05:30 | `forget --prune` (7 daily / 4 weekly / 6 monthly) + `check --with-cache --read-data-subset=2G` | ## Cost choices Scaleway charges nothing for requests, only for stored GB-hours, egress over 75 GB/month, and Glacier restores. So: - objects go to **One Zone** (`ONEZONE_IA`), half the price of Multi-AZ; - `/nix/store`, container images, caches and Nextcloud previews are excluded (all rebuildable); - all jobs share `/var/cache/restic`, so metadata is downloaded once; - prune is weekly, and check reads a fixed 2 GB sample instead of the whole repo; - no Glacier: every restore and every repack would need a paid, hours-long thaw. ## Before merging / deploying This **won't build until two agenix secrets exist**: `secrets/restic-password.age` and `secrets/restic-env.age` (repo URL + Scaleway keys). Steps are in `BACKUPS.md` → *One-time setup*. Keep the restic password and keys in a password manager as well. ## Testing - Evaluated the full `nixosConfigurations.vps` to a derivation in a Nix container (with dummy `.age` files and the panel input overridden to local `main`). Also built and read the generated unit files and prepare/cleanup scripts, and ran `bash -n` on them. - **Not tested on the VPS**: no real backup has run, and I haven't seen the container stop/start or the S3 access run live. The first manual run in `BACKUPS.md` covers that. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01HA82gUd5tW9VHStkEKmgqu
agent added 1 commit 2026-10-27 09:37:09 +01:00
Three restic jobs share one repository:
- panel (03:30): /var/lib/containers and rootless named volumes, with the
  panel's containers stopped for a consistent copy and started again after
- system (04:00): /etc, /home, /root, /var/lib, plus consistent .dump
  copies of the Forgejo, Nextcloud, Authelia and panel SQLite databases
- maintenance (Sun 05:30): forget/prune and a 2 GB sampled check

Scaleway bills storage and egress, not requests, so objects go to One
Zone, /nix/store and images are left out, all jobs share one cache, and
pruning and checks are weekly and bounded.

Needs secrets/restic-password.age and secrets/restic-env.age to be
created before deploying; BACKUPS.md has the steps and a restore runbook.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gUd5tW9VHStkEKmgqu
reudy merged commit f747aab65d into main 2026-10-27 10:22:56 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: reudy-net/nixos#4
No description provided.