borg: prune + more frequent copies

This commit is contained in:
Motiejus Jakštys 2023-01-26 10:57:45 -08:00
parent 4fb7ed8d2a
commit c99480b357

View File

@ -34,13 +34,16 @@ let
"/var/lib/.snapshot-latest/gitea" "/var/lib/.snapshot-latest/gitea"
"/var/lib/.snapshot-latest/headscale" "/var/lib/.snapshot-latest/headscale"
]; ];
backup_at = "*-*-* 00:05:00"; backup_at = "*-*-* *:01:00";
}; };
var_log = { var_log = {
mountpoint = "/var/log"; mountpoint = "/var/log";
zfs_name = "rpool/nixos/var/log"; zfs_name = "rpool/nixos/var/log";
paths = [ "/var/log/.snapshot-latest/" ]; paths = [ "/var/log/.snapshot-latest/" ];
patterns = [ "+ caddy/access-beta.jakstys.lt.log-*.zst" ]; patterns = [
"+ caddy/access-beta.jakstys.lt.log-*.zst"
"- *"
];
backup_at = "*-*-* 00:10:00"; backup_at = "*-*-* 00:10:00";
}; };
}; };
@ -164,7 +167,7 @@ in {
name = name; name = name;
value = { value = {
doInit = true; doInit = true;
repo = "zh2769@zh2769.rsync.net:hel1-a.servers.jakst"; repo = "zh2769@zh2769.rsync.net:borg";
encryption = { encryption = {
mode = "repokey-blake2"; mode = "repokey-blake2";
passCommand = "cat /var/src/secrets/borgbackup/password"; passCommand = "cat /var/src/secrets/borgbackup/password";
@ -172,10 +175,16 @@ in {
paths = value.paths; paths = value.paths;
extraArgs = "--remote-path=borg1"; extraArgs = "--remote-path=borg1";
compression = "auto,lzma"; compression = "auto,lzma";
startAt = "*-*-* 00:05:00"; startAt = value.backup_at;
readWritePaths = [ rwpath ]; readWritePaths = [ rwpath ];
preHook = mountLatest snapshot; preHook = mountLatest snapshot;
postHook = umountLatest snapshot; postHook = umountLatest snapshot;
prune.keep = {
within = "1d";
daily = 7;
weekly = 4;
monthly = 3;
};
} // lib.optionalAttrs (value ? patterns) { } // lib.optionalAttrs (value ? patterns) {
patterns = value.patterns; patterns = value.patterns;
}; };