Example end-to-end vehicle tracking demo using Docker:
- Mosquitto (MQTT) for telemetry ingestion
- Redis for storage and pub/sub
- Node.js backend (Express + Socket.IO)
- Nginx-served frontend that shows vehicles live
- Start services
docker compose up -d --build
- Open the UI
http://localhost:3001
- Publish sample telemetry
docker exec vehicle-tracking-mosquitto-1 \
mosquitto_pub -t "vehicle/001/location" \
-m '{"lat":41.0082,"lng":28.9784,"speed":45,"battery":85}'
Continuously publish random telemetry for a few vehicles:
python3 - <<'PY'
import json, random, subprocess, time
vehicles = [f"{i:03}" for i in range(1,7)]
while True:
ts = int(time.time()*1000)
for vid in vehicles:
payload = json.dumps({
"lat": 41.0 + random.uniform(-0.01, 0.01),
"lng": 28.97 + random.uniform(-0.01, 0.01),
"speed": random.randint(10, 90),
"battery": random.randint(30, 100),
"timestamp": ts
})
subprocess.run([
"docker","exec","vehicle-tracking-mosquitto-1","mosquitto_pub",
"-t", f"vehicle/{vid}/location","-m", payload
], check=True)
time.sleep(1)
PY
- Frontend: http://localhost:3001
- Backend (internal to Compose): backend:3000 (host: http://localhost:3002)
- MQTT: localhost:1883
- Redis: localhost:6379
- Metrics (cAdvisor): http://localhost:8080
- Backend logs will show messages like:
Vehicle 001: <lat>, <lng>. - Frontend automatically updates via Socket.IO on telemetry.