Skip to content

Backups

Fedisport comes with encrypted, tested backups using restic, to any S3-compatible storage (MinIO, Backblaze B2, Hetzner, AWS…).

What's in a backup

Both databases (Fedisport's and Keycloak's: accounts, passwords, passkeys), the uploaded files (originals, photos, exports) and the settings, in one encrypted snapshot each night. Kept: 7 daily, 5 weekly, 12 monthly. Map tiles aren't included; they download again.

Compose

cp backup.env.example backup.env && chmod 600 backup.env   # the repository, keys, a password
scripts/backup.sh init        # once
scripts/backup.sh             # a backup now
scripts/restore-check.sh      # the restore drill: restores into a throwaway database and compares

Install the nightly backup and the monthly drill in cron. backup.env can name a webhook for alerts (Discord, Slack, Matrix, ntfy).

Two things to keep elsewhere

The restic password (RESTIC_PASSWORD) and FEDISPORT_KEY_ENCRYPTION_KEY. Without either, a backup can't be used.

Use versioning

On the bucket, turn on versioning with object lock (governance, ~20 days) and expire old versions after ~30 days: then even someone with your server's keys can't destroy yesterday's backups.

Restoring

Restore the latest snapshot, put the settings back, pg_restore both dumps into a fresh database, copy the uploads into the uploads volume, and start. The README has the exact commands.