feat(django-apps): Add automatic backup
Some checks failed
Check meta / check_dns (pull_request) Successful in 19s
Check meta / check_meta (pull_request) Successful in 25s
Check workflows / check_workflows (pull_request) Successful in 25s
Run pre-commit on all files / pre-commit (push) Successful in 42s
Build all the nodes / ap01 (pull_request) Successful in 1m10s
Build all the nodes / bridge01 (pull_request) Successful in 1m49s
Build all the nodes / geo02 (pull_request) Successful in 2m0s
Build all the nodes / hypervisor01 (pull_request) Successful in 1m57s
Build all the nodes / geo01 (pull_request) Successful in 2m8s
Build all the nodes / hypervisor02 (pull_request) Successful in 1m48s
Build all the nodes / netcore02 (pull_request) Successful in 33s
Build all the nodes / compute01 (pull_request) Successful in 2m49s
Build all the nodes / hypervisor03 (pull_request) Successful in 1m34s
Build all the nodes / rescue01 (pull_request) Successful in 2m11s
Build all the nodes / storage01 (pull_request) Successful in 2m15s
Build all the nodes / web02 (pull_request) Successful in 1m50s
Build all the nodes / vault01 (pull_request) Successful in 2m5s
Build all the nodes / web03 (pull_request) Failing after 1m40s
Run pre-commit on all files / pre-commit (pull_request) Successful in 34s
Build all the nodes / web01 (pull_request) Successful in 2m54s

This commit is contained in:
Tom Hubrecht 2024-12-20 23:26:28 +01:00
parent 3085d9e3a8
commit b6272ce2ec
Signed by: thubrecht
SSH key fingerprint: SHA256:r+nK/SIcWlJ0zFZJGHtlAoRwq1Rm+WcKAm5ADYMoQPc
2 changed files with 18 additions and 2 deletions

View file

@ -11,7 +11,12 @@
}:
let
inherit (lib) mkEnableOption mkOption remove;
inherit (lib)
getExe'
mkEnableOption
mkOption
remove
;
inherit (lib.types)
attrs
@ -93,7 +98,7 @@ in
"${db}-db".settings = {
user = "postgres";
command = [
"${lib.getExe' config.services.postgresql.package "pg_dump"}"
(getExe' config.services.postgresql.package "pg_dump")
db
];
};
@ -113,6 +118,8 @@ in
"storage01"
"vault01"
"web01"
"web02"
"web03"
];
allowed = [ "put" ];
}

View file

@ -732,5 +732,14 @@ in
) config.extraServices)
) cfg.sites);
};
dgn-backups = {
jobs = mapAttrs' (
name: _: nameValuePair "dj-${name}" { settings.paths = [ "/var/lib/django-apps/${name}" ]; }
) cfg.sites;
postgresDatabases = builtins.map (name: "dj-${name}") (
attrNames (filterAttrs (_: { dbType, ... }: dbType == "postgresql") cfg.sites)
);
};
};
}