This commit is contained in:
Jeffrey C. Ollie 2023-08-14 09:21:25 -05:00
parent 896e2a2f6d
commit c45f64a834
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -244,14 +244,15 @@
type = lib.types.str;
};
};
# default = { };
};
# default = { };
};
};
default = { };
# default = { };
};
default = { };
# default = { };
};
users = lib.options.mkOption {
@ -482,6 +483,7 @@
# }
# ''
# );
curl = "${pkgs.curl}/bin/curl --silent --show-error --max-time 10 --retry 5";
in
lib.mkIf cfg.enable {
assertions = [
@ -623,7 +625,7 @@
]
else
"";
curl = "${pkgs.curl}/bin/curl --silent --show-error --max-time 10 --retry 5";
in
{
description = "PostgreSQL Server";
@ -823,13 +825,13 @@
systemd.services.postgresql-backup-full = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
let
hcStart =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.fullBackupPingURL}/start"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.fullBackupPingURL}/start"
else
"";
hcStop =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.fullBackupPingURL}"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.fullBackupPingURL}"
else
"";
in
@ -853,7 +855,7 @@
Type = "oneshot";
User = "postgres";
Group = "postgres";
TimeoutSec = 3600;
TimeoutSec = "4h";
};
}
);
@ -870,13 +872,13 @@
systemd.services.postgresql-backup-diff = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
let
hcStart =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.differentialBackupPingURL}/start"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.differentialBackupPingURL}/start"
else
"";
hcStop =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.differentialBackupPingURL}"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.differentialBackupPingURL}"
else
"";
in
@ -917,13 +919,13 @@
systemd.services.postgresql-backup-incr = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
let
hcStart =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.incrementalBackupPingURL}/start"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.incrementalBackupPingURL}/start"
else
"";
hcStop =
if cfg.backup.healthchecks.enable then
"${curl} ${cfg.backup.healthchecks.incrementalBackupPingURL}"
if cfg.backup.healthcheck.enable then
"${curl} ${cfg.backup.healthcheck.incrementalBackupPingURL}"
else
"";
in
@ -940,7 +942,7 @@
${pgbackrest}/bin/pgbackrest --type=incr --start-fast --stop-auto --delta backup
${hsStop}
${hcStop}
'';
environment = pgbackrestEnvironment;
serviceConfig = {