check_health.sh 986 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. echo "Checking EMS Platform Health..."
  3. echo "--------------------------------"
  4. # Check Containers
  5. echo "[1] Checking Container Status:"
  6. docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" | grep ems_
  7. echo ""
  8. # Check Backend Health
  9. echo "[2] Checking Backend Health (Direct):"
  10. if docker exec ems_platform_app-server_1 wget -qO- http://localhost:8080/ping > /dev/null 2>&1; then
  11. echo "✅ Backend is UP"
  12. else
  13. echo "❌ Backend is DOWN or Unreachable"
  14. fi
  15. echo ""
  16. # Check Nginx Proxy
  17. echo "[3] Checking Frontend/Proxy:"
  18. if curl -s -I http://localhost/api/v1/info | grep "200 OK" > /dev/null; then
  19. echo "✅ Nginx Proxy to Backend is WORKING"
  20. else
  21. echo "❌ Nginx Proxy check FAILED"
  22. echo "Debug Info:"
  23. curl -I http://localhost/api/v1/info
  24. fi
  25. echo ""
  26. # Check Database Connectivity (via Logs)
  27. echo "[4] Recent Database Errors in Logs:"
  28. docker logs --tail 50 ems_platform_app-server_1 | grep -i "error\|fail\|refused"
  29. echo ""
  30. echo "Done."