- Updated docker-compose.yml with port 8990:8000 mapping - Fixed environment variables to match current .env configuration - Added third PostgreSQL database (postgres_mirror) for mirror/sync data - Added robust JSON file logging for all containers (10MB max, 3 files) - Updated PostgreSQL credentials to use postgres/postgres - Added health checks for all services - Enhanced Dockerfile with logging environment variables - Created .env.docker documentation file with deployment checklist - Docker build verified successfully
146 lines
3.6 KiB
YAML
146 lines
3.6 KiB
YAML
services:
|
|
backend:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "8990:8000"
|
|
environment:
|
|
- MTG_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres_mtgdata:5432/mtgdata
|
|
- MTG_PLATFORM_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres_platform:5432/mtgo_platform
|
|
- MTG_MIRROR_DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres_mirror:5432/mtgo_mirror
|
|
- MTG_BACKEND_URL=http://localhost:8990
|
|
- MTGJSON_DATA_DIR=/app/data
|
|
- MTGJSON_URL=https://mtgjson.com/api/v5/
|
|
- MTG_INTERACTION_MIN_CONFIDENCE=0.5
|
|
- MTG_INTERACTION_BATCH_SIZE=1000
|
|
- MTG_INTERACTION_REVIEW_QUEUE=true
|
|
- MTG_LOG_LEVEL=INFO
|
|
- MTG_LOG_FORMAT=json
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- SECRET_KEY=change-this-secret-key-in-production
|
|
- JWT_SECRET_KEY=change-this-jwt-secret-key-in-production
|
|
- DATA_DIR=/app/data
|
|
- UPLOAD_DIR=/app/uploads
|
|
volumes:
|
|
- mtg_data:/app/data
|
|
- mtg_uploads:/app/uploads
|
|
- mtg_logs:/app/logs
|
|
depends_on:
|
|
postgres_platform:
|
|
condition: service_healthy
|
|
postgres_mtgdata:
|
|
condition: service_healthy
|
|
postgres_mirror:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
start_period: 40s
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
tag: "{{.Name}}"
|
|
networks:
|
|
- mtgonline_network
|
|
|
|
postgres_platform:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=mtgo_platform
|
|
volumes:
|
|
- postgres_platform_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d mtgo_platform"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
tag: "{{.Name}}"
|
|
networks:
|
|
- mtgonline_network
|
|
|
|
postgres_mtgdata:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=mtgdata
|
|
volumes:
|
|
- postgres_mtgdata_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d mtgdata"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
tag: "{{.Name}}"
|
|
networks:
|
|
- mtgonline_network
|
|
|
|
postgres_mirror:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=mtgo_mirror
|
|
volumes:
|
|
- postgres_mirror_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d mtgo_mirror"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
tag: "{{.Name}}"
|
|
networks:
|
|
- mtgonline_network
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
tag: "{{.Name}}"
|
|
networks:
|
|
- mtgonline_network
|
|
|
|
volumes:
|
|
postgres_platform_data:
|
|
postgres_mtgdata_data:
|
|
postgres_mirror_data:
|
|
mtg_data:
|
|
mtg_uploads:
|
|
mtg_logs:
|
|
|
|
networks:
|
|
mtgonline_network:
|
|
driver: bridge
|