#!/bin/sh # Healthcheck for SDK Signer # Prefer checking the HTTP endpoint first; fall back to log-based progress hints # 1) If HTTP endpoint responds with an acceptable status, we're healthy HTTP_CODE=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:9090/ 2>/dev/null || echo "000") if [ "$HTTP_CODE" = "200" ] || [ "$HTTP_CODE" = "101" ] || [ "$HTTP_CODE" = "426" ]; then echo "SDK Signer ready: HTTP $HTTP_CODE" exit 0 fi # 2) If not yet responding, try to surface a recent meaningful log line signer_logs=$(tail -20 /var/log/sdk_signer/sdk_signer.log 2>/dev/null | grep -E "(Disconnected|reconnect|error|connected|waiting|connecting|handshake|Initialized|Background sync)" | tail -1 || true) if [ -n "$signer_logs" ]; then echo "SDK Signer conn: $signer_logs" exit 1 fi # 3) Default: still starting up echo 'SDK Signer starting: WebSocket server initializing' exit 1