added healthcheck and backupInterval to podman-postgresql
This commit is contained in:
parent
8c67608e95
commit
55107444ab
1 changed files with 12 additions and 2 deletions
|
|
@ -54,6 +54,13 @@ in
|
|||
default = "/var/backup/postgresql";
|
||||
};
|
||||
|
||||
backupInterval = mkOption {
|
||||
description = "The interval to backup the database";
|
||||
type = types.str;
|
||||
default = "hourly";
|
||||
example = "daily";
|
||||
};
|
||||
|
||||
};
|
||||
}));
|
||||
};
|
||||
|
|
@ -74,7 +81,10 @@ in
|
|||
"/var/lib/postgresql/${cfg.database}:/var/lib/postgresql/data"
|
||||
"${cfg.passwordFile}:${cfg.passwordFile}"
|
||||
];
|
||||
extraOptions = conf.podman.extraOptions;
|
||||
extraOptions = conf.podman.extraOptions ++ [
|
||||
"--health-cmd=pg_isready -d ${cfg.database} -U ${cfg.user}"
|
||||
"--health-start-period=10s"
|
||||
];
|
||||
};
|
||||
}) cfgs);
|
||||
|
||||
|
|
@ -96,7 +106,7 @@ in
|
|||
};
|
||||
timers."podman-postgresql-${cfg.database}-backup" = {
|
||||
timerConfig = {
|
||||
OnCalendar = "hourly";
|
||||
OnCalendar = cfg.backupInterval;
|
||||
};
|
||||
wantedBy = [ "podman-postgresql-${cfg.database}.service" ];
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue