-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdocker-compose.worker.yaml
More file actions
57 lines (55 loc) · 2 KB
/
docker-compose.worker.yaml
File metadata and controls
57 lines (55 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Docker Compose for testing remote transcoding workers
#
# Prerequisites:
# 1. Worker API running on host: ./start-worker-api.sh (or uvicorn api.worker_api:app --port 9002)
# 2. Register a worker: curl -X POST http://localhost:9002/api/worker/register
# 3. Set the VLOG_WORKER_API_KEY environment variable with the returned key
#
# Usage:
# export VLOG_WORKER_API_KEY=<your-api-key>
# docker compose -f docker-compose.worker.yaml up --build
#
# # Scale workers:
# docker compose -f docker-compose.worker.yaml up --build --scale vlog-worker=3
services:
vlog-worker:
build:
context: .
dockerfile: Dockerfile.worker
environment:
# API URL - use host.docker.internal for macOS/Windows, or host IP for Linux
- VLOG_WORKER_API_URL=${VLOG_WORKER_API_URL:-http://host.docker.internal:9002}
# API key from worker registration (required)
- VLOG_WORKER_API_KEY=${VLOG_WORKER_API_KEY}
# Worker settings
- VLOG_WORKER_HEARTBEAT_INTERVAL=${VLOG_WORKER_HEARTBEAT_INTERVAL:-30}
- VLOG_WORKER_POLL_INTERVAL=${VLOG_WORKER_POLL_INTERVAL:-10}
# For Linux hosts, use host networking to access localhost services
# Uncomment the next line and comment out the extra_hosts section if needed
# network_mode: host
extra_hosts:
# Enable host.docker.internal on Linux
- "host.docker.internal:host-gateway"
volumes:
# Mount work directory for debugging (optional)
- worker-data:/tmp/vlog-worker
deploy:
# Resource limits for transcoding
resources:
limits:
cpus: '4'
memory: 8G
reservations:
cpus: '1'
memory: 2G
restart: unless-stopped
healthcheck:
# Check the worker's /ready endpoint which validates FFmpeg and API connectivity
test: ["CMD", "curl", "-f", "http://localhost:8080/ready"]
interval: 30s
timeout: 10s
retries: 3
# Allow time for worker to start and establish API connection
start_period: 30s
volumes:
worker-data: