e1c6f59948
Stage discovered the wrong default at runtime: tcp-ingestion's compiled default REDIS_TELEMETRY_STREAM is 'telemetry:teltonika' but processor's was 'telemetry:t', so the two services were talking past each other — tcp-ingestion publishing to one stream, processor reading another empty one. The deploy stack now pins both to the same value via a shared env var, but the processor's compiled default should also match so local development and the integration test stay aligned with reality. Changes: - src/config/load.ts — default changed to 'telemetry:teltonika' - .env.example — same - test/config.test.ts — default-value assertion updated - planning docs (ROADMAP, phase-1 README, tasks 03/08/10, phase-3 README) — occurrences of 'telemetry:t' replaced with 'telemetry:teltonika' The deploy stack remains the single source of truth via the shared REDIS_TELEMETRY_STREAM env var. Compiled defaults are belt-and-braces.
52 lines
2.0 KiB
Bash
52 lines
2.0 KiB
Bash
# Environment variables for processor.
|
|
# Copy to .env and fill in values for local development.
|
|
# Required vars: REDIS_URL, POSTGRES_URL.
|
|
|
|
# Runtime environment: development | test | production
|
|
NODE_ENV=development
|
|
|
|
# Unique identifier for this service instance.
|
|
# Used in logs (base field), metrics labels, and as the default Redis consumer name.
|
|
# IMPORTANT: must be unique per running instance for safe consumer-group operation.
|
|
# If two instances share the same INSTANCE_ID they will also share REDIS_CONSUMER_NAME,
|
|
# which causes consumer-group split-brain — the stream will not progress correctly.
|
|
INSTANCE_ID=processor-1
|
|
|
|
# Log level: fatal | error | warn | info | debug | trace
|
|
LOG_LEVEL=info
|
|
|
|
# Redis connection URL — required; no default.
|
|
REDIS_URL=redis://localhost:6379
|
|
|
|
# Postgres / TimescaleDB connection URL — required; no default.
|
|
POSTGRES_URL=postgres://postgres:postgres@localhost:5432/trm
|
|
|
|
# Redis Stream name to consume from. Must match tcp-ingestion's REDIS_TELEMETRY_STREAM.
|
|
# In the deploy stack this is pinned via the shared REDIS_TELEMETRY_STREAM env
|
|
# var so neither service can drift from the other.
|
|
REDIS_TELEMETRY_STREAM=telemetry:teltonika
|
|
|
|
# Redis consumer group name. All Processor instances join this group.
|
|
REDIS_CONSUMER_GROUP=processor
|
|
|
|
# Redis consumer name. Defaults to INSTANCE_ID.
|
|
# Override only when running multiple instances that should appear as distinct consumers
|
|
# in the group (e.g. when INSTANCE_ID is not set to a unique value per container).
|
|
# REDIS_CONSUMER_NAME=processor-1
|
|
|
|
# Port for Prometheus /metrics, /healthz, /readyz HTTP server.
|
|
METRICS_PORT=9090
|
|
|
|
# Max records fetched per XREADGROUP call.
|
|
BATCH_SIZE=100
|
|
|
|
# BLOCK timeout (ms) on XREADGROUP when the stream is empty. 0 = no blocking.
|
|
BATCH_BLOCK_MS=5000
|
|
|
|
# Max rows per Postgres INSERT batch.
|
|
WRITE_BATCH_SIZE=50
|
|
|
|
# Max devices kept in the per-device in-memory state map. LRU eviction beyond this cap.
|
|
# Size each entry at ~500 bytes → 10 000 devices ≈ 5 MB. Raise for large fleets.
|
|
DEVICE_STATE_LRU_CAP=10000
|