Keep operator telemetry live-only with bounded volatile state
This commit is contained in:
@@ -2,54 +2,45 @@
|
||||
|
||||
Portable local-only telemetry infrastructure for compute contours.
|
||||
|
||||
One Docker Compose project, `ndc-mission-core-telemetry`, owns three long-running
|
||||
containers and one bounded bootstrap job:
|
||||
The operator contour is **live-only**. One Compose project,
|
||||
`ndc-mission-core-telemetry`, owns two services: the authenticated Mosquitto broker
|
||||
and the normalizer/query adapter. There is no local telemetry database, named data
|
||||
volume, raw metric archive, or SQL retention job.
|
||||
|
||||
- `ndc-mission-core-mqtt-broker` — Eclipse Mosquitto `2.1.2-alpine`;
|
||||
- `ndc-mission-core-telemetry-timescaledb` — TimescaleDB HA OSS
|
||||
`pg16.14-ts2.28.2-all-oss`;
|
||||
- `ndc-mission-core-telemetry-bootstrap` — one-shot database role/bootstrap job;
|
||||
- `ndc-mission-core-telemetry-normalizer` — Mission Core telemetry normalizer.
|
||||
Each new sample replaces the previous value for the same contour, agent,
|
||||
measurement and series. The existing `/v1/contours/.../agents/.../latest` response
|
||||
contract is preserved. Split Telegraf fields at the same timestamp are merged;
|
||||
out-of-order older samples cannot replace newer state.
|
||||
|
||||
The Telegraf configuration templates cover Windows and Linux, but the agent runs as a
|
||||
host service rather than inside this Compose project. This preserves access to native
|
||||
Windows performance counters, Docker Desktop and NVIDIA telemetry.
|
||||
The cache lives only in RAM. Values expire after five minutes (the Core UI asks
|
||||
for at most 30-second-old values). Limits are 512 series per agent, 20,000 total,
|
||||
and 16 MiB of accounted entries including a fixed overhead allowance, within the
|
||||
256 MiB container memory ceiling. Oldest entries are evicted on capacity pressure;
|
||||
health exposes capacity, eviction and stale-input counters. This is bounded local
|
||||
monitoring, not a claim of acceptance for hundreds of workers.
|
||||
|
||||
The normalizer exposes a read-only normalized telemetry adapter on
|
||||
`127.0.0.1:18030`. Mission Core reads this adapter; the browser never receives MQTT or
|
||||
Timescale credentials, and Timescale is not published on a host port.
|
||||
The normalizer uses a separate `missioncore_normalizer` database role with only
|
||||
`SELECT`, `INSERT`, `UPDATE`, and bounded retention `DELETE` on the telemetry
|
||||
hypertable. Raw telemetry older than 30 days is removed in batches of at most
|
||||
1000 rows per minute, on a separate connection/thread (2s statement / 250ms lock
|
||||
deadline). Retention never runs inside the MQTT callback. This stays compatible
|
||||
with the Apache-licensed Timescale image without
|
||||
depending on the Timescale License retention scheduler.
|
||||
A background sweep clears the entire cache at the UTC date boundary, including
|
||||
when no messages arrive; restart also starts empty. Routine HTTP polls and message
|
||||
payloads are not logged. Both services rotate their diagnostic Docker logs at
|
||||
5 MiB × 2 files per service. MQTT persistence/retained messages are disabled,
|
||||
offline sessions are not replayed, and queues are bounded. Authentication, agent
|
||||
ACLs, loopback query access and the existing Worker connection are unchanged.
|
||||
|
||||
The 1 GiB database container explicitly sets 128 MiB shared buffers and 64 MiB
|
||||
maintenance memory. The HA image's automatic tuning sees the Docker VM instead
|
||||
of this container limit; do not inherit its multi-GiB defaults.
|
||||
`/health` reports `storage_ready` and `storage.backend=memory`; it no longer claims
|
||||
a database is reachable. Startup reconciliation uses that contract and can start
|
||||
only broker + normalizer. Long-term monitoring, if requested later, belongs to a
|
||||
separate explicitly provisioned service with time/size retention budgets.
|
||||
|
||||
For a memory-constrained local repair, `compose.source.yaml` mounts the reviewed
|
||||
normalizer source read-only into the **existing** image. Set
|
||||
`MISSIONCORE_NORMALIZER_SOURCE` to the absolute `normalizer.py` path, pass both
|
||||
Compose files and the existing private `--env-file` / `--project-directory`, and
|
||||
use `up -d --no-deps --no-build normalizer`. This is an explicit local source
|
||||
override, not a rebuilt portable image. Normal restart/reboot retains the mount.
|
||||
For migration from the retired SQL deployment: qualify the live adapter first,
|
||||
then remove only the exact Mission Core Timescale/bootstrap containers and the
|
||||
`ndc-mission-core-telemetry-timescale-data` volume, with owner authorization for
|
||||
history deletion. The old `ndc-mission-core-mqtt-data` volume is also obsolete.
|
||||
Do not use global Docker pruning or remove the Docker disk image. Simulation
|
||||
recordings, evidence, local application databases and Worker artifacts are separate
|
||||
and are not part of this migration.
|
||||
|
||||
The stack is one deployment contour, not one multi-process container. Keeping broker,
|
||||
normalizer and database in separate containers preserves independent health checks,
|
||||
least-privilege boundaries and rollback while Compose provides one operator lifecycle:
|
||||
|
||||
```bash
|
||||
docker compose ps
|
||||
docker compose up -d
|
||||
docker compose down
|
||||
```
|
||||
|
||||
All NODE.DC-owned Docker objects use the lowercase `ndc-` namespace. Docker names are
|
||||
case-sensitive identifiers, so the product prefix is normalized to lowercase while the
|
||||
product name remains NODE.DC in operator-facing copy.
|
||||
The optional `compose.source.yaml` provides a read-only source override for a
|
||||
bounded local repair; normal releases use the built normalizer image.
|
||||
|
||||
This directory does not contain credentials. Copy `.env.example` to `.env`, generate
|
||||
unique passwords and build the ACL/password files before starting the stack.
|
||||
@@ -101,10 +92,7 @@ network: ndc-mission-core-telemetry
|
||||
containers:
|
||||
ndc-mission-core-mqtt-broker
|
||||
ndc-mission-core-telemetry-normalizer
|
||||
ndc-mission-core-telemetry-timescaledb
|
||||
volumes:
|
||||
ndc-mission-core-mqtt-data
|
||||
ndc-mission-core-telemetry-timescale-data
|
||||
volumes: none (volatile tmpfs only)
|
||||
```
|
||||
|
||||
`prepare.py` passes passwords to `mosquitto_passwd` through stdin. Secrets are not placed
|
||||
|
||||
Reference in New Issue
Block a user