swarm-victoriametrics: forward the container's journal to the swarm collector
The metrics store's container now runs the journal forwarder the other service containers run, pushing to a receiver of its own on the swarm collector (serviceProducers swarm-victoriametrics) as a new machine OIDC client (swarm.victoriametrics.otel.clientId), registered by a glue file wherever authelia runs and published to the store by the secret publisher. The container keeps its loopback-only netns. The collector cannot dial a unix socket, so swarm-victoriametrics-egress-relay, a socket-activated systemd-socket-proxyd inside the container, takes its connections on 127.0.0.1:4380 and passes them to /run/swarm-victoriametrics-egress/egress.sock. The host's nginx listens there and sends /swarm-victoriametrics/ to the swarm collector and /api/oidc/token to authelia, both by name and verified, and refuses every other path. nginx gets ReadWritePaths on that directory and removes a stale socket before it starts. The container cannot reach the store, so the client secret is fetched on the host by swarm-victoriametrics-forwarder-oidc under swarm-metrics-auth's leaf, the shape swarm-bao-forwarder-oidc has, and bound into the container read-only. The forwarder module gains hostSecretFile for that: set, it renders no fetch unit. swarm-metrics-auth's policy gains one read stanza on the forwarder's client path. The container drops --link-journal=host, and the host collector stops reading it. Also lists the forge publisher's and matrix-ctl's leaves in the forwarder secrets row of docs/swarm/secrets.md, which the hive-forge/hive-matrix change missed.
This commit is contained in:
parent
77b38bc616
commit
7294707d7d
15 changed files with 454 additions and 62 deletions
|
|
@ -213,6 +213,16 @@ mints. On any other host you place a leaf whose CN is
|
|||
you set both. It reads the stored bearer at most once a minute, so a
|
||||
replaced bearer starts working up to a minute later.
|
||||
|
||||
The store's container has no network, so its journal forwarder leaves through
|
||||
a relay. Inside the container, `swarm-victoriametrics-egress-relay` listens on
|
||||
loopback and passes each connection to a socket the host's nginx listens on,
|
||||
`/run/swarm-victoriametrics-egress/egress.sock`. nginx sends the forwarder's
|
||||
route to the swarm collector and its token request to authelia, both by name
|
||||
and verified, and refuses every other path. On the host,
|
||||
`swarm-victoriametrics-forwarder-oidc.service` fetches the forwarder's OIDC
|
||||
secret under the same leaf as `swarm-metrics-auth`, and the container sees it
|
||||
read-only through a bind mount.
|
||||
|
||||
The collector scrapes Grafana's own metrics at
|
||||
`https://<swarm.grafana.domain>/metrics`, so a collector on a host without
|
||||
Grafana still gets them. The gateway admits only the collector's client to
|
||||
|
|
@ -291,16 +301,17 @@ gateway either way.
|
|||
|
||||
The `swarm-bao`, `swarm-nats`, `swarm-builder`, `swarm-claude-login`,
|
||||
`swarm-review-classifier`, `swarm-ci-runner`, `swarm-grafana`,
|
||||
`swarm-victorialogs`, `hive-forge` and `hive-matrix` containers each run a
|
||||
collector of their own that forwards the container's journal here, on a route
|
||||
and receiver per service (`https://<swarm.otel.domain>/<container>/`),
|
||||
authenticated as an OIDC client of that service's. The queue, builder, login
|
||||
minter and classifier reuse the service's own client; the store, CI runner,
|
||||
Grafana, log store, forge and homeserver have a forwarder client of their own
|
||||
`swarm-victorialogs`, `swarm-victoriametrics`, `hive-forge` and `hive-matrix`
|
||||
containers each run a collector of their own that forwards the container's
|
||||
journal here, on a route and receiver per service
|
||||
(`https://<swarm.otel.domain>/<container>/`), authenticated as an OIDC client
|
||||
of that service's. The queue, builder, login minter and classifier reuse the
|
||||
service's own client; the store, CI runner, Grafana, log store, metrics store,
|
||||
forge and homeserver have a forwarder client of their own
|
||||
(`swarm.<service>.otel.clientId`). Their records carry `service.name` (`bao`,
|
||||
`nats`, `builder`, `claude-login`, `review-classifier`, `ci-runner`,
|
||||
`grafana`, `victorialogs`, `forgejo`, `tuwunel`) and no `hive` label. The
|
||||
forwarder of all but the store's is
|
||||
`grafana`, `victorialogs`, `victoriametrics`, `forgejo`, `tuwunel`) and no
|
||||
`hive` label. The forwarder of all but the store's is
|
||||
`nix/container-modules/swarm-journal-forwarder.nix`.
|
||||
|
||||
**Both store exporters are unconditional**, and `deploy.victoriametrics.enable`
|
||||
|
|
|
|||
Loading…
Reference in a new issue