backup nixos containers on vpsfree

This commit is contained in:
Cyryl Płotnicki 2023-12-23 13:46:39 +00:00
parent 0fa7c214e8
commit 31b448d615

View file

@ -4,7 +4,7 @@
...
}: let
genericBackupPath = "/var/lib/backups/";
containersBackupPath = "${genericBackupPath}/oci-containers/";
nixosContainersBackupPath = "/var/lib/nixos-containers/";
in rec {
environment.systemPackages = with pkgs; [restic];
@ -23,24 +23,28 @@ in rec {
"/var/lib/foundryvtt"
"/var/lib/gitea"
"/var/lib/mastodon"
"${containersBackupPath}"
"${nixosContainersBackupPath}"
];
repository = "b2:cyplo-restic-vpsfree";
backupPrepareCommand = ''
mkdir -p ${containersBackupPath}/
systemctl stop container@mastodon.service
${pkgs.podman}/bin/podman volume export woodpecker-server-data -o ${containersBackupPath}/woodpecker.tar
'';
backupCleanupCommand = ''
systemctl start container@mastodon.service
'';
timerConfig = {OnCalendar = "daily";};
environmentFile = "${config.sops.secrets.restic-backups-b2-environment.path}";
extraBackupArgs = [
"--exclude='cache'"
];
};
};
systemd.services.restic-backups-b2 = {
environment = {GOMAXPROCS = "1";};
environment = {
GOMAXPROCS = "1";
GOGC = "20";
};
serviceConfig = {
Nice = 19;
IOSchedulingClass = "idle";