@@ -353,47 +353,39 @@ def gzip_then_base64_encode(s: str) -> str:
353353
354354 def is_healthy (ssh ) -> bool :
355355 health_checks = [
356- (
357- "postgres" ,
358- "sudo -u postgres /usr/bin/pg_isready -U postgres" ,
359- "journalctl -b -u postgres -n 10 -r --no-pager" ,
360- ),
356+ ("postgres" , "sudo -u postgres /usr/bin/pg_isready -U postgres" ),
361357 (
362358 "adminapi" ,
363359 f"curl -sf -k --connect-timeout 30 --max-time 60 https://localhost:8085/health -H 'apikey: { supabase_admin_key } '" ,
364- "journalctl -b -u adminapi -n 10 -r --no-pager" ,
365360 ),
366361 (
367362 "postgrest" ,
368363 "curl -sf --connect-timeout 30 --max-time 60 http://localhost:3001/ready" ,
369- "journalctl -b -u postgrest -n 10 -r --no-pager" ,
370364 ),
371365 (
372366 "gotrue" ,
373367 "curl -sf --connect-timeout 30 --max-time 60 http://localhost:8081/health" ,
374- "journalctl -b -u gotrue -n 10 -r --no-pager" ,
375368 ),
376- ("kong" , "sudo kong health" , "" ),
377- ("fail2ban" , "sudo fail2ban-client status" , "" ),
369+ ("kong" , "sudo kong health" ),
370+ ("fail2ban" , "sudo fail2ban-client status" ),
378371 ]
379372
380- for service , command , info_command in health_checks :
373+ for service , command in health_checks :
381374 try :
382375 result = run_ssh_command (ssh , command )
383- if result ["succeeded" ]:
384- continue
385-
386- info_text = ""
387- if info_command is not "" :
376+ if not result ["succeeded" ]:
377+ info_text = ""
378+ info_command = f"sudo journalctl -b -u { service } -n 10 -r --no-pager"
388379 info_result = run_ssh_command (ssh , info_command )
389380 if info_result ["succeeded" ]:
390381 info_text = info_result ["stdout" ].strip ()
391- logger .warning (f"{ service } not ready{ info_text } " )
392- return False
382+
383+ logger .warning (f"{ service } not ready{ info_text } " )
384+ return False
385+
393386 except Exception :
394387 logger .warning (f"Connection failed during { service } check" )
395388 return False
396-
397389 return True
398390
399391 while True :
0 commit comments