- db_engine.py calls db.create_tables() at import time - Multiple gunicorn workers cause duplicate key violations - Run API locally for better development experience - Keeps postgres and adminer services only
68 lines
2.0 KiB
YAML
68 lines
2.0 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:17-alpine
|
|
restart: unless-stopped
|
|
container_name: pd_postgres
|
|
environment:
|
|
- POSTGRES_DB=${POSTGRES_DB:-pd_master}
|
|
- POSTGRES_USER=${POSTGRES_USER:-pd_admin}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-pd_dev_password}
|
|
- TZ=${TZ:-America/Chicago}
|
|
volumes:
|
|
- ./postgres_data:/var/lib/postgresql/data
|
|
- ./logs:/var/log/postgresql
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-pd_admin} -d ${POSTGRES_DB:-pd_master}"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
# Adminer - Database Admin UI
|
|
# Access at http://localhost:8081
|
|
adminer:
|
|
image: adminer:latest
|
|
restart: unless-stopped
|
|
container_name: pd_adminer
|
|
ports:
|
|
- "8081:8080"
|
|
environment:
|
|
- ADMINER_DEFAULT_SERVER=pd_postgres
|
|
- TZ=${TZ:-America/New_York}
|
|
depends_on:
|
|
- postgres
|
|
|
|
# Paper Dynasty API (optional - can run locally with 'uvicorn app.main:app --reload')
|
|
# Uncomment this section if you want to run the API in Docker
|
|
# IMPORTANT: db_engine.py calls db.create_tables() at import time which causes
|
|
# race conditions with multiple gunicorn workers. Run API locally for now.
|
|
# api:
|
|
# build: .
|
|
# restart: unless-stopped
|
|
# container_name: pd_api
|
|
# volumes:
|
|
# - ./storage:/usr/src/app/storage
|
|
# - ./logs:/usr/src/app/logs
|
|
# ports:
|
|
# - "8000:80"
|
|
# environment:
|
|
# - DATABASE_TYPE=postgresql
|
|
# - POSTGRES_HOST=pd_postgres
|
|
# - POSTGRES_DB=${POSTGRES_DB:-pd_master}
|
|
# - POSTGRES_USER=${POSTGRES_USER:-pd_admin}
|
|
# - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-pd_dev_password}
|
|
# - LOG_LEVEL=${LOG_LEVEL:-INFO}
|
|
# - API_TOKEN=${API_TOKEN:-dev_token}
|
|
# depends_on:
|
|
# - postgres
|
|
|
|
# Using local directories instead of Docker volumes to avoid space issues
|
|
# volumes:
|
|
# postgres_data:
|
|
# driver: local
|