fix(compose): get the v2 stack working as a 4-service local dev loop#271
fix(compose): get the v2 stack working as a 4-service local dev loop#271JoshuaAFerguson wants to merge 2 commits into
Conversation
… loop The docker-compose.yml had drifted out-of-sync with the v2 architecture during the k8s-agent push. Rebuilds the local stack so `docker compose up -d` produces a working dev loop: - Drops obsolete `version: '3.9'` line. - Replaces the dead `docker-controller` service (the directory was renamed/removed) with `docker-agent` (agents/docker-agent/Dockerfile, marked WIP — sessions through it aren't guaranteed to fully work yet). - Adds the missing `ui` service (nginx + built React bundle, port 3000). - Wires AGENT_BOOTSTRAP_KEY on the api so the docker-agent self-registers on first connect (no manual provisioning). - Switches PLATFORM to `docker` so the api doesn't require a kubeconfig. (The api already supported a nil k8sClient downstream — the only blocker was a hard-fatal init that ignored PLATFORM.) - Lengthens JWT_SECRET to >=32 chars (api enforces a minimum). - Adds ADMIN_PASSWORD=admin123 so the login form works on first up. - Remaps host postgres to 5433 to avoid clashing with a host-side Postgres on 5432. Healthcheck fix in api/Dockerfile: - BusyBox wget's `--spider` sends HEAD; gin's /health route only registers GET, so the healthcheck failed and the api restart-looped. Switch to `wget -q -O /dev/null` which forces GET. Verified end-to-end: - `docker compose up -d` brings up postgres + nats + api + ui - http://localhost:3000 serves the UI - /api/v1/* proxies through nginx to the api container - POST /api/v1/auth/login with admin/admin123 returns a JWT token
Atomic cleanup of obsolete refs to the removed `./docker-controller/` directory (replaced by `agents/docker-agent/` in the v2 architecture): - Delete `scripts/build-docker-controller.sh` entirely — its build context (`./docker-controller`) doesn't exist anymore. - Rename `build_docker_controller` → `build_docker_agent` in `scripts/local-build.sh`; update image name, build context, and `valid components` help string accordingly. Update header comment. - Replace `docker-controller` / "Docker controller" usage strings in `scripts/docker-dev.sh` with the v2 `docker-agent` naming. - Update `scripts/README.md` to remove the deleted-script section and rename remaining "Docker controller" mentions. - Update `scripts/README-V2.md` matrix row to reflect that the legacy `build-docker-controller.sh` was replaced (not just renamed). - Annotate the one remaining production-code comment (in `sessiontemplates.go`) so readers know "Docker controller" referred to the pre-v2 component, now Docker agent. Out of scope for this commit (separately tracked structural work): helm chart values, scripts/local-deploy.sh, GH Actions release.yml, security-scan.yml, docs/TROUBLESHOOTING.md still reference the legacy `streamspace-kubernetes-controller` image.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db9206ad14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| api: | ||
| condition: service_healthy | ||
| ports: | ||
| - "3000:80" |
There was a problem hiding this comment.
Resolve host port collision between UI and Grafana
Binding the new ui service to host port 3000 conflicts with the existing grafana mapping (3000:3000) when the monitoring profile is enabled. In that context (./scripts/docker-dev.sh --all or docker compose --profile monitoring up), one of the containers will fail to start with an address-in-use error, so the advertised "all services" dev workflow is broken.
Useful? React with 👍 / 👎.
|
This pull request has been automatically marked as stale because it has not had recent activity. Action Required:
|
|
This pull request was automatically closed due to inactivity. If you believe this was closed in error, please reopen it. |
Summary
The v1→v2 agent refactor left `docker-compose.yml` referencing `./docker-controller/` (a directory that no longer exists). Bringing the local dev loop back to a working state by replacing it with the v2 `docker-agent` and adding the missing `ui` service so `docker compose up -d` produces a fully usable stack.
The `docker-agent` service is profile-gated (`--profile docker`) and clearly labeled WIP in the compose comment — its session-lifecycle handlers fell behind during k8s-agent development and aren't guaranteed to fully drive sessions yet, but the wiring is right so the next person to fix it doesn't have to re-discover the topology.
Verified end-to-end
```bash
docker compose up -d
→ postgres + nats + api + ui all healthy
curl http://localhost:3000/health # → "OK"
curl http://localhost:3000/api/v1/auth/setup/status # → JSON, proxied through nginx
curl -X POST http://localhost:3000/api/v1/auth/login \
-H 'Content-Type: application/json' \
-d '{"username":"admin","password":"admin123"}' # → {"token":"eyJ..."}
```
UI loads at http://localhost:3000, login form succeeds, all admin routes render (verified via Playwright in the same session).
Required code change in api/cmd/main.go
The `PLATFORM=docker` switch needs the api to tolerate `k8sClient == nil`. The downstream handler signature already accepts nil (see comment at line ~360 of `api/cmd/main.go`), but the init at line 121 hard-fataled regardless. The one-line fix is documented in the PR description but left in the working tree (not committed here) because that file also contains the in-flight plugin work which is a separate review surface. Either fold it into the next plugin commit or land it as a tiny standalone "api: tolerate nil k8sClient when PLATFORM != kubernetes" PR.
Test plan