Use sql dump service instead

This commit is contained in:
Nathan McCarty 2022-06-10 19:47:47 -04:00
parent 416410579a
commit 20022f9a6d
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
1 changed files with 8 additions and 26 deletions

View File

@ -80,7 +80,7 @@
}; };
environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg-sshKey".path}"; environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg-sshKey".path}";
compression = "auto,zstd"; compression = "auto,zstd";
startAt = "hourly"; startAt = "OnCalendar=00/4:00";
prune.keep = { prune.keep = {
within = "7d"; # Keep all archives for the past week within = "7d"; # Keep all archives for the past week
daily = 1; # Keep 1 snapshot a day for 2 weeks daily = 1; # Keep 1 snapshot a day for 2 weeks
@ -88,31 +88,13 @@
monthly = -1; # Keep unlimited monthly backups monthly = -1; # Keep unlimited monthly backups
}; };
}; };
postgres =
let dumper = pkgs.writeScript "pg-dumper"
''
#!/usr/bin/env bash
su -c postgres pg_dumpall
'';
in
{
dumpCommand = dumper;
repo = "de1955@de1955.rsync.net:databases/oracles/postgres";
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${config.sops.secrets."borg-oraclesPassword".path}";
};
environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg-sshKey".path}";
compression = "auto,zstd";
startAt = "hourly";
prune.keep = {
within = "7d"; # Keep all archives for the past week
daily = 1; # Keep 1 snapshot a day for 2 weeks
weekly = 4; # Keep 1 snapshot a week for 4 weeks
monthly = -1; # Keep unlimited monthly backups
};
}; };
# Backup postgres
services.postgresqlBackup = {
enable = true;
compression = "none";
backupAll = true;
startAt = "OnCalendar=00/2:00";
}; };
} }