Fix healthcheck for non-0.0.0.0. will pass as long as reachable.

This commit is contained in:
Adam Outler
2026-03-02 19:39:23 +00:00
parent 0b32a06178
commit 93df52f70c

View File

@@ -49,10 +49,11 @@ else
fi
# 5. Check port 20211 is open and contains "netalertx"
if curl -sf --max-time 10 "http://localhost:${PORT:-20211}" | grep -i "netalertx" > /dev/null; then
log_success "Port ${PORT:-20211} is responding and contains 'netalertx'"
[ "${LISTEN_ADDR}" == "0.0.0.0" ] && CHECK_ADDR="127.0.0.1" || CHECK_ADDR="${LISTEN_ADDR}";
if timeout 10 bash -c "</dev/tcp/${CHECK_ADDR}/${PORT:-20211}" 2>/dev/null; then
log_success "Port ${PORT:-20211} is responding"
else
log_error "Port ${PORT:-20211} is not responding or doesn't contain 'netalertx'"
log_error "Port ${PORT:-20211} is not responding"
fi
# NOTE: GRAPHQL_PORT might not be set and is initailized as a setting with a default value in the container. It can also be initialized via APP_CONF_OVERRIDE
@@ -71,4 +72,4 @@ else
echo "[HEALTHCHECK] ❌ One or more health checks failed"
fi
exit $EXIT_CODE
exit $EXIT_CODE