backup: start pg dump before restic backup

This commit is contained in:
Sandro - 2023-05-17 19:05:53 +02:00
parent 76ab7d3f0e
commit 5fd87acd57
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
1 changed files with 10 additions and 1 deletions

View File

@ -9,7 +9,7 @@
compression = "zstd"; compression = "zstd";
compressionLevel = 9; compressionLevel = 9;
pgdumpOptions = "--create --clean"; pgdumpOptions = "--create --clean";
startAt = "*-*-* 06:00:00"; startAt = "*-*-* 04:00:00";
}; };
restic.backups = restic.backups =
@ -24,6 +24,10 @@
"--keep-weekly 4" "--keep-weekly 4"
"--keep-monthly 12" "--keep-monthly 12"
]; ];
timerConfig = {
OnCalendar = "*-*-* 04:30:00";
RandomizedDelaySec = "5m";
};
}; };
in in
{ {
@ -35,6 +39,7 @@
}); });
}; };
}; };
sops.secrets = { sops.secrets = {
"restic/offsite/private" = { "restic/offsite/private" = {
mode = "400"; mode = "400";
@ -63,5 +68,9 @@
ln -fs {,/home}/root/.ssh/id_offsite-backup.pub ln -fs {,/home}/root/.ssh/id_offsite-backup.pub
ln -fs {,/home}/root/.ssh/config ln -fs {,/home}/root/.ssh/config
''; '';
systemd.timers = lib.mkIf config.services.postgresqlBackup.enable {
postgresqlBackup.timerConfig.RandomizedDelaySec = "5m";
};
}; };
} }