-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (119 loc) · 3.39 KB
/
docker-compose.yml
File metadata and controls
125 lines (119 loc) · 3.39 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
services:
redis:
image: redis:7-alpine
container_name: dip-redis
ports:
- "6380:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
start_period: 5s
restart: unless-stopped
postgres:
image: postgres:16-alpine
env_file: .env
ports:
- "5432:5432"
volumes:
- ./services/postgres/data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 3s
retries: 5
start_period: 5s
restart: unless-stopped
api:
build:
context: .
dockerfile: services/api/Dockerfile
env_file: .env
environment:
REDIS_HOST: redis
POSTGRES_HOST: postgres
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
ports:
- "8000:8000"
healthcheck:
test: ["CMD", "python", "-c", "import sys, urllib.request; sys.exit(0 if urllib.request.urlopen('http://127.0.0.1:8000/health/live', timeout=2).getcode() == 200 else 1)"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
restart: unless-stopped
producer:
build:
context: .
dockerfile: services/producer/Dockerfile
env_file: .env
environment:
REDIS_HOST: redis
PRODUCER_METRICS_PORT: ${PRODUCER_METRICS_PORT:-9101}
depends_on:
redis:
condition: service_healthy
volumes:
- ./services/producer/sample-video:/app/services/producer/sample-video:ro
ports:
- "9101:9101"
healthcheck:
test: ["CMD", "python", "-c", "import os, sys, urllib.request; port=os.getenv('PRODUCER_METRICS_PORT','9101'); sys.exit(0 if urllib.request.urlopen(f'http://127.0.0.1:{port}/metrics', timeout=2).getcode() == 200 else 1)"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
restart: unless-stopped
worker:
build:
context: .
dockerfile: services/worker/Dockerfile
env_file: .env
environment:
REDIS_HOST: redis
POSTGRES_HOST: postgres
WORKER_METRICS_PORT: ${WORKER_METRICS_PORT:-9102}
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
volumes:
- ./services/worker/output:/app/services/worker/output
- ./services/worker/.cache/ultralytics:/root/.cache/ultralytics
healthcheck:
test: ["CMD", "python", "-c", "import os, sys, urllib.request; port=os.getenv('WORKER_METRICS_PORT','9102'); sys.exit(0 if urllib.request.urlopen(f'http://127.0.0.1:{port}/metrics', timeout=2).getcode() == 200 else 1)"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
gpus: all
prometheus:
image: prom/prometheus:v2.54.1
user: root
depends_on:
api:
condition: service_healthy
producer:
condition: service_healthy
ports:
- "9090:9090"
volumes:
- ./services/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- prometheus_data:/prometheus
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://127.0.0.1:9090/-/healthy"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
restart: unless-stopped
volumes:
prometheus_data: