@@ -410,6 +410,10 @@ def is_healthy(ssh) -> bool:
410
410
logger .error (f"systemd status: { systemd_status .stdout } " )
411
411
logger .error (f"systemd error: { systemd_status .stderr } " )
412
412
413
+ # Get detailed systemd status
414
+ logger .error ("Detailed systemd status:" )
415
+ host .run ("sudo systemctl status postgresql -l --no-pager" )
416
+
413
417
# Check init script logs
414
418
logger .error ("Init script logs:" )
415
419
host .run ("sudo journalctl -u cloud-init --no-pager" )
@@ -422,6 +426,44 @@ def is_healthy(ssh) -> bool:
422
426
logger .error ("Init script status:" )
423
427
host .run ("ls -la /tmp/init.sh" )
424
428
host .run ("cat /tmp/init.sh" )
429
+
430
+ # Check PostgreSQL configuration
431
+ logger .error ("PostgreSQL configuration:" )
432
+ host .run ("sudo cat /etc/postgresql/*/main/postgresql.conf" )
433
+ host .run ("sudo cat /etc/postgresql/*/main/pg_hba.conf" )
434
+
435
+ # Check PostgreSQL data directory permissions
436
+ logger .error ("PostgreSQL data directory permissions:" )
437
+ host .run ("sudo ls -la /var/lib/postgresql/*/main/" )
438
+
439
+ # Check PostgreSQL startup logs
440
+ logger .error ("PostgreSQL startup logs:" )
441
+ host .run ("sudo cat /var/log/postgresql/postgresql-*.log" )
442
+
443
+ # Check systemd journal for PostgreSQL
444
+ logger .error ("Systemd journal for PostgreSQL:" )
445
+ host .run ("sudo journalctl -u postgresql -n 100 --no-pager" )
446
+
447
+ # Check for any PostgreSQL-related errors in system logs
448
+ logger .error ("System logs with PostgreSQL errors:" )
449
+ host .run ("sudo journalctl | grep -i postgres | tail -n 100" )
450
+
451
+ # Check for any disk space issues
452
+ logger .error ("Disk space information:" )
453
+ host .run ("df -h" )
454
+ host .run ("sudo du -sh /var/lib/postgresql/*" )
455
+
456
+ # Check for any memory issues
457
+ logger .error ("Memory information:" )
458
+ host .run ("free -h" )
459
+
460
+ # Check for any process conflicts
461
+ logger .error ("Running processes:" )
462
+ host .run ("ps aux | grep postgres" )
463
+
464
+ # Check for any port conflicts
465
+ logger .error ("Port usage:" )
466
+ host .run ("sudo netstat -tulpn | grep 5432" )
425
467
426
468
if socket_check .failed :
427
469
logger .error ("PostgreSQL socket directory check failed" )
0 commit comments