fix
This commit is contained in:
parent
896e2a2f6d
commit
c45f64a834
1 changed files with 20 additions and 18 deletions
40
flake.nix
40
flake.nix
|
@ -244,14 +244,15 @@
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# default = { };
|
||||||
|
};
|
||||||
|
# default = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
# default = { };
|
||||||
default = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# default = { };
|
||||||
default = { };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
users = lib.options.mkOption {
|
users = lib.options.mkOption {
|
||||||
|
@ -482,6 +483,7 @@
|
||||||
# }
|
# }
|
||||||
# ''
|
# ''
|
||||||
# );
|
# );
|
||||||
|
curl = "${pkgs.curl}/bin/curl --silent --show-error --max-time 10 --retry 5";
|
||||||
in
|
in
|
||||||
lib.mkIf cfg.enable {
|
lib.mkIf cfg.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
|
@ -623,7 +625,7 @@
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
curl = "${pkgs.curl}/bin/curl --silent --show-error --max-time 10 --retry 5";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
description = "PostgreSQL Server";
|
description = "PostgreSQL Server";
|
||||||
|
@ -823,13 +825,13 @@
|
||||||
systemd.services.postgresql-backup-full = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
|
systemd.services.postgresql-backup-full = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
|
||||||
let
|
let
|
||||||
hcStart =
|
hcStart =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.fullBackupPingURL}/start"
|
"${curl} ${cfg.backup.healthcheck.fullBackupPingURL}/start"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
hcStop =
|
hcStop =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.fullBackupPingURL}"
|
"${curl} ${cfg.backup.healthcheck.fullBackupPingURL}"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
in
|
in
|
||||||
|
@ -853,7 +855,7 @@
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "postgres";
|
User = "postgres";
|
||||||
Group = "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")) (
|
systemd.services.postgresql-backup-diff = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
|
||||||
let
|
let
|
||||||
hcStart =
|
hcStart =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.differentialBackupPingURL}/start"
|
"${curl} ${cfg.backup.healthcheck.differentialBackupPingURL}/start"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
hcStop =
|
hcStop =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.differentialBackupPingURL}"
|
"${curl} ${cfg.backup.healthcheck.differentialBackupPingURL}"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
in
|
in
|
||||||
|
@ -917,13 +919,13 @@
|
||||||
systemd.services.postgresql-backup-incr = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
|
systemd.services.postgresql-backup-incr = lib.mkIf (cfg.backup.enable && (!cfg.replication.enable || cfg.replication.role == "primary")) (
|
||||||
let
|
let
|
||||||
hcStart =
|
hcStart =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.incrementalBackupPingURL}/start"
|
"${curl} ${cfg.backup.healthcheck.incrementalBackupPingURL}/start"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
hcStop =
|
hcStop =
|
||||||
if cfg.backup.healthchecks.enable then
|
if cfg.backup.healthcheck.enable then
|
||||||
"${curl} ${cfg.backup.healthchecks.incrementalBackupPingURL}"
|
"${curl} ${cfg.backup.healthcheck.incrementalBackupPingURL}"
|
||||||
else
|
else
|
||||||
"";
|
"";
|
||||||
in
|
in
|
||||||
|
@ -940,7 +942,7 @@
|
||||||
|
|
||||||
${pgbackrest}/bin/pgbackrest --type=incr --start-fast --stop-auto --delta backup
|
${pgbackrest}/bin/pgbackrest --type=incr --start-fast --stop-auto --delta backup
|
||||||
|
|
||||||
${hsStop}
|
${hcStop}
|
||||||
'';
|
'';
|
||||||
environment = pgbackrestEnvironment;
|
environment = pgbackrestEnvironment;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
|
Loading…
Reference in a new issue