From 55ee59237938830e272d72639da4950da5aa9e83 Mon Sep 17 00:00:00 2001 From: southseact-3d Date: Fri, 13 Feb 2026 09:39:58 +0000 Subject: [PATCH] fix: make HTTP check authoritative in healthcheck for container compatibility Process detection fails in containers due to missing privileged tools (ss -p requires root, lsof often not installed). HTTP health endpoint is the reliable indicator of service health, so port/process checks are now informational only. --- scripts/healthcheck.sh | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/healthcheck.sh b/scripts/healthcheck.sh index 05b9f6d..69ee80c 100644 --- a/scripts/healthcheck.sh +++ b/scripts/healthcheck.sh @@ -56,7 +56,7 @@ check_port() { fi else health_log "WARN" "Neither ss nor netstat available for port checking" - return 1 + return 0 fi } @@ -108,11 +108,10 @@ check_process() { local cpu_time=$(awk '/utime|stime/ {sum+=$2} END {printf "%.2f seconds", sum/100}' "/proc/${pid}/status") health_log "INFO" " CPU time: ${cpu_time}" fi - return 0 else - health_log "ERROR" "✗ ${service} process NOT found" - return 1 + health_log "WARN" "⚠ ${service} process NOT found (may require privileges)" fi + return 0 } # System resource check @@ -160,17 +159,13 @@ main() { # Check chat service (port 4500) health_log "INFO" "=== Chat Service (port 4500) ===" - if ! check_port 4500 "chat service"; then - exit_code=1 - fi + check_port 4500 "chat service" if ! check_http "http://localhost:4500/api/health" "chat service" 3; then exit_code=1 fi - if ! check_process "chat service" 4500; then - exit_code=1 - fi + check_process "chat service" 4500 health_log "INFO" "========== HEALTH CHECK END ==========="