teqo/docker-compose.yml
Francisco Solla 8125334401 feat(worktree): ambientes isolados por worktree — porta própria, bancos próprios, migrations no provision
pnpm worktree next [--go] [--no-migrate] agora provisiona um ambiente
determinístico por worktree: slot = parte numérica do código da Issue
(C15→15; hash sem dígitos; bump em colisão entre worktrees vivos), dev
server em 3100+slot, bancos teqo_wt<slot> / teqo_wt<slot>_test no
container compartilhado (-p teqo) com a cadeia de migrations aplicada;
escreve .env.local + .env.test.local (gitignored, marcador gerado; envs
manuais nunca sobrescritos) e copia PAYLOAD_SECRET/Blob/VAPID do main.
kill remove o worktree e dropa os bancos gerados (WITH FORCE, best-effort).

Suites leem .env.test.local depois de .env.test (vitest.setup /
playwright / db-doctor / gate-ci espelham o layering) e
assertTestDatabase aceita teqo_test ou teqo_<worktree>_test em localhost
só (fail-closed preservado). db:start/db:stop fixam -p teqo (um
container de qualquer diretório); max_connections 200→400. Sem Docker
(Cursor Cloud): degrada ao compartilhado com aviso.

Derivação pura em scripts/lib/worktree-env.mjs (unit-tested); fluxo
validado end-to-end: provision → migrate → 598/598 int no banco do
worktree → kill sem resíduo.
2026-08-08 11:33:07 -03:00

35 lines
1.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

services:
# Local development database. This is the ONLY database local dev and the
# test suite should ever touch — never point DATABASE_URL at the production
# Neon instance for local work (see the guard in scripts/guard-dev-db.mjs).
postgres:
# Pinned to match the production Neon major version (17), so pg_dump/restore
# from prod (see `pnpm db:pull`) works without version mismatches.
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: teqo
POSTGRES_PASSWORD: teqo
POSTGRES_DB: teqo
ports:
- '5432:5432'
# Default max_connections=100 is tight for vitest forks (≈CPUs × pg pool)
# plus a leftover `next start` from local repro. Raise the ceiling so the
# int gate fails on real assertions, not "too many clients already". 400
# leaves headroom for several agents' int suites on the SAME container in
# parallel (each worktree provisions its own databases — see
# scripts/worktree.mjs — but they share this one Postgres on 5432).
command: ['postgres', '-c', 'max_connections=400']
volumes:
- pgdata:/var/lib/postgresql/data
# Runs only on first initialization of the volume. Creates the dedicated
# teqo_test database so automated tests never share state with dev data.
- ./docker/postgres/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U teqo -d teqo']
interval: 5s
timeout: 5s
retries: 10
volumes:
pgdata: