ninurta: Make backups

This commit is contained in:
Tim Schubert 2023-06-18 11:49:06 +02:00
parent b18260a8a6
commit 7945f2ef0c
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA

View file

@ -77,6 +77,47 @@ in
path = "/mnt/storage/backups"; path = "/mnt/storage/backups";
}; };
services.borgbackup.jobs."backup1.bs.dadada.li" = {
removableDevice = true;
paths = [
"/var/backup"
"/var/lib"
"/var/www"
"/home"
];
exclude = [
"/home/*/.cache"
"/var/lib/machines"
];
repo = "/mnt/storage/backups/${config.networking.hostName}";
doInit = true;
encryption = {
mode = "repokey";
passCommand = "cat ${config.age.secrets.ninurta-backup-passphrase.path}";
};
compression = "auto,lz4";
prune.keep = {
within = "1d"; # Keep all archives from the last day
daily = 7;
weekly = 2;
monthly = -1; # Keep at least one archive for each month
yearly = -1; # Keep at least one archive for each year
};
startAt = "daily";
};
services.postgresqlBackup = {
enable = true;
backupAll = true;
compression = "zstd";
location = "/var/backup/postgresql";
};
age.secrets."ninurta-backup-passphrase" = {
file = "${secretsPath}/ninurta-backup-passphrase.age";
mode = "400";
};
age.secrets.${hydraGitHubAuth} = { age.secrets.${hydraGitHubAuth} = {
file = "${secretsPath}/${hydraGitHubAuth}.age"; file = "${secretsPath}/${hydraGitHubAuth}.age";
mode = "440"; mode = "440";