Repository navigation
feat(deploy): VictoriaLogs in the control plane's Compose project (part of #232) - #460
Conversation
…rt of #232) ADR 0029: internal network only, pinned by digest, 30 days, 256 MiB, its data in a volume; in the control plane slice with a memory cap on one machine. The API gets VICTORIALOGS_URL and Trivy scans the image. Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 2 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
v1.53.0's Go 1.27.1 has four HIGH standard-library CVEs that Trivy reports (crypto/x509, net/http, crypto/tls); v1.54.0 is the release that upgrades its builder. The dev compose keeps the same pin. Signed-off-by: samuel mbabhazi <[email protected]>
…network Signed-off-by: samuel mbabhazi <[email protected]>
|
An independent review of this PR (high effort, while CodeRabbit is rate limited) raised six points. All six held up, and 92d518a fixes them:
Lab check: the new |
…461) Part of #232 (M6.1): the control plane's half of ADR 0029. It is stacked on #458 (the `ShipLogs` contract), which sits on #452 (the ADR). The agent's shipper is the other half, in its own PR. VictoriaLogs joins the Compose project in #460. ## What changed - **Gateway, `ShipLogs`** (`fleet/interface/log-stream.ts`). It runs behind the shared mTLS and database identity guard. - **Refusals:** - with no log store configured: `FAILED_PRECONDITION`; - when the first frame is not `LogsOpen` with the node's current lease epoch, read through `AuthenticateNode`: `FAILED_PRECONDITION`; - when batches are not numbered 1, 2, 3, …: `INVALID_ARGUMENT`. - **Acknowledgement.** Each batch gets its `LogAck` only once the store has kept it. A failed write ends the stream with `UNAVAILABLE` and no acknowledgement, so the agent sends again from its cursor. - **`Welcome.logs`** is true only when a store is registered. - **`fleet/application/log-batches.ts`** is the hook the observability module registers on, as `MetricsReports` is for metrics. - **`observability`:** - **Domain, `domain/logs.ts`, pure:** - entries are bounded: at most 256 per batch, a container name in the agent's grammar, a valid time, a line of at most 16 KiB; - labels come from the node's placed allocations: org, project, env, app, instance (the replica), node and stream. A line of any other container is dropped, and no name the agent sent becomes a label; - a time more than 5 minutes from the control plane's clock is replaced by it; - a per-node byte bucket allows 512 KiB/s with bursts of 4 MiB. - **`LogsIngest`:** it registers only with a store, drops malformed entries with a warning, maps containers in the tenant transaction, and waits for the node's rate before writing. - **`VictoriaLogsStore`:** `POST /insert/jsonline` with `_stream_fields=org,app,instance,stream`, `_time_field` and `_msg_field`, and a 10-second timeout. A failure never carries the store's text. - **Config:** `VICTORIALOGS_URL` is optional, as `VICTORIAMETRICS_URL` is. The Compose file (#460) and `.env.example` set it. - **SPEC 12:** the refusals and what is dropped. ## How it was tested - **Domain:** - bounds and malformed entries; - labels from the allocation, with the agent's container name absent from the records; - the skew rule; - the token bucket. - **Stream:** - in-order acknowledgements after the store kept each batch; - a missing open, a stale epoch, out-of-order numbers and a second open are refused; - no acknowledgement when the store fails; - the stream is refused without a store. - **Ingest:** registration only with a store, labels and drops, waiting past the rate, a store failure. - **Store**, against a local HTTP server: the query and the JSON lines, quotes and newlines included. A 500 fails without the server's text, and no records means no request. - `node-stream.spec.ts` passes the new dependency. - `vitest --project api`: 764 tests pass, and ESLint is clean. ## Security considerations - Tenant isolation rests on the certificate identity and the control plane's records. An agent can only write lines for containers placed on its own node, and every label is set here. - The batch, line and rate bounds protect the API and VictoriaLogs from a flooding agent: past its rate, a node waits instead of being dropped. - Logs change no state, so nothing is audited, as for metrics (ADR 0024). --------- Signed-off-by: samuel mbabhazi <[email protected]>
Part of #232 (M6.1). This adds VictoriaLogs to the control plane's Compose project, as ADR 0029 (#452) describes. Nothing writes to it yet: the API's
ShipLogshandler comes in a later PR.What changed
deploy/control-plane/compose.yml: avictorialogsservice, mirroringvictoriametrics:victoriametrics/victoria-logs:v1.54.0, pinned by digest, the same pin asdeploy/dev/compose.yml;-retentionPeriod=30d,-memory.allowedBytes=256MiB, and its data in avictorialogs-datavolume;-retention.maxDiskUsagePercent=80drops the oldest days once the filesystem is 80 % full, and-storage.minFreeDiskSpaceBytes=1GiBrefuses new lines below 1 GiB free (agents send them again);-search.maxConcurrentRequests=4,-search.maxQueryDuration=10s;logsnetwork that onlynet(the control plane's namespace) joins: PostgreSQL, the backup containers and the migrations cannot reach it.The control plane gets
VICTORIALOGS_URL: http://victorialogs:9428. The config schema already had the variable.compose.single-machine.yml: inshipkeep-controlplane.slicewithmem_limit: 320m, like VictoriaMetrics. Losing logs costs history, not state.security.yml: Trivy scans the pinned image on amd64 and arm64.docs/INSTALL.md: the upgrade section names the image, its volume (not in a PostgreSQL backup) and its disk cap, and says to replacecompose.single-machine.ymltoo on a single machine, passing both files.docs/THREAT_MODEL.md: logs can hold a secret an application printed; VictoriaLogs has no authentication, hence its own network.docs/MAINTAINING.md: thevictorialogsTrivy scans are optional, like the other pinned images.How it was tested
docker compose -f compose.yml -f compose.single-machine.yml configrenders the service with its slice, memory limit and volume.compose.ymlreplaced the old one anddocker compose up -drecreated the services. VictoriaLogs 1.54.0 runs with every flag above; it is onshipkeep_logsonly andneton both networks. PostgreSQL neither resolves nor reaches it (/dev/tcpto its address fails), while the control plane's namespace does. Lines an nginx replica printed afterwards were shipped by the agent and found by the API's text and stream search.Security considerations