⚑
Neo-Raw // eBike Tracker
Dual-Homed DR Infrastructure
All Systems Operational
Guaranteed Free Tier: $0.00 / Month

Infrastructure Directory & Disaster Recovery Runbook

High-availability, dual-homed redundancy specification for the frame-embedded E-Bike GPS Tracker & Smart Alarm. Features sub-second automatic MQTT failover, idempotent telemetry deduplication across distributed Postgres instances, remote Grafana Cloud log shipping, and automated keepalive jobs.

PRIMARY: GCP e2-micro (34.134.11.181)
FAILOVER: EMQX Serverless + Supabase
OBSERVABILITY: Grafana Cloud (calmlattice2831)
FAILOVER TIME: 3 Packets (~334ms)
DOWNLINK: 54ms

🌐 01. Service Directory & Access Hub

Google Cloud (GCP) Primary Compute

24/7 Always Free e2-micro VM in Iowa (us-central1-a) running Docker Compose with Node.js Aedes/Express and local Postgres.

Public IPv4:34.134.11.181
MQTT Port:1883 (TCP)
REST API / UI:3000 (HTTP)
SSH User:antigravity@34.134.11.181
EMQX Cloud Failover Broker

Serverless MQTT broker in Frankfurt (eu-central-1) providing TLS 1.3 edge connectivity and REST downlink dispatch.

Host:ne9190a6...emqxsl.com
TLS Port:8883 (MQTTS)
REST API:8443 (/api/v5)
Auth User:trackeradmin
Supabase PostgreSQL Failover Database

Cloud Postgres in Ireland (eu-west-1) with PostgREST API and sequence deduplication (uq_bike_seq) + keepalive cron.

Project Ref:zseccsirfivtsehriixm
Constraint:uq_bike_seq
Keepalive:0 0 */3 * * (Actions)
Grafana Cloud Observability Hub

Centralized telemetry ingestion via Prometheus Remote Write and Loki Log Ingestion with live public health dashboards.

Instance:calmlattice2831.grafana.net
Prometheus ID:3555530
Loki ID:1773440
GitHub Repositories Source & Automation

Source control, PlatformIO firmware compilation, Docker build workflows, and automated database ping jobs.

Firmware:Kimishiba/eBike-GPS-Tracker
Server:Kimishiba/eBike-GPS-Tracker-Server
Keepalive:supabase-keepalive.yml

πŸ—ΊοΈ 02. Architecture & Data Flow Topology

graph TD
    subgraph EDGE["🚲 IoT Edge Layer (ESP32-WROOM-32E)"]
        ESP["ESP32 Cellular Tracker
Monotonic 64-bit Sequence Counter
RTC + NVS Watermark"] end subgraph ROUTE_A["🟒 Route A: Primary Compute (Always Free $0/mo)"] GCP["GCP e2-micro VM (34.134.11.181)
Docker Compose Stack (Iowa)"] APP["ebike-tracker (Node 22)
Aedes Broker (:1883) + Express (:3000)"] LOCAL_DB["ebike-db (postgres:16-alpine)
Credentials & Command Queue"] GCP --> APP APP --> LOCAL_DB end subgraph ROUTE_B["🟑 Route B: Secondary Cloud Failover ($0/mo)"] EMQX["EMQX Cloud Serverless
ne9190a6.ala.eu-central-1.emqxsl.com:8883 (TLS 1.3)
REST Downlink Dispatcher (:8443)"] SUPA["Supabase PostgreSQL
Project: zseccsirfivtsehriixm (Ireland)
Idempotent Deduplication (UNIQUE seq_num)"] CRON["GitHub Actions Keep-Alive Cron
Runs every 3 days (0 0 */3 * *)"] EMQX --> SUPA CRON --> SUPA end subgraph OBS["πŸ“Š Centralized Observability ($0/mo)"] GRAFANA["Grafana Cloud (calmlattice2831)
Prometheus Remote Write + Loki Log Ingestion"] end ESP -->|Default Primary Route: TCP 1883| GCP ESP -.->|Failover on Drop: TLS 8883| EMQX APP -->|Dual Downlink Dispatch| EMQX APP -->|Push Metrics & Logs| GRAFANA classDef primary fill:#ffffff,stroke:#1e1e1e,stroke-width:3px,color:#1e1e1e; classDef secondary fill:#ffffff,stroke:#1e1e1e,stroke-width:3px,color:#1e1e1e; classDef obs fill:#ffffff,stroke:#1e1e1e,stroke-width:3px,color:#1e1e1e; classDef edge fill:#ffffff,stroke:#1e1e1e,stroke-width:3px,color:#1e1e1e; class GCP,APP,LOCAL_DB primary; class EMQX,SUPA,CRON secondary; class GRAFANA obs; class ESP edge;
FIGURE 1: DUAL-HOMED REDUNDANT TOPOLOGY WITH SUB-SECOND HARDWARE FAILOVER AND DISTRIBUTED DEDUPLICATION

πŸ•ΉοΈ 03. Interactive Failover & Downlink Simulator

Traffic Mode: ROUTE A (PRIMARY 24/7)

🚨 04. Incident Response & Disaster Recovery Runbooks

πŸ”΄
Scenario A: Primary GCP VM is Down or Unreachable
Symptom: Port 1883/3000 stops responding or Grafana shows Primary: OFFLINE
β–Ό
⚑ Automated Sub-Second Failover

The ESP32 firmware detects 3 dropped TCP ACK packets and automatically fails over to EMQX Cloud Serverless (TLS 8883) in ~334ms. Telemetry flows to Supabase without data loss.

1
Check VM status in GCP Console:

Open Google Cloud Console and click "Start / Resume" if instance is stopped.

2
SSH into the instance and restart stack:
ssh antigravity@34.134.11.181 "cd ~/ebike-server && sudo docker compose restart"
⏸️
Scenario B: Supabase Database Inactivity Pause
Symptom: Keepalive GitHub Action fails or dashboard shows "Project Paused"
β–Ό
1
Restore database project:

Open Supabase Dashboard and click "Restore Project" (~60 seconds).

2
Trigger keepalive workflow:

Run supabase-keepalive.yml to verify HTTP 200 response.

πŸ”” 05. Automated Alerting Rules (Grafana Cloud)

🚨 Alert: PrimaryComputeDown Warning

Triggers when GCP Node.js HTTP traffic drops to zero AND no MQTT clients are connected for > 3 minutes.

sum(rate(http_request_duration_seconds_count[5m])) == 0 and sum(mqtt_connected_clients) == 0
🚨 Alert: BikeTheftAlarmTriggered Critical

Triggers immediately when the ADXL345 accelerometer detects unauthorized movement while armed.

increase(system_errors_total{type="alarm"}[1m]) > 0
βœ“ COPIED TO CLIPBOARD