feat(infra): add local-dev Docker Compose stack #57
Reference in New Issue
Block a user
Delete Branch "feat/infra/local-dev-stack"
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
Bring up Postgres + Redis + OTel Collector in one command so contributors can run the BFF end-to-end without manually wiring each service. Replaces the throwaway
docker run postgres:17-alpineone-liner that was indocs/development.md§3.What lands
infra/local/dev.compose.yml— three core services (postgres:17.2-alpine,redis:7.4-alpine,otel/opentelemetry-collector-contrib:0.115.0) plus two viewers gated behind Compose profiles:--profile dbtools→sosedoff/pgweb:0.16.2(Postgres GUI on port 8081)--profile observability→jaegertracing/all-in-one:1.62(Jaeger UI on 16686).env. State in named volumes. Healthchecks on data services.infra/local/.env.example— credentials + ports template.POSTGRES_PASSWORDandREDIS_PASSWORDare mandatory (compose refuses to boot without them); other keys default sensibly.infra/local/init/postgres/01-init.sql— bootstrap SQL per ADR-0013:audit_owner/audit_writer/audit_reader/audit_archiverroles +auditschema. Default privileges encode the append-only contract (INSERT to writer, SELECT to reader, DELETE to archiver, no UPDATE/TRUNCATE to anyone). Applied on first Postgres boot only; documented re-run procedure.infra/local/otel-collector.yaml— pipeline: OTLP gRPC/HTTP → batch → debug exporter (always) + forward tojaeger:4317. When the observability profile is off, the Jaeger export logs warn-level retries but doesn't block the debug pipeline.Surrounding doc updates
infra/README.md— new "Local-dev stack" section: service inventory, port table, first-time setup walkthrough, persistence/bootstrap-replay tips. The previouslocal/placeholder line is removed.docs/development.md§3 — rewritten to walk through the compose-based setup; cross-links toinfra/README.mdfor the full reference. Roadmap entry for "Local infra recipe" removed from §8 (now implemented); "Observability dev-loop" line adjusted to point at the new Jaeger profile.Out of scope
infra/README.md.Test plan
cd infra/local && cp .env.example .env && docker compose -f dev.compose.yml up -d→ all three core services come up healthy; verify withdocker compose ps.psql postgres://portal:<pwd>@localhost:5432/portal_dev -c "\dn"shows theauditschema;\dgshows the four audit roles.redis-cli -a <pwd> PING→PONG.docker compose logs otel-collector.--profile dbtools up -d→ http://localhost:8081 shows pgweb UI, can navigate to the audit schema.--profile observability up -d→ http://localhost:16686 shows Jaeger UI; collector logs no longer report Jaeger export retries.docker compose down -vcleanly removes everything; nextup -dre-runs the bootstrap SQL.