-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
321 lines (311 loc) · 7.13 KB
/
docker-compose.yml
File metadata and controls
321 lines (311 loc) · 7.13 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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# Hercules Distributed File System
# All services built from the same Dockerfile with different SERVER_TYPE args
# Usage: docker-compose up -d
services:
# Master Server - Manages metadata and coordinates chunk servers
master:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: master_server
container_name: hercules-master
hostname: master
environment:
SERVER_TYPE: master_server
SERVER_ADDRESS: 0.0.0.0:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/master
LOG_LEVEL: info
ports:
- "9090:9090"
volumes:
- master-data:/data/master
networks:
- hercules-net
restart: unless-stopped
security_opt:
- no-new-privileges:true
user: "0:0"
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "9090"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Chunk Server 1 - Stores file chunks
chunkserver1:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: chunk_server
container_name: hercules-chunkserver1
hostname: chunkserver1
environment:
SERVER_TYPE: chunk_server
SERVER_ADDRESS: chunkserver1:8081
MASTER_ADDR: master:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/chunks
LOG_LEVEL: info
ports:
- "8081:8081"
volumes:
- chunk1-data:/data/chunks
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_add:
- NET_RAW
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "chunkserver1", "8081"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Chunk Server 2
chunkserver2:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: chunk_server
container_name: hercules-chunkserver2
hostname: chunkserver2
environment:
SERVER_TYPE: chunk_server
SERVER_ADDRESS: chunkserver2:8082
MASTER_ADDR: master:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/chunks
LOG_LEVEL: info
ports:
- "8082:8082"
volumes:
- chunk2-data:/data/chunks
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_add:
- NET_RAW
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "chunkserver2", "8082"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Chunk Server 3
chunkserver3:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: chunk_server
container_name: hercules-chunkserver3
hostname: chunkserver3
environment:
SERVER_TYPE: chunk_server
SERVER_ADDRESS: chunkserver3:8083
MASTER_ADDR: master:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/chunks
LOG_LEVEL: info
ports:
- "8083:8083"
volumes:
- chunk3-data:/data/chunks
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_add:
- NET_RAW
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "chunkserver3", "8083"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Chunk Server 4
chunkserver4:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: chunk_server
container_name: hercules-chunkserver4
hostname: chunkserver4
environment:
SERVER_TYPE: chunk_server
SERVER_ADDRESS: chunkserver4:8084
MASTER_ADDR: master:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/chunks
LOG_LEVEL: info
ports:
- "8084:8084"
volumes:
- chunk4-data:/data/chunks
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_add:
- NET_RAW
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "chunkserver4", "8084"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Chunk Server 5
chunkserver5:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: chunk_server
container_name: hercules-chunkserver5
hostname: chunkserver5
environment:
SERVER_TYPE: chunk_server
SERVER_ADDRESS: chunkserver5:8085
MASTER_ADDR: master:9090
REDIS_ADDR: redis:6379
ROOT_DIR: ./data/chunks
LOG_LEVEL: info
ports:
- "8085:8085"
volumes:
- chunk5-data:/data/chunks
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_add:
- NET_RAW
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "chunkserver5", "8085"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Redis - For failure detection (e.g., heartbeats, pub/sub for monitoring)
redis:
image: redis:alpine
container_name: hercules-redis
hostname: redis
ports:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- hercules-net
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Gateway Server - HTTP API for client interactions
gateway:
build:
context: .
dockerfile: Dockerfile
args:
SERVER_TYPE: gateway_server
container_name: hercules-gateway
hostname: gateway
environment:
SERVER_TYPE: gateway_server
GATEWAY_ADDR: 8089
MASTER_ADDR: master:9090
LOG_LEVEL: info
ports:
- "8089:8089"
networks:
- hercules-net
depends_on:
master:
condition: service_healthy
chunkserver1:
condition: service_healthy
chunkserver2:
condition: service_healthy
chunkserver3:
condition: service_healthy
chunkserver4:
condition: service_healthy
chunkserver5:
condition: service_healthy
restart: unless-stopped
security_opt:
- no-new-privileges:true
user: "0:0"
healthcheck:
test: ["CMD", "nc", "-z", "127.0.0.1", "8089"]
interval: 30s
timeout: 10s
retries: 3
start_period: 20s
volumes:
master-data:
driver: local
chunk1-data:
driver: local
chunk2-data:
driver: local
chunk3-data:
driver: local
chunk4-data:
driver: local
chunk5-data:
driver: local
redis-data:
driver: local
networks:
hercules-net:
name: hercules-net
driver: bridge