fix(infra): exclude serve-static from 'dev.sh up all' (port collision with apps) #261
Reference in New Issue
Block a user
Delete Branch "fix/dev-sh-up-all-include-apps"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix
./infra/local/dev.sh up allfailing onport is already allocatedfor port 4200: theappsprofile (ADR-0030 — Angular dev-server on 4200) and theserve-staticprofile (Caddy reverse proxy for the production build, also defaulting to 4200) cannot run together.up allexpanded to "every profile" without taking that conflict into account.After this PR,
./infra/local/dev.sh up allbrings up the comprehensive dev stack — infra +dbtools+observability+apps— andserve-staticstays available via the explicit./infra/local/dev.sh up serve-staticinvocation when a developer actually wants to test a production build.Root cause
dev.compose.ymlpublishes port 4200 in two services:portal-shell(profileapps):${SHELL_PORT:-4200}:4200— Angular dev-server.serve-static(profileserve-static):${SERVE_STATIC_PORT:-4200}:4200— Caddy serving the production build.dev.sh'sALL_PROFILESarray was used both as:downand friends), andup all.Conflating the two meant
up allalways tried to startserve-staticeven whenappswas in scope — and the Docker port-publishing collision aborted the wholeup.Fix
Split the two concerns:
serve-staticstays accessible:dev.sh up serve-static(the original way),dev.sh down/status/logs(still inALL_PROFILES).Why exclude
serve-staticfromup allrather thanapps:appsis the new "no native toolchain" dev mode (ADR-0030) — it is what a comprehensive devupshould boot.serve-statichas zero value without a priornx build --configuration=production(Caddy serves an emptydist/→ 404 everywhere). Auto-starting it inup allwould put a 404-machine in the stack by default.forwardPorts.What lands
infra/local/dev.shALL_PROFILES(teardown scope) andUP_ALL_PROFILES(up allscope). Inline comment explains the exclusion ofserve-static. Usage text updated.infra/README.mdup allclarifies the new behaviour.Out of scope
The script is environment-agnostic — it works identically when invoked on the local workstation or on
vm-dev. Port publishing is on0.0.0.0by default, so services are reachable from a remote browser via the VM IP without any script change. The user-visible difference is only the URL host (localhost:4200locally vs<vm-ip>:4200from the workstation against the VM). No local-vs-vm mode in the script.Test plan
bash -n infra/local/dev.shpasses../infra/local/dev.sh helpshows the updatedup alldescription../infra/local/dev.sh up allbrings up postgres / redis / otel-collector / pgweb / jaeger / apps-deps (exits 0) / portal-bff / portal-shell / portal-admin without port conflicts;serve-staticis not started../infra/local/dev.sh up serve-static(explicit) still starts Caddy on 4200, providedappsis not already up../infra/local/dev.sh downandstatusstill see serve-static if it was started manually (ALL_PROFILES retains it).Related
up allwas added to the user-facing surface in that PR; this PR finishes wiring it.appsandserve-statictogether"). This PR turns the caveat into a script invariant instead of relying on the user to remember.