@@ -364,13 +364,7 @@ def is_healthy(ssh) -> bool:
364364 # Then check if the socket directory exists and has correct permissions
365365 h .run ("sudo ls -la /run/postgresql" ),
366366 # Then try pg_isready
367- h .run ("sudo -u postgres /usr/bin/pg_isready -U postgres" ),
368- # Check Nix profile setup
369- h .run ("echo 'Check Nix profile setup'" ),
370- h .run ("sudo -u postgres ls -la /home/postgres/.nix-profile" ),
371- h .run ("sudo -u postgres ls -la /home/postgres/.nix-profile/bin" ),
372- h .run ("sudo -u postgres test -x /home/postgres/.nix-profile/bin/switch_pg_cron_version" ),
373- h .run ("sudo -u postgres cat /home/postgres/.nix-profile/bin/switch_pg_cron_version" )
367+ h .run ("sudo -u postgres /usr/bin/pg_isready -U postgres" )
374368 ),
375369 ),
376370 (
@@ -411,6 +405,20 @@ def is_healthy(ssh) -> bool:
411405 systemd_status , socket_check , pg_isready = check (host )
412406>> >> >> > 2 bd7b6d9 (test : more logging for healthcheck )
413407
408+ # Log Nix profile setup checks
409+ logger .info ("Checking Nix profile setup:" )
410+ nix_profile_result = host .run ("sudo -u postgres ls -la /home/postgres/.nix-profile" )
411+ logger .info (f"Nix profile directory:\n { nix_profile_result .stdout } \n { nix_profile_result .stderr } " )
412+
413+ nix_bin_result = host .run ("sudo -u postgres ls -la /home/postgres/.nix-profile/bin" )
414+ logger .info (f"Nix profile bin directory:\n { nix_bin_result .stdout } \n { nix_bin_result .stderr } " )
415+
416+ nix_script_result = host .run ("sudo -u postgres test -x /home/postgres/.nix-profile/bin/switch_pg_cron_version" )
417+ logger .info (f"Switch script executable check: { 'success' if not nix_script_result .failed else 'failed' } " )
418+
419+ nix_script_output = host .run ("sudo -u postgres /home/postgres/.nix-profile/bin/switch_pg_cron_version" )
420+ logger .info (f"Switch script output:\n { nix_script_output .stdout } \n { nix_script_output .stderr } " )
421+
414422 if systemd_status .failed :
415423 logger .error ("PostgreSQL systemd service is not active" )
416424 logger .error (f"systemd status: { systemd_status .stdout } " )
0 commit comments