Spaces:
Sleeping
Sleeping
| version: '3.8' | |
| services: | |
| # Main application service | |
| app: | |
| build: | |
| context: .. | |
| dockerfile: docker/Dockerfile | |
| args: | |
| - BUILDKIT_INLINE_CACHE=1 | |
| image: voice-translator:latest | |
| container_name: voice-translator-app | |
| ports: | |
| - "${PORT:-8000}:8000" | |
| - "${METRICS_PORT:-9090}:9090" | |
| volumes: | |
| # Persist models (if you want to update them without rebuilding) | |
| - voice-models:/app/models | |
| # Persist logs | |
| - voice-logs:/app/logs | |
| # Optional: Persist data | |
| - voice-data:/app/data | |
| environment: | |
| # Server Configuration | |
| - HOST=0.0.0.0 | |
| - PORT=${PORT:-8000} | |
| - WORKERS=${WORKERS:-4} | |
| - LOG_LEVEL=${LOG_LEVEL:-INFO} | |
| - ENVIRONMENT=production | |
| - DEBUG=${DEBUG:-False} | |
| # Audio Configuration | |
| - AUDIO_SAMPLE_RATE=${AUDIO_SAMPLE_RATE:-16000} | |
| - AUDIO_CHANNELS=${AUDIO_CHANNELS:-1} | |
| - AUDIO_CHUNK_SIZE=${AUDIO_CHUNK_SIZE:-4096} | |
| # Connection Limits | |
| - MAX_CONNECTIONS=${MAX_CONNECTIONS:-100} | |
| - MAX_CONNECTIONS_PER_IP=${MAX_CONNECTIONS_PER_IP:-10} | |
| - MAX_USERS_PER_ROOM=${MAX_USERS_PER_ROOM:-10} | |
| # Rate Limiting | |
| - MAX_REQUESTS_PER_MINUTE=${MAX_REQUESTS_PER_MINUTE:-100} | |
| - MAX_MESSAGES_PER_SECOND=${MAX_MESSAGES_PER_SECOND:-10} | |
| # Worker Pools | |
| - TRANSLATION_WORKERS=${TRANSLATION_WORKERS:-4} | |
| - TTS_WORKERS=${TTS_WORKERS:-2} | |
| # Security (set these in production!) | |
| - ENABLE_AUTH=${ENABLE_AUTH:-false} | |
| - JWT_SECRET_KEY=${JWT_SECRET_KEY:-change-this-in-production} | |
| - API_KEYS=${API_KEYS:-} | |
| # Model Paths | |
| - VOSK_MODEL_BASE_PATH=/app/models/stt | |
| - ARGOS_MODEL_PATH=/app/models/translate/argos-packages | |
| - COQUI_MODEL_PATH=/app/models/tts/coqui-models | |
| # Performance | |
| - ENABLE_GPU=${ENABLE_GPU:-false} | |
| - BUFFER_SIZE=${BUFFER_SIZE:-8192} | |
| - QUEUE_SIZE=${QUEUE_SIZE:-100} | |
| # Monitoring | |
| - ENABLE_METRICS=${ENABLE_METRICS:-true} | |
| - METRICS_PORT=${METRICS_PORT:-9090} | |
| # Resource limits (adjust based on your needs) | |
| deploy: | |
| resources: | |
| limits: | |
| cpus: '4' | |
| memory: 8G | |
| reservations: | |
| cpus: '2' | |
| memory: 4G | |
| # Health check | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:8000/health"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 60s | |
| restart: unless-stopped | |
| networks: | |
| - voice-translator-network | |
| # Logging configuration | |
| logging: | |
| driver: "json-file" | |
| options: | |
| max-size: "10m" | |
| max-file: "3" | |
| # Optional: Redis for caching and session management | |
| redis: | |
| image: redis:7-alpine | |
| container_name: voice-translator-redis | |
| ports: | |
| - "${REDIS_PORT:-6379}:6379" | |
| volumes: | |
| - redis-data:/data | |
| command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru | |
| healthcheck: | |
| test: ["CMD", "redis-cli", "ping"] | |
| interval: 10s | |
| timeout: 5s | |
| retries: 5 | |
| restart: unless-stopped | |
| networks: | |
| - voice-translator-network | |
| logging: | |
| driver: "json-file" | |
| options: | |
| max-size: "5m" | |
| max-file: "2" | |
| # Optional: Nginx reverse proxy for load balancing | |
| # nginx: | |
| # image: nginx:alpine | |
| # container_name: voice-translator-nginx | |
| # ports: | |
| # - "80:80" | |
| # - "443:443" | |
| # volumes: | |
| # - ./nginx.conf:/etc/nginx/nginx.conf:ro | |
| # - ./ssl:/etc/nginx/ssl:ro | |
| # depends_on: | |
| # - app | |
| # restart: unless-stopped | |
| # networks: | |
| # - voice-translator-network | |
| # Optional: Prometheus for monitoring | |
| # prometheus: | |
| # image: prom/prometheus:latest | |
| # container_name: voice-translator-prometheus | |
| # ports: | |
| # - "9091:9090" | |
| # volumes: | |
| # - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro | |
| # - prometheus-data:/prometheus | |
| # command: | |
| # - '--config.file=/etc/prometheus/prometheus.yml' | |
| # - '--storage.tsdb.path=/prometheus' | |
| # restart: unless-stopped | |
| # networks: | |
| # - voice-translator-network | |
| # Optional: Grafana for visualization | |
| # grafana: | |
| # image: grafana/grafana:latest | |
| # container_name: voice-translator-grafana | |
| # ports: | |
| # - "3000:3000" | |
| # volumes: | |
| # - grafana-data:/var/lib/grafana | |
| # environment: | |
| # - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin} | |
| # restart: unless-stopped | |
| # networks: | |
| # - voice-translator-network | |
| networks: | |
| voice-translator-network: | |
| driver: bridge | |
| ipam: | |
| config: | |
| - subnet: 172.25.0.0/16 | |
| volumes: | |
| voice-models: | |
| driver: local | |
| voice-logs: | |
| driver: local | |
| voice-data: | |
| driver: local | |
| redis-data: | |
| driver: local | |
| # prometheus-data: | |
| # driver: local | |
| # grafana-data: | |
| # driver: local | |