# ========================================= # TelePlay - Docker Compose # ========================================= # # Usage: # 1. Copy .env.example to .env and fill in your values # 2. Run: docker-compose up -d # # Services: # - db: PostgreSQL database # - backend: FastAPI + Telegram Bot # - web: React web interface (nginx) # # ========================================= services: # ----------------------------------------- # PostgreSQL Database # ----------------------------------------- db: image: postgres:15-alpine restart: unless-stopped environment: POSTGRES_USER: ${POSTGRES_USER:-postgres} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres} POSTGRES_DB: ${POSTGRES_DB:-telegram_tv} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: [ "CMD-SHELL", "pg_isready -U postgres" ] interval: 5s timeout: 5s retries: 5 networks: - telegram-tv-network # ----------------------------------------- # Backend API + Telegram Bot # ----------------------------------------- backend: build: ./backend restart: unless-stopped depends_on: db: condition: service_healthy environment: # Database DATABASE_URL: postgresql://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@db:5432/${POSTGRES_DB:-telegram_tv} # Redis (Optional - Currently unused) # REDIS_URL: redis://redis:6379 # Telegram (from .env file) TELEGRAM_API_ID: ${TELEGRAM_API_ID} TELEGRAM_API_HASH: ${TELEGRAM_API_HASH} TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN} TELEGRAM_STORAGE_CHANNEL_ID: ${TELEGRAM_STORAGE_CHANNEL_ID} # Security JWT_SECRET: ${JWT_SECRET:-change-me-in-production} JWT_EXPIRY_MINUTES: ${JWT_EXPIRY_MINUTES:-10080} # Web URL WEB_BASE_URL: ${WEB_BASE_URL:-http://localhost} ports: - "${BACKEND_PORT:-8000}:8000" volumes: # Persist Telegram session - telegram_session:/app networks: - telegram-tv-network # ----------------------------------------- # Web Interface (React + Nginx) # ----------------------------------------- web: build: ./web restart: unless-stopped depends_on: - backend ports: - "${WEB_PORT:-80}:80" networks: - telegram-tv-network # ----------------------------------------- # Volumes # ----------------------------------------- volumes: postgres_data: driver: local telegram_session: driver: local # ----------------------------------------- # Networks # ----------------------------------------- networks: telegram-tv-network: driver: bridge