name: ytdlp-ops {% if service_role is defined and service_role != 'management' %} include: # This automatically includes the generated camoufox service definitions and dependencies. # It simplifies the docker-compose command, as you no longer need to specify both files with -f. # The file is generated by the config-generator service and will be created even if empty. - ./configs/docker-compose.camoufox.yaml {% endif %} services: bgutil-provider: image: brainicism/bgutil-ytdlp-pot-provider container_name: bgutil-provider init: true ports: - "4416:4416" restart: unless-stopped networks: - proxynet context-prepper: image: busybox:latest restart: "no" volumes: - ./context:/app/context networks: - proxynet command: - "/bin/sh" - "-c" - | set -e CONTEXT_BASE_DIR="/app/context" TIMESTAMP_DIR="$${CONTEXT_BASE_DIR}/context-data_$$(date +%Y%m%d_%H%M%S)" mkdir -p "$${TIMESTAMP_DIR}" ln -sfn "$${TIMESTAMP_DIR}" "$${CONTEXT_BASE_DIR}/context-data" echo "Context prepper finished. Data will be in: $${TIMESTAMP_DIR}" envoy: image: envoyproxy/envoy:v1.29-latest {% if service_role != 'management' %} container_name: envoy-thrift-lb-${HOSTNAME} {% else %} container_name: envoy-thrift-lb {% endif %} restart: unless-stopped volumes: # Mount the generated config file from the host - ./configs/envoy.yaml:/etc/envoy/envoy.yaml:ro ports: # This is the single public port for all Thrift traffic - "${ENVOY_PORT:-9080}:${ENVOY_PORT:-9080}" # Expose the admin port for debugging - "${ENVOY_ADMIN_PORT:-9901}:${ENVOY_ADMIN_PORT:-9901}" networks: - proxynet # This service depends on ytdlp-ops-service, which in turn waits for camoufox. depends_on: - ytdlp-ops-service ytdlp-ops-service: image: pangramia/ytdlp-ops-server:latest # Don't comment out or remove, build is performed externally # container_name is omitted; Docker will use the service name for DNS. # This service depends on the camoufox-group service, which ensures all camoufox # instances are started before this service. depends_on: context-prepper: condition: service_completed_successfully {% if service_role is defined and service_role != 'management' %} camoufox-group: condition: service_started {% endif %} # Ports are no longer exposed directly. Envoy will connect to them on the internal network. # entrypoint: # - /bin/sh # - -c # - | # set -e # echo "[$(date)] Updating yt-dlp to latest nightly master..." # python3 -m pip install -U --pre "yt-dlp[default]" --upgrade-strategy eager --force-reinstall --no-cache-dir # echo "[$(date)] yt-dlp updated to:" # yt-dlp --version # echo "[$(date)] Starting original entrypoint..." # exec /usr/local/bin/docker-entrypoint.sh "$$@" env_file: - ./.env # Path is relative to the project directory volumes: - ./context:/app/context - ./logs/yt-dlp-ops/communication_logs:/app/logs/yt-dlp-ops/communication_logs {% if service_role != 'management' %} # Mount the generated endpoints file to make it available to the server - ./configs/camoufox_endpoints.json:/app/config/camoufox_endpoints.json:ro {% endif %} # 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: - proxynet command: # --- Parameters for ALL service roles --- - "--port" - "${YTDLP_BASE_PORT:-9090}" - "--timeout" - "${YTDLP_TIMEOUT:-600}" - "--workers" - "${YTDLP_WORKERS:-3}" - "--verbose" - "--server-identity" - "${SERVER_IDENTITY:-ytdlp-ops-airflow-service}" - "--redis-host" - "${MASTER_HOST_IP:-redis}" - "--redis-port" - "${REDIS_PORT:-52909}" - "--redis-password" - "${REDIS_PASSWORD}" - "--service-role" - "{{ service_role }}" # --- S3 Logging Parameters --- - "--s3-endpoint-url" - "${S3_ENDPOINT_URL}" - "--s3-access-key-id" - "${S3_ACCESS_KEY_ID}" - "--s3-secret-access-key" - "${S3_SECRET_ACCESS_KEY}" - "--s3-region-name" - "${S3_REGION_NAME}" {% if service_role is defined and service_role != 'management' %} # --- Parameters for worker/all-in-one roles ONLY --- - "--script-dir" - "/app" - "--context-dir" - "/app/context/context-data" - "--clean-context-dir" - "--clients" - "${YT_CLIENTS:-web,mweb,ios,android}" - "--proxies" - "${CAMOUFOX_PROXIES}" - "--camoufox-endpoints-file" - "/app/config/camoufox_endpoints.json" - "--print-tokens" - "--stop-if-no-proxy" - "--comms-log-root-dir" - "/app/logs/yt-dlp-ops/communication_logs" - "--bgutils-no-innertube" {% endif %} restart: unless-stopped pull_policy: always networks: proxynet: name: airflow_proxynet external: true