diff options
| author | Adam Malczewski <[email protected]> | 2026-06-25 08:02:26 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-25 08:02:26 +0900 |
| commit | 8a74335c21a57ee63c9a0658754430d6520dbc87 (patch) | |
| tree | a5ea754c0bb515b7e48ca4fa929ecdb341e388ba | |
| parent | 7535bb815c260f621c1d4b12a1a069de21ee2611 (diff) | |
| download | dispatch-8a74335c21a57ee63c9a0658754430d6520dbc87.tar.gz dispatch-8a74335c21a57ee63c9a0658754430d6520dbc87.zip | |
fix(bin): pin dev ports in bin/up so shell BACKEND_PORT can't override .env
bin/up ran `bun --watch main.ts` without setting BACKEND_PORT, so a
shell-exported BACKEND_PORT (e.g. 24991 in ~/.bashrc, set so the Dispatch
CLI hits the prod server) overrode .env's dev value 24203 — Bun lets shell
env win over .env — binding the dev server onto the production port and
colliding with the active dispatch-server systemd service. transport-http
then failed to activate (Bun.serve "port in use"), so the HTTP server
never came up and the frontend got "Failed to fetch".
Force BACKEND_PORT=24203 + SURFACE_WS_PORT=24205 in the setsid invocation
so the dev stack is deterministic regardless of the shell environment.
| -rwxr-xr-x | bin/up | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -43,7 +43,11 @@ echo "[up] frontend → http://localhost:24204 [vite HM echo "[up] Ctrl-C to stop both." echo -setsid bash -c "cd '$BACKEND' && exec bun --watch packages/host-bin/src/main.ts" \ +# Force the dev ports: a shell-exported BACKEND_PORT (e.g. 24991 from ~/.bashrc, +# set so the Dispatch CLI hits prod) would otherwise override .env and bind the +# dev server onto the production port (colliding with the prod systemd service). +# Bun lets shell env win over .env, so pin the dev ports here. +setsid bash -c "cd '$BACKEND' && exec env BACKEND_PORT=24203 SURFACE_WS_PORT=24205 bun --watch packages/host-bin/src/main.ts" \ > >(sed -u 's/^/[backend] /') 2>&1 & BACK_PG=$! |
