38 lines
1.1 KiB
Bash
38 lines
1.1 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
# Healthcheck for ai-cluster on SOLARIA.
|
||
|
|
#
|
||
|
|
# openclaw publishes on the Tailscale IP only (no loopback bind), so this probes
|
||
|
|
# 100.100.231.104 rather than localhost. Run on the owning node.
|
||
|
|
|
||
|
|
set -u
|
||
|
|
|
||
|
|
OPENCLAW_URL="${OPENCLAW_URL:-http://100.100.231.104:8000/health}"
|
||
|
|
MQTT_BIND="${MQTT_BIND:-100.100.231.104}"
|
||
|
|
|
||
|
|
fail=0
|
||
|
|
|
||
|
|
for c in ai-cluster-openclaw-1 ai-cluster-codex-worker-1 ai-cluster-planner-worker-1 \
|
||
|
|
ai-cluster-service-ops-worker-1 ai-cluster-redis-1 mosquitto; do
|
||
|
|
if ! docker ps --filter "name=^${c}$" --filter "status=running" --format '{{.Names}}' | grep -q .; then
|
||
|
|
echo "[FAIL] container ${c} is not running"
|
||
|
|
fail=1
|
||
|
|
fi
|
||
|
|
done
|
||
|
|
|
||
|
|
if ! curl -sf --max-time 5 "$OPENCLAW_URL" > /dev/null; then
|
||
|
|
echo "[FAIL] openclaw health endpoint not responding at ${OPENCLAW_URL}"
|
||
|
|
fail=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if ! timeout 5 bash -c "echo > /dev/tcp/${MQTT_BIND}/1883" 2>/dev/null; then
|
||
|
|
echo "[FAIL] mosquitto not accepting connections on ${MQTT_BIND}:1883"
|
||
|
|
fail=1
|
||
|
|
fi
|
||
|
|
|
||
|
|
if [ "$fail" -ne 0 ]; then
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo "[OK] ai-cluster is healthy"
|
||
|
|
exit 0
|