- PostgreSQL 17 Alpine container with health checks - Adminer database UI on port 8080 - Persistent volumes for data - Environment variable support via .env - Comprehensive quickstart guide with common commands - Troubleshooting section - Production considerations - Update .gitignore to allow base docker-compose.yml
65 lines
1.7 KiB
YAML
65 lines
1.7 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:8080
|
|
adminer:
|
|
image: adminer:latest
|
|
restart: unless-stopped
|
|
container_name: pd_adminer
|
|
ports:
|
|
- "8080: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
|
|
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
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|