diff --git a/docker-compose.yml b/docker-compose.yml index 3fede36f5..01ecc259f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,10 +44,18 @@ services: # ── NATS JetStream ──────────────────────────────────────────────── nats: image: nats:2.14-alpine3.22 - command: -js -m 8222 + # The client port is published on every interface (agent containers reach + # it over the bridge), so it refuses to start without a token. Set + # NATS_TOKEN here and name the same value in [nats] token_env. + entrypoint: + - sh + - -c + - '[ -n "$$NATS_TOKEN" ] || { echo "NATS_TOKEN is required" >&2; exit 1; }; exec nats-server -js -m 8222 --auth "$$NATS_TOKEN"' + environment: + NATS_TOKEN: ${NATS_TOKEN:-} ports: - "4222:4222" # client - - "8222:8222" # monitoring (http://localhost:8222) + - "127.0.0.1:8222:8222" # monitoring (http://localhost:8222) volumes: - nats_data:/data restart: unless-stopped