spb/earth-now Public License
earth-now.co — real-time planetary dashboard: live world metrics modeled, not streamed.
TypeScript 93%
Shell 2.3%
SQL 1.4%
JavaScript 1.3%
Dockerfile 1.2%
CSS 0.8%
1#!/usr/bin/env bash2# earth-now.co3# Author: Simon-Pierre Boucher4# Contact: contact@spboucher.ai5# File: infra/tunnel-status.sh6# Purpose: Query the ngrok local API on node m3u96b and pretty-print tunnel state + public URL78set -euo pipefail910REMOTE="m3u96b"1112echo "== ngrok tunnel status on ${REMOTE} =="1314TUNNELS_JSON="$(ssh "${REMOTE}" "curl -s --max-time 5 http://localhost:4040/api/tunnels" 2>/dev/null || true)"1516if [ -z "${TUNNELS_JSON}" ]; then17 echo "✗ ngrok is NOT running on ${REMOTE} (no local API on :4040)."18 echo " Start it with: ssh ${REMOTE} 'cd ~/earth-now && ngrok start --config infra/ngrok.yml earth-now'"19 exit 120fi2122python3 - "$TUNNELS_JSON" <<'PYEOF'23# Pretty-print the ngrok /api/tunnels payload passed as argv[1].24import json25import sys2627try:28 data = json.loads(sys.argv[1])29except json.JSONDecodeError:30 print("✗ ngrok local API returned non-JSON output — agent may be starting up or misconfigured.")31 sys.exit(1)3233tunnels = data.get("tunnels", [])34if not tunnels:35 print("✗ ngrok agent is running but NO tunnels are established.")36 sys.exit(1)3738for t in tunnels:39 name = t.get("name", "?")40 public_url = t.get("public_url", "?")41 proto = t.get("proto", "?")42 addr = t.get("config", {}).get("addr", "?")43 conns = t.get("metrics", {}).get("conns", {}).get("count", "?")44 print(f"✓ tunnel '{name}' [{proto}] {public_url} → {addr} (connections: {conns})")45PYEOF46