feat(dgn-backups): Setup postgres databases backups
All checks were successful
build configuration / build_vault01 (push) Successful in 1m0s
build configuration / build_web02 (push) Successful in 1m0s
build configuration / build_storage01 (push) Successful in 1m4s
build configuration / build_compute01 (push) Successful in 1m15s
lint / check (push) Successful in 21s
build configuration / build_web01 (push) Successful in 1m24s
build configuration / build_rescue01 (push) Successful in 48s

This commit is contained in:
Tom Hubrecht 2024-02-21 22:01:32 +01:00
parent 6ee3431cc1
commit 6161592f5a
3 changed files with 18 additions and 6 deletions

View file

@ -73,4 +73,5 @@ in
};
dgn-backups.jobs.vaultwarden.settings.paths = [ "/var/lib/bitwarden_rs" ];
dgn-backups.postgresDatabases = [ "vaultwarden" ];
}

View file

@ -41,15 +41,13 @@ let
}
// settings
);
mkPgJobs = lib.extra.mapFuse (db: { "pg-${db}" = { }; });
in
{
options.dgn-backups = {
enable = mkEnableOption "DGNum backup service.";
pgDumps = mkOption {
postgresDatabases = mkOption {
type = listOf str;
default = [ ];
description = ''
@ -86,6 +84,19 @@ in
};
config = {
dgn-backups.jobs =
lib.extra.mapFuse
(db: {
"${db}-db".settings = {
user = "postgres";
command = [
"${lib.getExe' config.services.postgresql.package "pg_dump"}"
db
];
};
})
cfg.postgresDatabases;
services.bupstash = {
repositories = {
inherit (cfg) enable;
@ -109,7 +120,7 @@ in
];
};
jobs = (mkPgJobs cfg.pgDumps) // (mkJobs cfg.jobs);
jobs = mkJobs cfg.jobs;
};
programs.ssh.knownHosts =

View file

@ -95,9 +95,9 @@
"url": "https://git.hubrecht.ovh/hubrecht/nix-modules.git"
},
"branch": "main",
"revision": "0e6d7e13b50a37d2f5e95ff06529292357a11c9d",
"revision": "654a8a5cd185860aa2c77fc97e3630cb75fedeae",
"url": null,
"hash": "1366l4qhf1drzr0ccvbdf3w4aa8jwq1pw9909r7wgrpjmqfgm16p"
"hash": "0h0kxs2fg4413yj2fh5l6319vwq1xmfkqd8q179014qvc9fimrvx"
},
"nix-patches": {
"type": "GitRelease",