- Add docker-compose.yml with PostgreSQL 16 container (port 5433) - Create async database session factory with connection pooling - Configure SQLAlchemy 2.0 DeclarativeBase for models - Update .env.example with correct database URL Connection pool settings from research: pool_size=10, max_overflow=20, pool_recycle=1800 (30 min), pool_pre_ping=True for validation.
22 lines
497 B
YAML
22 lines
497 B
YAML
services:
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: debate-postgres
|
|
environment:
|
|
POSTGRES_USER: debate
|
|
POSTGRES_PASSWORD: debate_dev
|
|
POSTGRES_DB: debate
|
|
ports:
|
|
- "5433:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U debate -d debate"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|