services: config-generator: image: python:3.9-slim container_name: ytdlp-ops-config-generator working_dir: /app volumes: # Mount the current directory to access the template, .env, and script - .:/app env_file: - ./.env environment: ENVOY_CLUSTER_TYPE: STRICT_DNS # Pass worker count and base port to ensure Envoy config matches the workers YTDLP_WORKERS: ${YTDLP_WORKERS:-3} YTDLP_BASE_PORT: ${YTDLP_BASE_PORT:-9090} # This command cleans up old runs, installs jinja2, and generates the config. command: > sh -c "rm -rf ./envoy.yaml && pip install --no-cache-dir -q jinja2 && python3 ./generate_envoy_config.py" envoy: image: envoyproxy/envoy:v1.29-latest container_name: envoy-thrift-lb restart: unless-stopped volumes: # Mount the generated config file from the host - ./envoy.yaml:/etc/envoy/envoy.yaml:ro ports: # This is the single public port for all Thrift traffic - "${ENVOY_PORT:-9080}:${ENVOY_PORT:-9080}" networks: - airflow_prod_proxynet depends_on: config-generator: condition: service_completed_successfully ytdlp-ops: condition: service_started camoufox: build: context: ./camoufox # Path relative to the docker-compose file dockerfile: Dockerfile args: VNC_PASSWORD: ${VNC_PASSWORD:-supersecret} # Use environment variable or default ports: # Optionally expose the camoufox port to the host for debugging - "12345:12345" - "5900:5900" # Expose VNC port to the host networks: - airflow_prod_proxynet command: [ "--ws-host", "0.0.0.0", "--port", "12345", "--ws-path", "mypath", "--proxy-url", "socks5://${SOCKS5_SOCK_SERVER_IP:-89.253.221.173}:1084", "--locale", "en-US", "--extensions", "/app/extensions/google_sign_in_popup_blocker-1.0.2.xpi,/app/extensions/spoof_timezone-0.3.4.xpi,/app/extensions/youtube_ad_auto_skipper-0.6.0.xpi" ] restart: unless-stopped # Add healthcheck if desired ytdlp-ops: image: pangramia/ytdlp-ops-server:latest # Don't comment out or remove, build is performed externally container_name: ytdlp-ops-workers # Renamed for clarity depends_on: - camoufox # Ensure camoufox starts first # Ports are no longer exposed directly. Envoy will connect to them on the internal network. env_file: - ./.env # Path is relative to the compose file volumes: - context-data:/app/context-data # Mount the plugin source code for live updates without rebuilding the image. # Assumes the plugin source is in a 'bgutil-ytdlp-pot-provider' directory # next to your docker-compose.yaml file. #- ./bgutil-ytdlp-pot-provider:/app/bgutil-ytdlp-pot-provider networks: - airflow_prod_proxynet command: - "--script-dir" - "/app" - "--context-dir" - "/app/context-data" # Use environment variables for port and worker count - "--port" - "${YTDLP_BASE_PORT:-9090}" - "--workers" - "${YTDLP_WORKERS:-3}" - "--clients" - "web,ios,android,mweb" - "--proxies" #- "socks5://sslocal-rust-1081:1081,socks5://sslocal-rust-1082:1082,socks5://sslocal-rust-1083:1083,socks5://sslocal-rust-1084:1084,socks5://sslocal-rust-1085:1085" - "socks5://${SOCKS5_SOCK_SERVER_IP:-89.253.221.173}:1084" # # Add the endpoint argument pointing to the camoufox service - "--endpoint" - "ws://camoufox:12345/mypath" - "--probe" # Add --camouflage-only if you don't want ytdlp-ops to manage the browser directly - "--camouflage-only" # Add flag to print full tokens in logs by default - "--print-tokens" # Add server identity and Redis connection details - "--server-identity" - "ytdlp-ops-airflow-service" - "--redis-host" - "${REDIS_HOST:-redis}" - "--redis-port" - "${REDIS_PORT:-6379}" - "--redis-password" - "${REDIS_PASSWORD}" # Add account cooldown parameters (values are in minutes) - "--account-active-duration-min" - "${ACCOUNT_ACTIVE_DURATION_MIN:-30}" - "--account-cooldown-duration-min" - "${ACCOUNT_COOLDOWN_DURATION_MIN:-60}" # Add flag to clean context directory on start - "--clean-context-dir" restart: unless-stopped pull_policy: always volumes: context-data: name: context-data networks: airflow_prod_proxynet: {}