Server: InfluxDB 2 storage, live telemetry endpoint, ABRP forwarder
- MongoDB replaced by InfluxDB 2 (one bucket, installationId tag). Consumption is stored per chunk at its recordedAt and summed on read, so a chunk the car re-sends from its cache overwrites itself instead of being counted twice ($inc did count it twice). Lifetime is a running total derived on read. - POST /v1/telemetry takes batches of samples in ABRP's tlm fields; every field is bounded, unknown fields are dropped, unread signals stay absent. - After a successful write the newest fresh sample is forwarded to ABRP with ABRP_API_KEY / ABRP_USER_TOKEN from the server environment; rate limited, never queued. The car no longer needs ABRP credentials. - Self-hosting: standalone output, Dockerfile (tests run in the build, runs as UID 10001), .env.example and README for the new setup. - Dev shell gains Node 22 and InfluxDB 2. Verified locally against InfluxDB 2.7.12: all endpoints, retry idempotency, and the dashboard pages. Unit tests: 17 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+15
-2
@@ -1,5 +1,18 @@
|
||||
MONGODB_URI=mongodb+srv://username:password@cluster.example.mongodb.net/
|
||||
MONGODB_DATABASE=fatihsmg4
|
||||
# InfluxDB 2 — a token with read/write on the bucket.
|
||||
INFLUX_URL=http://influxdb:8086
|
||||
INFLUX_TOKEN=replace-with-an-influxdb-token
|
||||
INFLUX_ORG=mg4
|
||||
INFLUX_BUCKET=mg4
|
||||
|
||||
# The car's write token (at least 24 characters): openssl rand -hex 32
|
||||
INGEST_TOKEN=replace-with-a-long-random-write-token
|
||||
# Signs dashboard sessions; rotating it signs every browser out: openssl rand -hex 32
|
||||
SESSION_SECRET=replace-with-a-long-random-session-secret
|
||||
# Dashboard login, at least 8 characters.
|
||||
DASHBOARD_PASSWORD=replace-with-a-strong-dashboard-password
|
||||
|
||||
# ABRP forwarding; off when either is empty.
|
||||
ABRP_API_KEY=
|
||||
ABRP_USER_TOKEN=
|
||||
# Minimum seconds between two samples forwarded to ABRP.
|
||||
ABRP_MIN_INTERVAL_SECONDS=5
|
||||
|
||||
Reference in New Issue
Block a user