-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
207 lines (199 loc) · 5.26 KB
/
docker-compose.yaml
File metadata and controls
207 lines (199 loc) · 5.26 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
services:
upload-service:
build:
context: .
dockerfile: Dockerfile
container_name: upload-service
ports:
- "8080:8080"
env_file:
- .env
environment:
PG_URL: jdbc:postgresql://postgres:5432/${PG_DB}
MINIO_ENDPOINT: http://minio:9000
RABBITMQ_HOST: rabbitmq
SERVICE_MODE: upload
STATUS_PORT: 8081
command:
- /bin/sh
- -c
- |
if [ -f .env ]; then
if grep -q '^CONTAINER_ID=' .env; then
sed -i "s/^CONTAINER_ID=.*/CONTAINER_ID=$$HOSTNAME/" .env
else
echo "CONTAINER_ID=$$HOSTNAME" >> .env
fi
else
echo "CONTAINER_ID=$$HOSTNAME" > .env
fi
exec java -jar /app/upload-service.jar
depends_on:
rabbitmq:
condition: service_healthy
minio:
condition: service_started
postgres:
condition: service_healthy
restart: unless-stopped
processing-service:
build:
context: .
dockerfile: Dockerfile
container_name: processing-service
ports:
- "8082:8082"
env_file:
- .env
environment:
PG_URL: jdbc:postgresql://postgres:5432/${PG_DB}
PG_USER: ${PG_USER}
PG_PASSWORD: ${PG_PASSWORD}
MINIO_ENDPOINT: http://minio:9000
RABBITMQ_HOST: rabbitmq
SERVICE_MODE: processing
RABBITMQ_STATUS_QUEUE: processing.events.queue
RABBITMQ_STATUS_BINDING: upload.status.*
RABBITMQ_TASK_QUEUE: ${RABBITMQ_TASK_QUEUE}
RABBITMQ_TASK_BINDING: ${RABBITMQ_TASK_BINDING}
PROCESSING_SPOOL_ROOT: /app/processing-spool
volumes:
- processing_spool:/app/processing-spool
healthcheck:
test:
[
"CMD-SHELL",
"python3 -c \"import urllib.request; urllib.request.urlopen('http://localhost:8082/health', timeout=2)\" || exit 1"
]
interval: 15s
timeout: 5s
retries: 3
command:
- /bin/sh
- -c
- exec java -jar /app/processing-service.jar
depends_on:
rabbitmq:
condition: service_healthy
minio:
condition: service_started
restart: unless-stopped
status-service:
build:
context: .
dockerfile: Dockerfile
container_name: status-service
ports:
- "8081:8081"
env_file:
- .env
environment:
PG_URL: jdbc:postgresql://postgres:5432/${PG_DB}
RABBITMQ_HOST: rabbitmq
SERVICE_MODE: status
depends_on:
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
restart: unless-stopped
streaming-service:
build:
context: .
dockerfile: Dockerfile
container_name: streaming-service
ports:
- "8083:8083"
env_file:
- .env
environment:
PG_URL: jdbc:postgresql://postgres:5432/${PG_DB}
MINIO_ENDPOINT: http://minio:9000
MINIO_PUBLIC_ENDPOINT: ${MINIO_PUBLIC_ENDPOINT:-http://localhost:9000}
STREAMING_PORT: 8083
command:
- /bin/sh
- -c
- |
exec java -jar /app/streaming-service.jar
depends_on:
minio:
condition: service_started
postgres:
condition: service_healthy
restart: unless-stopped
rabbitmq:
image: rabbitmq:3-management
container_name: video-streaming-rabbitmq
ports:
- "5672:5672" # AMQP port
- "15672:15672" # Management UI
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASS}
volumes:
- rabbitmq_data:/var/lib/rabbitmq
healthcheck:
test: [ "CMD", "rabbitmq-diagnostics", "ping" ]
interval: 10s
timeout: 5s
retries: 5
minio:
image: quay.io/minio/minio
container_name: minio-dev
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY}
volumes:
- minio_data:/data
command: server /data --console-address ":9001"
postgres:
image: postgres:16-alpine
container_name: video-streaming-postgres
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${PG_USER}
POSTGRES_PASSWORD: ${PG_PASSWORD}
POSTGRES_DB: ${PG_DB}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./upload-service/docs/db/schema.sql:/docker-entrypoint-initdb.d/schema.sql:ro
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${PG_USER} -d ${PG_DB}" ]
interval: 10s
timeout: 5s
retries: 5
node-watcher:
build:
context: .
dockerfile: Dockerfile
container_name: node-watcher
env_file:
- .env
environment:
PG_URL: jdbc:postgresql://postgres:5432/${PG_DB}
RABBITMQ_HOST: rabbitmq
WATCH_CONTAINER_NAME_PREFIX: upload-service,processing-service
FAILURE_REASON: container_died
UPDATE_DB_STATUS: "true"
PYTHONUNBUFFERED: "1"
DEBUG_EVENTS: "true"
DEDUP_WINDOW_SECONDS: "3"
entrypoint: ["python3", "/app/node-watcher/watcher.py"]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
restart: unless-stopped
volumes:
rabbitmq_data:
minio_data:
postgres_data:
processing_spool: