yt-dlp-dags/airflow/configs/docker-compose-ytdlp-ops.yaml.j2

108 lines
3.7 KiB
Django/Jinja

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:
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.
{% if service_role is defined and service_role != 'management' %}
depends_on:
- camoufox-group
{% endif %}
# Ports are no longer exposed directly. Envoy will connect to them on the internal network.
env_file:
- ./.env # Path is relative to the project directory
volumes:
- context-data:/app/context-data
- ./logs/communication_logs:/app/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}"
- "--account-active-duration-min"
- "${ACCOUNT_ACTIVE_DURATION_MIN:-30}"
- "--account-cooldown-duration-min"
- "${ACCOUNT_COOLDOWN_DURATION_MIN:-60}"
- "--service-role"
- "{{ service_role }}"
{% if service_role is defined and service_role != 'management' %}
# --- Parameters for worker/all-in-one roles ONLY ---
- "--script-dir"
- "/app"
- "--context-dir"
- "/app/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"
{% endif %}
restart: unless-stopped
pull_policy: always
volumes:
context-data:
networks:
proxynet:
name: airflow_proxynet
external: true