Unverified Commit 41c5662c authored by Wolfgang Walther's avatar Wolfgang Walther
Browse files

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: default avatarMarcel <me@m4rc3l.de>
parent c1198487
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -259,13 +259,13 @@ in
    wantedBy = [ "multi-user.target" ];
    after = [
      "network.target"
      "postgresql.service"
      "postgresql.target"
    ];
    # note that if you are connecting to a postgres instance on a different host
    # postgresql.service should not be included in the requires.
    # postgresql.target should not be included in the requires.
    requires = [
      "network-online.target"
      "postgresql.service"
      "postgresql.target"
    ];
    description = "my app";
    environment = {
+5 −13
Original line number Diff line number Diff line
@@ -1316,22 +1316,14 @@
  "module-services-postgres-initializing-extra-permissions": [
    "index.html#module-services-postgres-initializing-extra-permissions"
  ],
  "module-services-postgres-initializing-extra-permissions-superuser": [
    "index.html#module-services-postgres-initializing-extra-permissions-superuser"
  ],
  "module-services-postgres-initializing-extra-permissions-superuser-post-start": [
    "index.html#module-services-postgres-initializing-extra-permissions-superuser-post-start"
  ],
  "module-services-postgres-initializing-extra-permissions-superuser-oneshot": [
    "index.html#module-services-postgres-initializing-extra-permissions-superuser-oneshot"
  ],
  "module-services-postgres-initializing-extra-permissions-service-user": [
    "index.html#module-services-postgres-initializing-extra-permissions-superuser-post-start",
    "index.html#module-services-postgres-initializing-extra-permissions-superuser",
    "index.html#module-services-postgres-initializing-extra-permissions-service-user-pre-start",
    "index.html#module-services-postgres-initializing-extra-permissions-service-user"
  ],
  "module-services-postgres-initializing-extra-permissions-service-user-pre-start": [
    "index.html#module-services-postgres-initializing-extra-permissions-service-user-pre-start"
  ],
  "module-services-postgres-initializing-extra-permissions-service-user-oneshot": [
  "module-services-postgres-initializing-extra-permissions-superuser-oneshot": [
    "index.html#module-services-postgres-initializing-extra-permissions-superuser-oneshot",
    "index.html#module-services-postgres-initializing-extra-permissions-service-user-oneshot"
  ],
  "module-services-postgres-authentication": [
+2 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@

- The `yeahwm` package and `services.xserver.windowManager.yeahwm` module were removed due to the package being broken and unmaintained upstream.

- The `services.postgresql` module now sets up a systemd unit `postgresql.target`. Depending on `postgresql.target` guarantees that initial/ensure scripts were executed.

- The `services.siproxd` module has been removed as `siproxd` is unmaintained and broken with libosip 5.x.

- `services.dwm-status.extraConfig` was replaced by [RFC0042](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md)-compliant [](#opt-services.dwm-status.settings), which is used to generate the config file. `services.dwm-status.order` is now moved to [](#opt-services.dwm-status.settings.order), as it's a part of the config file.
+1 −1
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ in
      requires = [ "network.target" ];
      # we're adding this optionally so just in case there's any race it'll be caught
      # in case postgres doesn't start, pgadmin will just start normally
      wants = [ "postgresql.service" ];
      wants = [ "postgresql.target" ];

      path = [
        config.services.postgresql.package
+1 −1
Original line number Diff line number Diff line
@@ -720,7 +720,7 @@ in
    systemd.services.bacula-dir = mkIf dir_cfg.enable {
      after = [
        "network.target"
        "postgresql.service"
        "postgresql.target"
      ];
      description = "Bacula Director Daemon";
      wantedBy = [ "multi-user.target" ];
Loading