forked from DGNum/infrastructure
feat(dgn-backups): Setup postgres databases backups
This commit is contained in:
parent
6ee3431cc1
commit
6161592f5a
3 changed files with 18 additions and 6 deletions
|
@ -73,4 +73,5 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
dgn-backups.jobs.vaultwarden.settings.paths = [ "/var/lib/bitwarden_rs" ];
|
dgn-backups.jobs.vaultwarden.settings.paths = [ "/var/lib/bitwarden_rs" ];
|
||||||
|
dgn-backups.postgresDatabases = [ "vaultwarden" ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,15 +41,13 @@ let
|
||||||
}
|
}
|
||||||
// settings
|
// settings
|
||||||
);
|
);
|
||||||
|
|
||||||
mkPgJobs = lib.extra.mapFuse (db: { "pg-${db}" = { }; });
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options.dgn-backups = {
|
options.dgn-backups = {
|
||||||
enable = mkEnableOption "DGNum backup service.";
|
enable = mkEnableOption "DGNum backup service.";
|
||||||
|
|
||||||
pgDumps = mkOption {
|
postgresDatabases = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -86,6 +84,19 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
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 = {
|
services.bupstash = {
|
||||||
repositories = {
|
repositories = {
|
||||||
inherit (cfg) enable;
|
inherit (cfg) enable;
|
||||||
|
@ -109,7 +120,7 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
jobs = (mkPgJobs cfg.pgDumps) // (mkJobs cfg.jobs);
|
jobs = mkJobs cfg.jobs;
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.ssh.knownHosts =
|
programs.ssh.knownHosts =
|
||||||
|
|
|
@ -95,9 +95,9 @@
|
||||||
"url": "https://git.hubrecht.ovh/hubrecht/nix-modules.git"
|
"url": "https://git.hubrecht.ovh/hubrecht/nix-modules.git"
|
||||||
},
|
},
|
||||||
"branch": "main",
|
"branch": "main",
|
||||||
"revision": "0e6d7e13b50a37d2f5e95ff06529292357a11c9d",
|
"revision": "654a8a5cd185860aa2c77fc97e3630cb75fedeae",
|
||||||
"url": null,
|
"url": null,
|
||||||
"hash": "1366l4qhf1drzr0ccvbdf3w4aa8jwq1pw9909r7wgrpjmqfgm16p"
|
"hash": "0h0kxs2fg4413yj2fh5l6319vwq1xmfkqd8q179014qvc9fimrvx"
|
||||||
},
|
},
|
||||||
"nix-patches": {
|
"nix-patches": {
|
||||||
"type": "GitRelease",
|
"type": "GitRelease",
|
||||||
|
|
Loading…
Reference in a new issue