cloudron-support: do not use nc

This commit is contained in:
Girish Ramakrishnan
2026-01-05 09:30:43 +01:00
parent 6b080455ff
commit 409f185f7e

View File

@@ -894,26 +894,23 @@ function check_services() {
local service_port=("3000" "3000" "3000" "3000" "2003" "3000")
for service in "${!services[@]}"; do
# Check if container is running
if [[ $(docker inspect ${services[$service]} --format={{.State.Status}}) != "running" ]]; then
fail "Service '${services[$service]}' container is not running!"
continue
fi
# Check if service is reachable with simple nc check
if ! nc -z -w5 ${service_ip[$service]} ${service_port[$service]} 2>/dev/null; then
# avoid nc since it is not part of the base install
if ! timeout 5 bash -c "</dev/tcp/${service_ip[$service]}/${service_port[$service]}" 2>/dev/null; then
fail "Service '${services[$service]}' is not reachable"
continue
fi
# Curl the healthcheck endpoint
if [[ ${services[$service]} != "graphite" ]]; then
if ! grep -q "true" <<< $(curl --fail -s "http://${service_ip[$service]}:${service_port[$service]}/healthcheck"); then
fail "Service '${services[$service]}' healthcheck failed"
continue
fi
else
# Graphite has a different healthcheck endpoint and needs to be checked differently
if ! grep -q "Graphite Dashboard" <<< "$(curl --fail -s http://${service_ip[$service]}:8000/graphite-web/dashboard)"; then
fail "Service '${services[$service]}' healthcheck failed"
continue