aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

enableTCPIP option on postgresql service breaks build #84

Closed aleeusgr closed 1 month ago

aleeusgr commented 1 month ago

How to reproduce?

Add the following to configuration.nix and run nixos-rebuild switch

services.postgresql = {
+    enable = true;
+    ensureDatabases = [ "mydatabase" ];
+    enableTCPIP = true;
+    port = 5432;
+    authentication = pkgs.lib.mkOverride 10 ''
+      #...
+      #type database DBuser origin-address auth-method
+      # ipv4
+      host  all      all     127.0.0.1/32   trust
+      # ipv6
+      host all       all     ::1/128        trust
+    '';
+  };
Error

```powershell × postgresql.service - PostgreSQL Server 08:38:27 [2/14] Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; preset: enabled) Active: failed (Result: timeout) since Thu 2024-05-16 08:38:27 EEST; 58ms ago Process: 7951 ExecStartPre=/nix/store/vzy5msq7fnlkyd5c2r4k44w3z2p0b5rn-unit-script-postgresql-pre-start/bin/postgresql-pre-start (code=exited, status=0/SUCCESS) Process: 7967 ExecStart=/nix/store/ba07yiyk3x2m5l9rjpsxfhsyqxfkwgcg-postgresql-and-plugins-13.14/bin/postgres (code=exited, status=0/SUCCESS) Process: 8018 ExecStartPost=/nix/store/0jk0nbazandrgkxgxzhvxyh09z07ccbz-unit-script-postgresql-post-start/bin/postgresql-post-start (code=exited, status=1/FAILURE) Main PID: 7967 (code=exited, status=0/SUCCESS) IP: 4.6K in, 4.6K out CPU: 12.542s May 16 08:38:26 nixos postgres[7967]: [7967] LOG: aborting any active transactions May 16 08:38:26 nixos postgres[7967]: [7967] LOG: background worker "logical replication launcher" (PID 8015) exited w ith exit code 1 May 16 08:38:26 nixos postgres[8009]: [8009] LOG: shutting down May 16 08:38:26 nixos postgres[11347]: [11347] FATAL: the database system is shutting down May 16 08:38:26 nixos postgres[7967]: [7967] LOG: database system is shut down May 16 08:38:27 nixos postgresql-post-start[8018]: /nix/store/0jk0nbazandrgkxgxzhvxyh09z07ccbz-unit-script-postgresql-p ost-start/bin/postgresql-post-start: line 6: kill: (7967) - No such process May 16 08:38:27 nixos systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE May 16 08:38:27 nixos systemd[1]: postgresql.service: Failed with result 'timeout'. May 16 08:38:27 nixos systemd[1]: Failed to start PostgreSQL Server. May 16 08:38:27 nixos systemd[1]: postgresql.service: Consumed 12.542s CPU time, received 4.6K IP traffic, sent 4.6K IP traffic. warning: error(s) occurred while switching to the new configuration ```

aleeusgr commented 1 month ago

solved:

line 7 missing data