Setup backup for storage1

This commit is contained in:
Paul-Henri Froidmont 2021-12-27 04:03:07 +01:00
parent f56c03dcdc
commit 8d31683aa0
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
3 changed files with 21 additions and 3 deletions

View file

@ -10,8 +10,16 @@
../modules/stb.nix
../modules/monero.nix
../modules/torrents.nix
../modules/custom-backup-job.nix
];
sops.secrets = {
borgSshKey = {
owner = config.services.borgbackup.jobs.data.user;
key = "borg/client_keys/storage1/private";
};
};
networking.firewall.allowedTCPPorts = [ 80 443 18080 ];
networking.nat.enable = true;
@ -33,4 +41,11 @@
group = config.users.groups.steam.name;
};
users.groups.steam = { };
services.custom-backup-job = {
readWritePaths = [ "/nix/var/data/backup" ];
preHook = "${pkgs.docker}/bin/docker exec stb-mariadb sh -c 'mysqldump -u stb -pstb stb' > /nix/var/data/backup/stb_mariadb.sql";
startAt = "04:00";
sshKey = config.sops.secrets.borgSshKey.path;
};
}