chore: parameterize docker host ports and wire s2-lite by default#3642
chore: parameterize docker host ports and wire s2-lite by default#3642ericallam wants to merge 2 commits into
Conversation
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughAdds a commented S2 Realtime streams v2 block to .env.example and updates observability guidance. Parameterizes docker/docker-compose.yml (container names and host ports), removes the s2 wget healthcheck, and pins several images. Introduces docker/docker-compose.extras.yml with optional services and an observability stack. Updates package.json Docker scripts to use docker compose with --env-file .env. Updates AGENTS.md, CLAUDE.md, and CONTRIBUTING.md to document the changes and troubleshooting for running multiple local instances. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
83cc59f to
4dbfe1d
Compare
4dbfe1d to
123a8a6
Compare
123a8a6 to
56ba00e
Compare
Three small papercuts hitting new contributors:
1. .env.example was silent on realtime-streams S2 config, so fresh clones
defaulted to v1 (Redis-only) streams and Sessions / chat.agent failed
with "S2 configuration is missing". The `s2` service in compose
pre-seeds a `trigger-local` basin (see docker/config/s2-spec.json) —
wire the env vars to it by default.
2. The s2 healthcheck shelled `wget` on a distroless image, so docker
always reported it unhealthy even when the API was live. Drop it; no
service depends on s2.
3. Two clones could not run docker side by side: ports, project name,
and container names were all hardcoded. Parameterize host ports with
`${VAR:-default}`, drive the project name via `COMPOSE_PROJECT_NAME`
(with a `name:` field for backward compat), prefix container names
with `${CONTAINER_PREFIX:-}`, and pass `--env-file .env` so compose
reads the same root `.env` the webapp does.
Also split the optional services (electric-shard-1, ch-ui, toxiproxy,
nginx-h2, otel-collector, prometheus, grafana) into
docker-compose.extras.yml + a `docker:full` pnpm script. The core stack
keeps everything the webapp actually needs (postgres, redis, electric,
minio, clickhouse + migrator, s2-lite).
56ba00e to
6c39d95
Compare
Replace the bash-only `$([ -f .env ] && echo --env-file .env)` substitution in the docker scripts with `scripts/docker.mjs`, a small Node wrapper that conditionally passes `--env-file <repo-root>/.env` when the file exists. The substitution form failed on Windows (`cmd.exe` doesn't parse $(...)), which pnpm uses by default when running scripts on native Windows. Also routes `internal-packages/clickhouse/db:migrate` through the same helper so the migrator picks up `COMPOSE_PROJECT_NAME` from `.env` instead of the hardcoded `-p triggerdotdev-docker`, matching the multi-instance workflow.
Summary
Two papercuts new contributors hit running this repo locally:
Fresh clones default to v1 (Redis-only) realtime streams, so Sessions and
chat.agenterror with"S2 configuration is missing", even though thes2service is already indocker/docker-compose.ymland pre-seeds atrigger-localbasin. WireREALTIME_STREAMS_S2_*to it in.env.exampleso the new-contributor flow just works. (Also drop the s2 healthcheck: the image is distroless, so thewgetcheck always reports unhealthy.)Two clones can't both run
pnpm run dockerbecause ports, project name, and container names are all hardcoded. Parameterize every host port as${VAR:-default}, drive the project name viaCOMPOSE_PROJECT_NAME(with a top-levelname:field as the default), prefix container names with${CONTAINER_PREFIX:-}, and pass--env-file .envso compose reads the same root.envthe webapp does. The "Running multiple instances side by side" block in.env.examplelists every overridable knob.Also split the optional services (
electric-shard-1,ch-ui,toxiproxy,nginx-h2,otel-collector,prometheus,grafana) intodocker-compose.extras.ymlbehind a newpnpm run docker:fullscript. The core stack keeps everything the webapp actually needs to boot: postgres, redis, electric, minio, clickhouse + migrator, s2-lite.Defaults match every previous hardcoded value, so existing setups keep working without touching
.env.Test plan
pnpm run dockeron a clean clone brings up the core services on the standard ports under thetriggerdotdev-dockerproject name.COMPOSE_PROJECT_NAME=triggerdotdev-docker-alt+ the*_HOST_PORToverrides in.envbrings up a second stack alongside the default one with no port or container-name clashes..env.examplevalues;/healthcheckreturns 200, no S2 errors.trigger-localaccepts an append + read via the same REST endpoints the webapp uses.pnpm run docker:fullbrings up the optional services alongside the core ones in the same project.