fix(build): task dev starts the State Store and waits for it

Task templates every command, so the PostgreSQL health check's
'{{.State.Health.Status}}' rendered as an empty format string: dev:postgres
always reported unhealthy after 60s, the State Store never started, and the
Gateway and daemon exited on boot or retried against a store that was never
coming. Escape the template, and have dev:daemon and dev:gateway wait for
the State Store's port before starting.
This commit is contained in:
sam committed 2026-09-25 15:10:00 +10:00
1 parent 9d65225ca0
commit fcc32006ec
1 file changed
+17 -1
+17 -1
View File
@@ -164,7 +164,7 @@ tasks:
- |
set -eu
for _ in $(seq 1 60); do
status=$(docker inspect --format '{{.State.Health.Status}}' "$(docker compose ps -q postgres)" 2>/dev/null || true)
status=$(docker inspect --format '{{`{{.State.Health.Status}}`}}' "$(docker compose ps -q postgres)" 2>/dev/null || true)
if [ "$status" = "healthy" ]; then
exit 0
fi
@@ -176,6 +176,14 @@ tasks:
dev:daemon:
desc: Run archied with live reload
cmds:
- |
# The daemon and Gateway read their settings from the State Store at
# boot and exit if it is not up yet; it starts only once PostgreSQL
# is healthy, so wait for its port ([services.state] in
# deployments/dev.toml) first.
for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done
echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2
exit 1
- air -build.args_bin="-config-overlay,deployments/dev.toml"
dev:dashboard:
@@ -192,6 +200,14 @@ tasks:
dev:gateway:
desc: Run the development Gateway
cmds:
- |
# The daemon and Gateway read their settings from the State Store at
# boot and exit if it is not up yet; it starts only once PostgreSQL
# is healthy, so wait for its port ([services.state] in
# deployments/dev.toml) first.
for _ in $(seq 1 120); do nc -z 127.0.0.1 9091 && exit 0; sleep 1; done
echo "state store did not come up on 127.0.0.1:9091 within 120s" >&2
exit 1
- go run ./cmd/archie-gateway -config-overlay deployments/dev.toml
dev:ui: