fix(compose): make the worker opt-in and require an explicit Supabase URL

Merged
BI
25d ago
+58-18

Summary

Docker review finding: a local docker compose up with production keys in .env.local started a worker that claims from the live ingestion queue, and the app build silently defaulted NEXT_PUBLIC_SUPABASE_URL to the production project.

  • Remove the production Supabase URL default (sjrfecxgysukkwxsowpy). Compose now fails fast (${NEXT_PUBLIC_SUPABASE_URL:?...}) unless the variable is supplied.
  • Put worker behind profiles: [worker] and drop the app's depends_on: worker, so a plain up starts the app only.
  • Remove the obsolete version: "3.8".
  • env_file: [{ path: .env.local, required: false }] for both services.
  • Worker: set WORKER_HEALTH_PORT=3901 (internal only, nothing published; not 8080 so the Medications sibling port-isolation audit does not flag a collision) so worker/health.ts binds, and add a Compose healthcheck on /health.
  • README Compose section: opt-in worker (--profile worker), and --env-file .env.local for both up and down (the down fix came from the Qodo review bot), because ${...} interpolation does not read env_file.

Areas touched: Delivery and assurance, Knowledge and records

Verification

  • docker compose config -q (compose v2.39.4) with no NEXT_PUBLIC_SUPABASE_URL → required variable NEXT_PUBLIC_SUPABASE_URL is missing a value (exit 1)
  • With the URL set: config --services → app only; --profile worker config --services → app, worker; no depends_on in the rendered config; config renders without a .env.local file present
  • prettier --check README.md docker-compose.yml → All matched files use Prettier code style!
  • docs:check-links → docs link check passed; docs:check-scripts → docs script-ref check passed
  • Containers were not started locally (no Docker daemon on the review box).

Risk and rollout

  • Risk: Low. Local Compose only. Railway does not use this file, and neither does CI.
  • Rollback: Revert this PR.
  • Provider or production effects: None. This reduces accidental production effects.

Notes

  • Anyone who relied on docker compose up starting the worker must now add --profile worker, which needs connected-workload approval.