diff --git a/modules/podman-postgresql.nix b/modules/podman-postgresql.nix index 0b6071c..590354e 100644 --- a/modules/podman-postgresql.nix +++ b/modules/podman-postgresql.nix @@ -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" ]; };