8ea704f7e3
- hub/server.py: replace psycopg2 Postgres connection with urllib HTTP call to ingest /api/devices endpoint (fleet Postgres is Docker-internal, not reachable from the VPS directly) - telemetry-synology.sh: run_speedtest() now writes per-interface cache files (speedtest-result-<iface>); _cached_speedtest() reads cache if < 35 min old; _collect_wan() uses cached result so throughput shows in telemetry without blocking every 1-min cycle Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Busfleet Hub
Registration endpoint for kit-connect devices. Runs on the VPS at 162.243.83.36:8080.
Files
- register.sh — Called per-device. Assigns a tunnel port from pool 2230-2299, records it in
port-registry.json, returns JSON. - server.py — Minimal Python HTTP server. Routes
GET /api/register/<DEVICE_ID>→register.sh. - port-registry.json — Persistent device→port mapping.
Deploy
scp hub/register.sh hub/server.py root@162.243.83.36:/opt/busfleet-hub/
ssh root@162.243.83.36 systemctl restart busfleet-hub
API
GET /api/register/<DEVICE_ID>
Response (existing device):
{"device_id": "x5925", "tunnel_port": 2230, "tailscale_auth_key": "tskey-auth-...", "status": "existing"}
Response (new device):
{"device_id": "x9999", "tunnel_port": 2231, "tailscale_auth_key": "tskey-auth-...", "status": "new"}
Port Pool
Pool: 2230–2299 (plus grandfathered pre-pool ports 2225–2229).
| Device | Port | Location | Notes |
|---|---|---|---|
| x4078 | 2226 | Bus (field) | Eyeride + Starlink, kit-connect installed (needs port fix) |
| x4324 | 2225 | Bus (field) | kit-connect ✅ stable |
| x4662 | 2229 | Bus (field) | MR2200ac mesh, old kittunnel ✅ stable |
| x5925 | 2230 | Office bench | kit-connect ✅ stable |
| x9002 | 2231 | Office bench | GL-XE3000, kit-connect/kit-mgmt ✅ stable |