- Extend docker-compose.dev.yml with optional monitoring profile (Prometheus, Grafana, Loki) via --profile monitoring - Align dev PostgreSQL with production: pg_stat_statements + init scripts - Add scripts/seed.ts with idempotent Berlin test data (user, route, activity) - Add pnpm db:seed and pnpm dev:reset scripts - Simplify CI e2e job: replace manual docker run + BRouter setup with docker compose up --wait; add db:seed step - Improve scripts/dev.sh: Docker check, --wait health checks, --monitoring flag, seed step - Add scripts/reset-dev.sh to wipe and restart the local stack - Add .env.development.example with documented local defaults Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
1. Docker Compose
- 1.1 Update dev PostgreSQL to match production: add
shared_preload_libraries=pg_stat_statementscommand and mountinfrastructure/postgres/init-grafana-user.sqlas init script - 1.2 Add Prometheus service with
monitoringprofile, mountinginfrastructure/prometheus/prometheus.yml - 1.3 Add Grafana service with
monitoringprofile, anonymous auth enabled, provisioned with local Prometheus and Loki datasources - 1.4 Add Loki service with
monitoringprofile, mountinginfrastructure/loki/loki-config.yml
2. Database
- 2.1 Create
scripts/seed.tswith idempotent test data: user account, sample route (Berlin area), sample activity. Use Drizzle ORM,ON CONFLICT DO NOTHING - 2.2 Add
pnpm db:seedscript to root package.json that runsscripts/seed.tswith--experimental-strip-types
3. CI Integration
- 3.1 Replace manual
docker runPostgreSQL setup inci.ymle2e job withdocker compose -f docker-compose.dev.yml up -d --wait - 3.2 Replace manual BRouter download/start in
ci.ymlwith the compose BRouter service plus cached segment mount - 3.3 Add
pnpm db:seedstep afterpnpm db:pushin CI e2e job - 3.4 Remove any E2E test skip workarounds that check for DB availability (the
withDb()503 skip pattern)
4. Scripts
- 4.1 Improve
scripts/dev.sh: check Docker is running first, usedocker compose up -d --wait, add--monitoringflag to start monitoring profile, run seed after schema push - 4.2 Create
scripts/reset-dev.sh: stop containers, remove volumes, restart — add aspnpm dev:resetin package.json
5. Environment
- 5.1 Create
.env.development.examplewith documented defaults (DATABASE_URL, BROUTER_URL, JWT_SECRET, SESSION_SECRET) and add.env.developmentto.gitignore
6. Verify
- 6.1 Test full local dev flow:
pnpm dev:fullstarts services, pushes schema, seeds data, launches apps — create session, compute route, verify seeded data visible - 6.2 Test monitoring profile:
pnpm dev:full -- --monitoringstarts Prometheus + Grafana + Loki, verify Grafana dashboards load at localhost:3002 - 6.3 Test CI flow: push branch, verify e2e job uses compose, all ~20 E2E tests run (none skipped)
- 6.4 Test reset:
pnpm dev:resetwipes volumes and restarts cleanly