mirror of
https://github.com/coder/coder.git
synced 2026-10-16 14:48:56 +08:00
Makes the embedded NATS pubsub an opt-out feature instead of opt-in. The `nats_pubsub` experiment is removed and replaced with a `no_nats_pubsub` experiment, so NATS pubsub is now the default and can be disabled to fall back to PostgreSQL pubsub. NATS clustering requires this replica's routable address, resolved into `clusterHost` from either `--cluster-host` (`CODER_CLUSTER_HOST`) or the DERP relay URL. When neither is set (allowed when DERP is disabled on the primary), NATS cannot form a cluster, so startup logs a big error and falls back to PostgreSQL pubsub. The NATS cluster CA is only minted/rotated when NATS clustering is actually active (experiment not set and a cluster host is present). <details> <summary>Implementation notes</summary> - `codersdk/deployment.go`: removed `ExperimentNATSPubsub` (`nats_pubsub`), added `ExperimentNoNATSPubsub` (`no_nats_pubsub`, display name "No NATS Pubsub"). - `cli/server.go`: NATS is used by default unless `no_nats_pubsub` is enabled; if `clusterHost` is empty, log an error and keep the PostgreSQL pubsub. - `coderd/coderd.go`: gate NATS CA minting/rotation on `!ExperimentNoNATSPubsub && ClusterHost != ""` (i.e. only when NATS clustering is active). - `enterprise/coderd/licenses.go`: updated a stale comment. - `enterprise/coderd/coderd_test.go`: `TestMultiReplica_NATSPubsubPeers` no longer sets the removed experiment. - Regenerated `coderd/apidoc/docs.go`, `coderd/apidoc/swagger.json`, `docs/reference/api/schemas.md`, `site/src/api/typesGenerated.ts`. </details> --- *This PR was generated by Coder Agents on behalf of @spikecurtis.*