From fe13f2bf3c6b5449e2808494921d0bc09d345000 Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Fri, 3 Nov 2023 10:13:08 +0100 Subject: [PATCH] add prune options to backup --- server/modules/backup.nix | 43 +++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/server/modules/backup.nix b/server/modules/backup.nix index 9fe0a76..fd11a4d 100644 --- a/server/modules/backup.nix +++ b/server/modules/backup.nix @@ -16,11 +16,12 @@ passwordFile = config.age.secrets.restic-pw.path; paths = [ "/home" - "/var/backup/postgresql" - "/mnt/250ssd/matrix-synapse/media_store/" - "/mnt/250ssd/nextcloud" - "/mnt/250ssd/paperless" + "/var/backup/postgresql" + "/mnt/250ssd/matrix-synapse/media_store/" + "/mnt/250ssd/nextcloud" + "/mnt/250ssd/paperless" ]; + pruneOpts = [ "--keep-daily 7" "--keep-weekly 10" "--keep-monthly 12" "--keep-yearly 75" ]; repository = "/mnt/2tb/restic"; }; localbackup-1tb = { @@ -28,36 +29,38 @@ passwordFile = config.age.secrets.restic-pw.path; paths = [ "/home" - "/var/backup/postgresql" - "/mnt/250ssd/matrix-synapse/media_store/" - "/mnt/250ssd/nextcloud" - "/mnt/250ssd/paperless" + "/var/backup/postgresql" + "/mnt/250ssd/matrix-synapse/media_store/" + "/mnt/250ssd/nextcloud" + "/mnt/250ssd/paperless" ]; - exclude = [ + exclude = [ "/home/*/.cache" ]; repository = "/mnt/1tb/restic"; - timerConfig = { - OnCalendar = "*-*-03,06,09,12,15,18,21,24,27,30 02:00:00"; - Persistent = true; - }; + pruneOpts = [ "--keep-daily 5" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; + timerConfig = { + OnCalendar = "*-*-03,06,09,12,15,18,21,24,27,30 02:00:00"; + Persistent = true; + }; }; remotebackup = { - exclude = [ + exclude = [ "/home/*/.cache" ]; initialize = true; passwordFile = config.age.secrets.restic-pw.path; - environmentFile = config.age.secrets.restic-s3.path; + environmentFile = config.age.secrets.restic-s3.path; paths = [ "/home" ]; - timerConfig = { - OnCalendar = "*-*-03,06,09,12,15,18,21,24,27,30 00:00:00"; - Persistent = true; - }; + pruneOpts = [ "--keep-daily 5" "--keep-weekly 5" "--keep-monthly 12" "--keep-yearly 75" ]; + timerConfig = { + OnCalendar = "*-*-03,06,09,12,15,18,21,24,27,30 00:00:00"; + Persistent = true; + }; repository = "s3:s3.us-west-002.backblazeb2.com/kop-bucket"; - }; + }; }; }; }