lib: Make awaitPostgres code early in preStart
This commit is contained in:
		@@ -4,7 +4,8 @@ let
 | 
				
			|||||||
  inherit (lib)
 | 
					  inherit (lib)
 | 
				
			||||||
    genAttrs mapAttrsToList filterAttrsRecursive nameValuePair types
 | 
					    genAttrs mapAttrsToList filterAttrsRecursive nameValuePair types
 | 
				
			||||||
    mkOption mkOverride mkForce mkIf mergeEqualOption optional
 | 
					    mkOption mkOverride mkForce mkIf mergeEqualOption optional
 | 
				
			||||||
    showWarnings concatStringsSep flatten unique optionalAttrs;
 | 
					    showWarnings concatStringsSep flatten unique optionalAttrs
 | 
				
			||||||
 | 
					    mkBefore;
 | 
				
			||||||
  inherit (lib.flake) defaultSystems;
 | 
					  inherit (lib.flake) defaultSystems;
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
rec {
 | 
					rec {
 | 
				
			||||||
@@ -166,7 +167,7 @@ rec {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  systemdAwaitPostgres = pkg: host: {
 | 
					  systemdAwaitPostgres = pkg: host: {
 | 
				
			||||||
    after = [ "systemd-networkd-wait-online.service" ];
 | 
					    after = [ "systemd-networkd-wait-online.service" ];
 | 
				
			||||||
    preStart = ''
 | 
					    preStart = mkBefore ''
 | 
				
			||||||
      until ${pkg}/bin/pg_isready -h ${host}; do
 | 
					      until ${pkg}/bin/pg_isready -h ${host}; do
 | 
				
			||||||
        sleep 0.5
 | 
					        sleep 0.5
 | 
				
			||||||
      done
 | 
					      done
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user