@@ -353,47 +353,39 @@ def gzip_then_base64_encode(s: str) -> str:
353
353
354
354
def is_healthy (ssh ) -> bool :
355
355
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" ),
361
357
(
362
358
"adminapi" ,
363
359
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" ,
365
360
),
366
361
(
367
362
"postgrest" ,
368
363
"curl -sf --connect-timeout 30 --max-time 60 http://localhost:3001/ready" ,
369
- "journalctl -b -u postgrest -n 10 -r --no-pager" ,
370
364
),
371
365
(
372
366
"gotrue" ,
373
367
"curl -sf --connect-timeout 30 --max-time 60 http://localhost:8081/health" ,
374
- "journalctl -b -u gotrue -n 10 -r --no-pager" ,
375
368
),
376
- ("kong" , "sudo kong health" , "" ),
377
- ("fail2ban" , "sudo fail2ban-client status" , "" ),
369
+ ("kong" , "sudo kong health" ),
370
+ ("fail2ban" , "sudo fail2ban-client status" ),
378
371
]
379
372
380
- for service , command , info_command in health_checks :
373
+ for service , command in health_checks :
381
374
try :
382
375
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"
388
379
info_result = run_ssh_command (ssh , info_command )
389
380
if info_result ["succeeded" ]:
390
381
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
+
393
386
except Exception :
394
387
logger .warning (f"Connection failed during { service } check" )
395
388
return False
396
-
397
389
return True
398
390
399
391
while True :
0 commit comments