add restic backups to s3 for immich

This commit is contained in:
Noah Masur 2024-12-12 15:11:35 +00:00
parent 66ef1fa38d
commit b691895e05
No known key found for this signature in database
5 changed files with 69 additions and 0 deletions

View File

@ -247,6 +247,7 @@
mail.imapHost = "imap.purelymail.com"; mail.imapHost = "imap.purelymail.com";
mail.smtpHost = "smtp.purelymail.com"; mail.smtpHost = "smtp.purelymail.com";
dotfilesRepo = "https://github.com/nmasur/dotfiles"; dotfilesRepo = "https://github.com/nmasur/dotfiles";
backup.s3.glacierBucket = "noahmasur-archive";
hostnames = { hostnames = {
audiobooks = "read.${baseName}"; audiobooks = "read.${baseName}";
files = "files.${baseName}"; files = "files.${baseName}";

View File

@ -22,6 +22,11 @@
description = "S3 access key ID for backups"; description = "S3 access key ID for backups";
default = null; default = null;
}; };
glacierBucket = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "S3 bucket for glacier backups";
default = null;
};
}; };
}; };
@ -69,5 +74,30 @@
# timerConfig = { OnCalendar = "00:05:00"; }; # timerConfig = { OnCalendar = "00:05:00"; };
# environmentFile = backup.s3File; # environmentFile = backup.s3File;
# }; # };
secrets.s3-glacier = {
source = ../../../private/s3-glacier.age;
dest = "${config.secretsDirectory}/s3-glacier";
};
secrets.restic = {
source = ../../../private/restic.age;
dest = "${config.secretsDirectory}/restic";
};
services.restic.backups = {
default = {
repository = "s3:s3.us-east-1.amazonaws.com/${config.backup.s3.glacierBucket}/restic";
paths = [ "/data/images" ];
environmentFile = config.secrets.s3-glacier.dest;
passwordFile = config.secrets.restic.dest;
pruneOpts = [
"--keep-daily 14"
"--keep-weekly 6"
"--keep-monthly 12"
"--keep-yearly 100"
];
};
};
}; };
} }

View File

@ -40,6 +40,9 @@
# Point localhost to the local domain # Point localhost to the local domain
networking.hosts."127.0.0.1" = [ config.hostnames.photos ]; networking.hosts."127.0.0.1" = [ config.hostnames.photos ];
# Backups
services.restic.backups.default.paths = [ "/data/images" ];
}; };
} }

17
private/restic.age Normal file
View File

@ -0,0 +1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