feat(stack): supervise a bundled NATS broker as a stack container (RIG-3107) - #878
Merged
Merged
Conversation
…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>
|
😎 Merged successfully - details. |
rigel-mintaka
marked this pull request as ready for review
September 4, 2026 23:27
|
Compass engineering docs preview: https://compass-managed-rig-3107-nat-w5jc.compass-eng-docs.pages.dev Deployed from |
mattwilkinsonn
approved these changes
Sep 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
ComponentNatsappends afterComponentCollector(never renumbered — the v2 pgid record round-trips components by String() name).buildDepswires the realNatsContainer+NatsProberon the bundled path and skips both on the--nats-external nats://…opt-out;startNatsearly-returns when an external URL is set. Teardown reuses the shared name-agnostic controller, so a cross-processdownreading actr 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 fixedstore_dirandsync_interval.NatsStoreDiris the exported single source the container spec and the posture assertion share.natsStopTimeout20s covers JetStream's SIGTERM store fsync;natsDrainBudgetjoins 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 podmancross-process suite (TestNatsUpDownbundle path,TestExternalNatsUpDownopt-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