nixos/postgresql: set Restart=always for postgresql.service
...including a slightly more careful config around restarts, i.e. * We have intervals of 5 seconds between restarts instead of 100ms. * If we exceed 5 start attempts in 5*120s (with 120s being the timeout), start job gets rate-limited and thus aborted. Do note that there are at most 5 start attempts allowed in ~625s by default. If the startup fails very quickly, either wait until the rate-limit is over or reset the counter using `systemctl reset-failed postgresql.service`. * The interval of 625s (plus 5s of buffer) are automatically derived from RestartSec & TimeoutSec. Changing either will also affect StartLimitIntervalSec unless overridden with `mkForce`.
This commit is contained in:
@@ -101,6 +101,12 @@ let
|
||||
machine.fail(check_count("SELECT * FROM sth;", 4))
|
||||
machine.succeed(check_count("SELECT xpath('/test/text()', doc) FROM xmltest;", 1))
|
||||
|
||||
with subtest("killing postgres process should trigger an automatic restart"):
|
||||
machine.succeed("systemctl kill -s KILL postgresql")
|
||||
|
||||
machine.wait_until_succeeds("systemctl is-active postgresql.service")
|
||||
machine.wait_until_succeeds("systemctl is-active postgresql.target")
|
||||
|
||||
with subtest("Backup service works"):
|
||||
machine.succeed(
|
||||
"systemctl start ${backupService}.service",
|
||||
|
||||
Reference in New Issue
Block a user