Backup media volumes

This commit is contained in:
Pim Kunis 2025-05-25 18:07:25 +02:00
parent 49f5ee7166
commit 3f86fa7d7d
4 changed files with 48 additions and 7 deletions

View file

@ -6,9 +6,6 @@
}: let
borgBackupOpts = {
options = {
repo = lib.mkOption {
type = lib.types.str;
};
paths = lib.mkOption {
type = with lib.types; listOf str;
};
@ -35,12 +32,14 @@ in {
# TODO: should have some timeout and alerting?
config = {
services.borgbackup.jobs =
lib.mapAttrs (_name: c: {
inherit (c) repo paths;
lib.mapAttrs (name: c: {
inherit (c) paths;
repo = "ssh://w553a7cb@w553a7cb.repo.borgbase.com/./repo";
startAt = "*-*-* 00:00:00";
# TODO: low benefit, but we could set borgbase's host keys here as they are published online.
environment.BORG_RSH = "ssh -i ${config.sops.secrets."borg/borgbasePrivateKey".path} -o StrictHostKeychecking=no";
postHook = "${pkgs.k3s}/bin/kubectl scale deployment -n ${c.deploymentNamespace} ${c.deploymentName} --replicas=${toString c.replicaCount}";
archiveBaseName = name;
prune.keep = {
within = "7d";