Phase 9: Docker Deployment Setup - docker-compose with logging and port mapping

- 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
This commit is contained in:
2026-08-18 03:53:35 +00:00
parent 1df04aea52
commit ad037de48d
3 changed files with 168 additions and 27 deletions
+83
View File
@@ -0,0 +1,83 @@
# MTG Online - Docker Deployment Environment Configuration
# ============================================================
# Copy this file to .env and customize for your deployment.
#
# SECURITY NOTES:
# - Change all passwords before deploying to production
# - Use strong, unique passwords for each database
# - Rotate SECRET_KEY and JWT_SECRET_KEY regularly
# - Never commit .env files to version control
# =============================================================================
# DATABASE CONFIGURATION
# =============================================================================
# Three PostgreSQL databases are used:
# 1. mtgo_platform - Main platform data (users, decks, collections)
# 2. mtgdata - MTG card data (cards, sets, prices)
# 3. mtgo_mirror - Mirror/sync data for offline access
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
# =============================================================================
# BACKEND SERVER
# =============================================================================
# The backend runs on port 8000 inside the container, mapped to 8990 externally
MTG_BACKEND_URL=http://localhost:8990
# =============================================================================
# MTGJSON DATA
# =============================================================================
# Directory for storing MTGJSON data files
MTGJSON_DATA_DIR=/app/data
MTGJSON_URL=https://mtgjson.com/api/v5/
# =============================================================================
# INTERACTION PIPELINE
# =============================================================================
# Minimum confidence score for interaction detection
MTG_INTERACTION_MIN_CONFIDENCE=0.5
# Batch size for interaction processing
MTG_INTERACTION_BATCH_SIZE=1000
# Enable review queue for low-confidence interactions
MTG_INTERACTION_REVIEW_QUEUE=true
# =============================================================================
# LOGGING
# =============================================================================
# Log level: DEBUG, INFO, WARNING, ERROR, CRITICAL
MTG_LOG_LEVEL=INFO
# Log format: json or text
MTG_LOG_FORMAT=json
# =============================================================================
# REDIS
# =============================================================================
# Redis URL for caching and session management
REDIS_URL=redis://redis:6379/0
# =============================================================================
# SECURITY - CHANGE THESE IN PRODUCTION
# =============================================================================
SECRET_KEY=change-this-secret-key-in-production
JWT_SECRET_KEY=change-this-jwt-secret-key-in-production
# =============================================================================
# VOLUME PATHS
# =============================================================================
DATA_DIR=/app/data
UPLOAD_DIR=/app/uploads
# =============================================================================
# DEPLOYMENT CHECKLIST
# =============================================================================
# Before deploying:
# [ ] Change all database passwords
# [ ] Change SECRET_KEY and JWT_SECRET_KEY
# [ ] Set MTG_LOG_LEVEL to WARNING or ERROR in production
# [ ] Review health check intervals
# [ ] Configure reverse proxy (nginx/caddy) for HTTPS
# [ ] Set up log rotation and monitoring
# [ ] Test migrations with new database credentials
# [ ] Verify all three databases are accessible