Wave 1 of the Postgres migration (archie-core-7r0x.9). This is the shared shape
every port lane builds on; nothing here switches a live path to Postgres yet.
- config: add `database_url` beside `db_path` (config.go), mark it bootstrap-only
in denied_keys, expose it in the webui StorageView/config schema, and add it to
config.example.toml plus all deployments/*.toml.
- docker-compose: add a postgres:18 service; `task dev` (dev:postgres) brings it
up and waits for it before the State Store boots.
- archied: `openStateStore` now opens and migrates the process-scoped Postgres
pool via `openStateStorePool`. The State Store fails closed (D1.2) when
database_url is absent or invalid rather than fall back to SQLite; serving
against Postgres later requires an import-completion record (D1.3), which is a
later lane's gate, not this one.
- composition seam: task-store construction (state_store_task.go) and EDA-store
construction (state_store_eda.go) are extracted from openStateStore, with the
pool open in state_store_pool.go. This is a behaviour-preserving refactor only
— no store, interface, error, ordering or logging change — so L1 and L2 build
against separate files instead of sharing state_store.go.
Tests: fail-closed pool behaviour is pinned (absent/invalid URL); the State Store
boot/restart tests now run against a throwaway Postgres 18 container (pgtest
TestMain). Scoped test command and module-wide build pass; see lane report.
Five files named a specific host's service and the port it holds as the
reason a deployment might move the state store's listen address, including
config.example.toml, which ships to every operator. The guidance keeps its
point -- move the listen/target pair together when a port is already taken
on the host -- without naming a service the reader may not run, or have
heard of.
Also corrects the Taskfile's dev-stack summary, which still described the
state store as binding 127.0.0.1:9090. deployments/dev.toml pairs it with
9091, and has since the pair became configurable, so the comment described
a stack that does not start.
cockpit binds 9090 by default on this host, so task dev could not start the
State Store and every service came up without one. dev.toml's own comment
says to move the listen/target pair when that happens.
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.
Bead archie-core-8cda.5.5:
- task dev now runs archie-ui (dev:dashboard) on :8484 -- after the
cutover archied binds no dashboard listener, and Vite's /api,/events
proxy needs a live receiver there. dev:mobile starts archie-ui with a
LAN bind and -token-file (reusing the pre-cutover token path) instead
of a mobile archied overlay; dev:ui's summary points at archie-ui.
- deployments/dev.toml documents itself as the archie-ui overlay and
states the [services.gateway] target explicitly.
- systemd-user-service.md: the auth gap is now the documented posture --
archie-ui has no secret registry, resolves GATEWAY_TOKEN/
STATE_STORE_TOKEN from its process environment only, so the starter
(EnvironmentFile) exports them; worked env-file example added, plus
/healthz as the token-free liveness probe.
- INSTRUCTIONS.md ships five binaries with archie-ui in the quickstart
and the token story; README.md carries the auth note; the
docker-nats-stack profile notes archie-ui binds [web] and dials the
same [services.*] targets.
- release tooling: archied's component closure extends with
cmd/archie-ui and internal/app/archieui, so a UI-process-only commit
can no longer fall between the two changelogs; RELEASING.md documents
that the UI Service ships inside the archied release.
Closes six review findings against .4.6 (PR #775):
- daemon.StateStoreGrantIssuer + staterpc.TaskGrants: containers get a
per-task credential authorized only for their own Update/Transition/
InsertEvent, never the daemon's administrative token. Issued before
Acquire, revoked on Release; fails closed if no issuer is wired.
- StreamCaptures/StreamUndispatchedCaptures: new streaming RPCs so a
batch of large capture bodies can't exceed gRPC's 4MiB unary cap.
The original unary RPCs are kept, unmodified (deprecated) rather than
reshaped, so buf breaking stays green for an in-flight rolling deploy.
- Update rejects a nil Task with InvalidArgument instead of panicking in
the store layer.
- RequireHostGateway only forces on for embedded NATS, so an externally
reachable NATS/State Store no longer requires a local Docker bridge.
- Client-side token resolution now matches the server's (target_token,
then STATE_STORE_TOKEN secret/env).
- task dev now runs archie-state-store (dev:state-store) alongside
archied/archie-gateway/vite; deployments/dev.toml points them at it.