Services
A service is anything with data worth keeping. It gets a bacre.yaml (for example, next to compose.yaml for a Docker setup), and Bacre picks it up from the paths listed in its config.
A service can use btrfs, restic or both:
service: immich
home: . # hooks run here; relative to this file
btrfs:
schedule: "5 * * * *"
subvolume: /mnt/pool/@immich
snapshotPaths:
- /mnt/pool/.snapshots
- /mnt/backup/.snapshots
retention:
keepHourly: 24
keepDaily: 7
lifecycle:
stop: docker compose stop
start: docker compose start
restic:
schedule: "0 3 * * *"
repository: /mnt/offsite/restic/immich
envset: nas
retention:
keepDaily: 7
keepWeekly: 4
keepMonthly: 6
backupPaths:
- /mnt/pool/@immich/library
- /mnt/pool/@immich/dump
lifecycle:
backupPrepare: docker compose exec -T database pg_dumpall -U postgres > /mnt/pool/@immich/dump/immich.sql
backupRelease: rm -f /mnt/pool/@immich/dump/immich.sql
restoreApply: |
docker compose stop
cp -a "$BACRE_STAGING/mnt/pool/@immich/library/." /mnt/pool/@immich/library/
docker compose exec -T database psql -U postgres < "$BACRE_STAGING/mnt/pool/@immich/dump/immich.sql"
docker compose start
btrfs
The subvolume is snapshotted into whichever snapshot path lives on the same filesystem, and then sent to the others. Every send after the first is incremental.
Scheduled snapshots are taken while the service keeps running. From the interface, you can also take a cold one: Bacre runs lifecycle.stop first and lifecycle.start afterwards.
restic
The backupPaths are backed up to the repository. Credentials (RESTIC_PASSWORD, S3 keys, …) come from the named envset in Bacre's config, so they never end up in a service's own files.
The hooks are all optional:
| Hook | Runs |
|---|---|
backupPrepare | before a backup, to stop the service or dump a database |
backupRelease | after a backup, whether it worked or not |
restoreApply | to restore a downloaded snapshot, which sits under $BACRE_STAGING |
Schedules and retention
A schedule is a regular cron expression in the server's local time. Leave it out to back up by hand only. If Bacre was down when a backup was due, it catches up once it starts again.
Retention takes restic's keepLast, keepHourly, keepDaily, keepWeekly and keepMonthly rules, for btrfs snapshots as well.