0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-16 23:20:56 +03:00

nixos/postgresql: move postStart into separate unit

This avoids restarting the postgresql server, when only ensureDatabases
or ensureUsers have been changed. It will also allow to properly wait
for recovery to finish later.

To wait for "postgresql is ready" in other services, we now provide a
postgresql.target.

Resolves #400018

Co-authored-by: Marcel <me@m4rc3l.de>
This commit is contained in:
Wolfgang Walther 2025-05-02 14:58:46 +02:00
parent c119848700
commit 41c5662cbe
No known key found for this signature in database
GPG key ID: B39893FA5F65CAE1
139 changed files with 391 additions and 424 deletions

View file

@ -62,7 +62,7 @@ let
testScript = ''
# make an initial base backup
machine.wait_for_unit("postgresql")
machine.wait_for_unit("postgresql.target")
machine.wait_for_unit("postgresql-wal-receiver-main")
# WAL receiver healthchecks PG every 5 seconds, so let's be sure they have connected each other
# required only for 9.4
@ -99,7 +99,7 @@ let
machine.systemctl("start postgresql")
machine.wait_for_file("${postgresqlDataDir}/recovery.done")
machine.systemctl("restart postgresql")
machine.wait_for_unit("postgresql")
machine.wait_for_unit("postgresql.target")
# check that our records have been restored
machine.succeed(