- backend/alembic/* — alembic infra (env.py, script.py.mako). versions/ empty for now; first migration goes in Stage 2a when models are finalized. - backend/Dockerfile: bake alembic.ini + alembic/ into the image so `docker compose exec backend alembic upgrade head` works in prod. - backend/db/init/99_drop_unused_extensions.sql + bind-mount in both compose files: drops postgis-image's TIGER/topology/fuzzystrmatch on fresh volumes. - .pre-commit-config.yaml + pre-commit in dev deps: ruff/prettier on commit to stop CI failures like UP035 from leaking out. - ops/backup.sh, ops/restore.sh: pg_dump cron script with optional Selectel S3 upload. 7-day local retention. Restore guard: requires RESTORE_CONFIRM=yes. - Makefile: new targets `make migration NAME=...`, `make pre-commit-install`. - backend/.env.example: SENTRY_DSN comment with sentry.io reference.
59 lines
1.4 KiB
YAML
59 lines
1.4 KiB
YAML
services:
|
|
postgres:
|
|
image: postgis/postgis:16-3.4
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-gendesign}
|
|
POSTGRES_USER: ${POSTGRES_USER:-gendesign}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-gendesign}
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./backend/db/init:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER:-gendesign}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
backend:
|
|
build: ./backend
|
|
env_file: ./backend/.env
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- ./backend/app:/app/app
|
|
command:
|
|
["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
|
|
|
frontend:
|
|
build: ./frontend
|
|
# BACKEND_URL is read by next.config.ts rewrites (/api/* -> backend).
|
|
# The browser hits Next.js on :3000 with relative paths, Next.js proxies to backend.
|
|
environment:
|
|
BACKEND_URL: http://backend:8000
|
|
ports:
|
|
- "3000:3000"
|
|
depends_on:
|
|
- backend
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|