feat(restic): add restic backup role #133

Merged
saibotk merged 1 commit from restic into main 2025-05-12 00:44:34 +02:00
Owner

Adds an opinionated backup solution for BTRFS volumes using
restic with the resticprofile tool.

By default, this will create a daily backup of the configured target directories.
It ensures that they are consistent by using the native BTRFS snapshot functionality.

Every week, on sunday night, it will check the integrity and prune old
snapshots.

Metrics are also exposed through resticprofile in prom format and
written to the /backup/status/status.prom file.

This role also allows to configure ntfy notifications for errors.

To query the repository and run various commands manually, we also
install the resticprofile helper script, that can be run as root.
Note: Backups cannot be done using the helper as the required mounts
are not included in the script.

We keep backups using the following retention strategy:

  • last 4 hourly
  • last 7 daily
  • last 4 weekly
  • last 3 monthly
  • backups done in the last 3 hours
  • tag "forever" -> forever
Adds an opinionated backup solution for BTRFS volumes using `restic` with the `resticprofile` tool. By default, this will create a daily backup of the configured target directories. It ensures that they are consistent by using the native BTRFS snapshot functionality. Every week, on sunday night, it will check the integrity and prune old snapshots. Metrics are also exposed through `resticprofile` in prom format and written to the `/backup/status/status.prom` file. This role also allows to configure ntfy notifications for errors. To query the repository and run various commands manually, we also install the `resticprofile` helper script, that can be run as root. Note: Backups cannot be done using the helper as the required mounts are not included in the script. We keep backups using the following retention strategy: - last 4 hourly - last 7 daily - last 4 weekly - last 3 monthly - backups done in the last 3 hours - tag "forever" -> forever
saibotk self-assigned this 2025-03-31 01:45:23 +02:00
wip: resticprofile refactor
All checks were successful
ci/woodpecker/pr/ansible-lint Pipeline was successful
f872d3a8bc
TODO! NEEDS MORE TESTING & POLISHING
saibotk changed title from WIP: restic to feat(restic): add restic backup role 2025-04-27 22:19:55 +02:00
requested review from histalek 2025-04-27 22:20:41 +02:00
histalek left a comment
Owner

two suggestions, otherwise LGTM :)

two suggestions, otherwise LGTM :)
@ -0,0 +1,33 @@
# restic_repository: "s3:s3.us-east-1.amazonaws.com/bucket_name"
# restic_repository_password:
restic_environment_vars:
Owner
Could we link to the relevant restic docs here? https://restic.readthedocs.io/en/stable/040_backup.html#environment-variables
saibotk marked this conversation as resolved
@ -0,0 +66,4 @@
- name: Reload systemd.
ansible.builtin.systemd:
daemon_reload: true
Owner

why not add this to the two tasks below?

why not add this to the two tasks below?
Author
Owner

Oh a bit micro optimization, didn't want to reload the daemon twice.
If you prefer, i can also put it back to both tasks

Oh a bit micro optimization, didn't want to reload the daemon twice. If you prefer, i can also put it back to both tasks
Owner

ah no that's fine, i was just wondering if there was a reason for it

ah no that's fine, i was just wondering if there was a reason for it
histalek marked this conversation as resolved
histalek approved these changes 2025-04-28 20:38:53 +02:00
saibotk deleted branch restic 2025-05-12 00:44:34 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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: SipsOfCode/infrastructure#133
No description provided.