Skip to content

feat(stack): supervise a bundled NATS broker as a stack container (RIG-3107) - #878

Merged
trunk-io[bot] merged 1 commit into
mainfrom
compass-managed/rig-3107-nats-stack
Sep 6, 2026
Merged

feat(stack): supervise a bundled NATS broker as a stack container (RIG-3107)#878
trunk-io[bot] merged 1 commit into
mainfrom
compass-managed/rig-3107-nats-stack

Conversation

@rigel-mintaka

Copy link
Copy Markdown
Contributor

Adds NATS to the compass-stack supervisor as a third managed-container component, mirroring the existing OTel collector and containerized postgres: core builds a pure spec, an adapter runs it over rootless podman, and the one name-agnostic ContainerController tears all three down by recorded name. Brings up the message substrate the T3 fabric (RIG-3107) rides on.

Component. ComponentNats appends after ComponentCollector (never renumbered — the v2 pgid record round-trips components by String() name). buildDeps wires the real NatsContainer + NatsProber on the bundled path and skips both on the --nats-external nats://… opt-out; startNats early-returns when an external URL is set. Teardown reuses the shared name-agnostic controller, so a cross-process down reading a ctr nats <name> record entry always has a seam.

Container. Image pinned by digest (DefaultNatsImage, nats 2.14.6-alpine); ports bound to 127.0.0.1 loopback only (control-plane tier, no creds); config renders JetStream with a fixed store_dir and sync_interval. NatsStoreDir is the exported single source the container spec and the posture assertion share. natsStopTimeout 20s covers JetStream's SIGTERM store fsync; natsDrainBudget joins the DownDetached teardown arithmetic (escalation worst case 105s).

Tests. A hermetic seam suite (opt-out gate, bundle gate, start-failure drain, readiness-budget timeout, teardown-by-name + rm-f escalation, argv contract, mount-mode asymmetry) runs on default CI; a //go:build podman cross-process suite (TestNatsUpDown bundle path, TestExternalNatsUpDown opt-out negative leg) drives the real binary against real rootless podman, skip-if-absent (DL-179), and is the dev-box/dogfood-lane proof.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson matt@rigel.build

…G-3107)

Adds NATS to the compass-stack supervisor as a third managed-container component, mirroring the existing OTel collector and containerized postgres: core builds a pure spec, an adapter runs it over rootless podman, and the one name-agnostic ContainerController tears all three down by recorded name. Brings up the message substrate the T3 fabric (RIG-3107) rides on.

**Component.** `ComponentNats` appends after `ComponentCollector` (never renumbered — the v2 pgid record round-trips components by String() name). `buildDeps` wires the real `NatsContainer` + `NatsProber` on the bundled path and skips both on the `--nats-external nats://…` opt-out; `startNats` early-returns when an external URL is set. Teardown reuses the shared name-agnostic controller, so a cross-process `down` reading a `ctr nats <name>` record entry always has a seam.

**Container.** Image pinned by digest (`DefaultNatsImage`, nats 2.14.6-alpine); ports bound to 127.0.0.1 loopback only (control-plane tier, no creds); config renders JetStream with a fixed `store_dir` and `sync_interval`. `NatsStoreDir` is the exported single source the container spec and the posture assertion share. `natsStopTimeout` 20s covers JetStream's SIGTERM store fsync; `natsDrainBudget` joins the DownDetached teardown arithmetic (escalation worst case 105s).

**Tests.** A hermetic seam suite (opt-out gate, bundle gate, start-failure drain, readiness-budget timeout, teardown-by-name + rm-f escalation, argv contract, mount-mode asymmetry) runs on default CI; a `//go:build podman` cross-process suite (`TestNatsUpDown` bundle path, `TestExternalNatsUpDown` opt-out negative leg) drives the real binary against real rootless podman, skip-if-absent (DL-179), and is the dev-box/dogfood-lane proof.

Spec-impact: none. Refs RIG-3107

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

RIG-3107

@trunk-io

trunk-io Bot commented Sep 4, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review September 4, 2026 23:27
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-managed-rig-3107-nat-w5jc.compass-eng-docs.pages.dev

Deployed from compass-managed/rig-3107-nats-stack at 3db4952.

@trunk-io
trunk-io Bot merged commit d3488ff into main Sep 6, 2026
15 checks passed
@trunk-io
trunk-io Bot deleted the compass-managed/rig-3107-nats-stack branch September 6, 2026 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants