feat(config): let the State Store and Gateway listen addresses be configured
Both gRPC listeners took their bind address from a -listen flag default alone, with no config key. The port a service binds and the port its clients dial were therefore two separate facts -- the flag default, and [services.<name>].target -- with nothing keeping them in step. On a host that already owned the default the effect read as a code fault rather than a port collision: the store died with "bind: address already in use" while every client reported "state store: connection error ... error reading server preface: EOF". Cockpit binds 9090 by default, so this is not hypothetical. Verifying the dashboard on such a host needed a hand-written overlay plus a matching -listen, two things to keep in step by hand. - [services.state].listen and [services.gateway].listen now name the bind address. Precedence is -listen, then config, then a default applied by the loader. An empty result is a startup ERROR, never a fallback: net.Listen reads "" as "any free port", so defaulting there would bind the service somewhere no client looks and still report success. - Both flag defaults become "" so configuration can win, mirroring how archie-ui already prefers [web].listen over its flag. - Gateway listen defaults to the same constant as the gateway target, so a default deployment's client and server cannot drift onto different ports. [services.state].target still has no default: an empty target stays a startup error in the daemon and gateway, which no longer serve a local store. - ServiceConnection gains the field. Its doc now says clients read only Target and TargetToken, and Listen belongs to the process that owns the service -- the previous wording claimed the struct starts no listeners while carrying one. - deployments/dev.toml states each port once, beside the target it must match, so `task dev` is retargetable on a host that owns 9090 by editing one overlay. Tests. Unit: config defaults, explicit values, and precedence. Process: the existing real-process smoke test now takes its listen from configuration instead of -listen, so the end-to-end wiring is proven by the test that already starts the binary, with no extra process. Both were verified load-bearing by mutation -- inverting the precedence fails the unit test, and making the app layer ignore config fails the process test with "state: no listen address". Verified: task check exit 0. Also documented in config.example.toml, the configuration architecture table, and the `task dev` summary.
This commit is contained in:
1 parent
7414713d61
commit
b09be5515d
14 files changed
+272
-32
No files matched your search
+12
-8
@@ -11,16 +11,20 @@
|
||||
[web]
|
||||
listen = "127.0.0.1:8484"
|
||||
|
||||
# `task dev` also runs archie-state-store on its -listen default
|
||||
# (127.0.0.1:9090, loopback, no token) via dev:state-store -- point archied,
|
||||
# archie-gateway and archie-ui at it so a fresh dev checkout works without
|
||||
# hand-editing the installed config.toml
|
||||
# `task dev` runs archie-state-store via dev:state-store, which passes no
|
||||
# -listen, so the listen below is the port the store binds. It must agree with
|
||||
# the target: these two lines are the only place that pair is stated. Move them
|
||||
# when the host already owns 9090 (cockpit binds it by default) -- before the
|
||||
# listen key existed the collision could only be worked around by hand-writing
|
||||
# a matching target and passing -listen, and it read as a code fault.
|
||||
# (docs/prds/state-store-contract.md §12 step 7).
|
||||
[services.state]
|
||||
target = "127.0.0.1:9090"
|
||||
listen = "127.0.0.1:9090"
|
||||
|
||||
# `task dev` runs archie-gateway on its -listen default (127.0.0.1:8585,
|
||||
# loopback, no token). Stated explicitly so the value archie-ui dials is
|
||||
# visible next to the State Store one.
|
||||
# `task dev` runs archie-gateway via dev:gateway, which also passes no -listen:
|
||||
# the listen below is what it binds. Stated explicitly so the value archie-ui
|
||||
# dials is visible next to the State Store one.
|
||||
[services.gateway]
|
||||
target = "127.0.0.1:8585"
|
||||
target = "127.0.0.1:8585"
|
||||
listen = "127.0.0.1:8585"
|
||||
Reference in new issue
Block a user