-
Notifications
You must be signed in to change notification settings - Fork 174
Expand file tree
/
Copy pathdocker-compose.halfstack-ha.yml
More file actions
409 lines (383 loc) · 11.7 KB
/
docker-compose.halfstack-ha.yml
File metadata and controls
409 lines (383 loc) · 11.7 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
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
version: "2.4"
services:
backendai-half-db:
image: postgres:15.1-alpine
command: postgres -c 'max_connections=256'
networks:
- half
ports:
- "8100:5432"
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-develove}
- POSTGRES_DB=${POSTGRES_DBNAME:-backend}
volumes:
- "./tmp/backend.ai-halfstack-ha/postgres-data:/var/lib/postgresql/data:rw"
backendai-half-db-exporter:
image: prometheuscommunity/postgres-exporter:v0.17.1
profiles: ["observability"]
restart: unless-stopped
networks:
- half
environment:
- DATA_SOURCE_URI=backendai-half-db:5432/backend?sslmode=disable
- DATA_SOURCE_USER=postgres
- DATA_SOURCE_PASS=develove
ports:
- "9187:9187"
backendai-half-redis-exporter-node01:
image: oliver006/redis_exporter:v1.73.0
profiles: ["observability"]
restart: unless-stopped
networks:
- half
command: >
--redis.addr redis://:${REDIS_PASSWORD:-develove}@backendai-half-redis-node01:${REDIS_MASTER_PORT}
--include-system-metrics
--include-config-metrics
--include-modules-metrics
ports:
- "9121:9121"
depends_on:
- backendai-half-redis-node01
backendai-half-redis-exporter-node02:
image: oliver006/redis_exporter:v1.73.0
profiles: ["observability"]
restart: unless-stopped
networks:
- half
command: >
--redis.addr redis://:${REDIS_PASSWORD:-develove}@backendai-half-redis-node02:${REDIS_SLAVE1_PORT}
--include-system-metrics
--include-config-metrics
--include-modules-metrics
ports:
- "9122:9121"
depends_on:
- backendai-half-redis-node02
backendai-half-redis-exporter-node03:
image: oliver006/redis_exporter:v1.73.0
profiles: ["observability"]
restart: unless-stopped
networks:
- half
command: >
--redis.addr redis://:${REDIS_PASSWORD:-develove}@backendai-half-redis-node03:${REDIS_SLAVE2_PORT}
--include-system-metrics
--include-config-metrics
--include-modules-metrics
ports:
- "9123:9121"
depends_on:
- backendai-half-redis-node03
# Initial master is redis-node01.
backendai-half-redis-node01:
image: redis:7.2.11-alpine
hostname: node01
networks:
- half
ports:
- 0.0.0.0:${REDIS_MASTER_PORT}:${REDIS_MASTER_PORT}
command: >
redis-server
--port ${REDIS_MASTER_PORT}
--requirepass ${REDIS_PASSWORD:-develove}
--masterauth ${REDIS_PASSWORD:-develove}
--replica-announce-ip node01
--replica-announce-port ${REDIS_MASTER_PORT}
--min-slaves-to-write 1
--min-slaves-max-lag 10
# IMPORTANT: We have INTENTIONALLY OMITTED the healthchecks
# because it interferes with pause/unpause of container to simulate
# network partitioning.
backendai-half-redis-node02:
image: redis:7.2.11-alpine
hostname: node02
networks:
- half
ports:
- 0.0.0.0:${REDIS_SLAVE1_PORT}:${REDIS_SLAVE1_PORT}
command: >
redis-server
--port ${REDIS_SLAVE1_PORT}
--requirepass ${REDIS_PASSWORD:-develove}
--masterauth ${REDIS_PASSWORD:-develove}
--slaveof node01 ${REDIS_MASTER_PORT}
--replica-announce-ip node02
--replica-announce-port ${REDIS_SLAVE1_PORT}
--min-slaves-to-write 1
--min-slaves-max-lag 10
backendai-half-redis-node03:
image: redis:7.2.11-alpine
hostname: node03
ports:
- 0.0.0.0:${REDIS_SLAVE2_PORT}:${REDIS_SLAVE2_PORT}
networks:
- half
command: >
redis-server
--port ${REDIS_SLAVE2_PORT}
--requirepass ${REDIS_PASSWORD:-develove}
--masterauth ${REDIS_PASSWORD:-develove}
--slaveof node01 ${REDIS_MASTER_PORT}
--replica-announce-ip node03
--replica-announce-port ${REDIS_SLAVE2_PORT}
--min-slaves-to-write 1
--min-slaves-max-lag 10
backendai-half-redis-sentinel01:
image: redis:7.2.11-alpine
hostname: sentinel01
networks:
- half
volumes:
- type: bind
source: ${COMPOSE_PATH}
target: /config
ports:
- 0.0.0.0:${REDIS_SENTINEL1_PORT}:${REDIS_SENTINEL1_PORT}
depends_on:
- backendai-half-redis-node01
- backendai-half-redis-node02
- backendai-half-redis-node03
command: >
redis-sentinel /config/sentinel01.conf
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-develove}
backendai-half-redis-sentinel02:
image: redis:7.2.11-alpine
hostname: sentinel02
networks:
- half
volumes:
- type: bind
source: ${COMPOSE_PATH}
target: /config
ports:
- 0.0.0.0:${REDIS_SENTINEL2_PORT}:${REDIS_SENTINEL2_PORT}
depends_on:
- backendai-half-redis-node01
- backendai-half-redis-node02
- backendai-half-redis-node03
command: >
redis-sentinel /config/sentinel02.conf
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-develove}
backendai-half-redis-sentinel03:
image: redis:7.2.11-alpine
hostname: sentinel03
networks:
- half
volumes:
- type: bind
source: ${COMPOSE_PATH}
target: /config
ports:
- 0.0.0.0:${REDIS_SENTINEL3_PORT}:${REDIS_SENTINEL3_PORT}
depends_on:
- backendai-half-redis-node01
- backendai-half-redis-node02
- backendai-half-redis-node03
command: >
redis-sentinel /config/sentinel03.conf
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-develove}
backendai-half-etcd-proxy:
image: quay.io/coreos/etcd:v3.5.4
depends_on:
- "backendai-half-etcd-node01"
- "backendai-half-etcd-node02"
- "backendai-half-etcd-node03"
networks:
- half
ports:
- "8220:2379"
environment:
- ENDPOINTS=backendai-half-etcd-node01:2379,backendai-half-etcd-node02:2379,backendai-half-etcd-node03:2379
command: >
sh -c
"/usr/local/bin/etcd grpc-proxy start
--endpoints=$${ENDPOINTS}
--listen-addr=0.0.0.0:2379"
backendai-half-etcd-node01:
image: quay.io/coreos/etcd:v3.5.4
volumes:
- "./tmp/backend.ai-halfstack-ha/etcd01-data:/etcd-data:rw"
networks:
- half
environment:
- MYSELF=backendai-half-etcd-node01
- CLUSTER=etcd-node01=http://backendai-half-etcd-node01:2380,etcd-node02=http://backendai-half-etcd-node02:2380,etcd-node03=http://backendai-half-etcd-node03:2380
- TOKEN=backendai-etcd-token
- STATE=new
command: >
sh -c
"/usr/local/bin/etcd
--name etcd-node01
--data-dir /etcd-data
--listen-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--advertise-client-urls http://$${MYSELF}:2379
--initial-advertise-peer-urls http://$${MYSELF}:2380
--initial-cluster $${CLUSTER}
--initial-cluster-token $${TOKEN}
--initial-cluster-state $${STATE}"
backendai-half-etcd-node02:
image: quay.io/coreos/etcd:v3.5.4
volumes:
- "./tmp/backend.ai-halfstack-ha/etcd02-data:/etcd-data:rw"
networks:
- half
environment:
- MYSELF=backendai-half-etcd-node02
- CLUSTER=etcd-node01=http://backendai-half-etcd-node01:2380,etcd-node02=http://backendai-half-etcd-node02:2380,etcd-node03=http://backendai-half-etcd-node03:2380
- TOKEN=backendai-etcd-token
- STATE=new
command: >
sh -c
"/usr/local/bin/etcd
--name etcd-node02
--data-dir /etcd-data
--listen-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--advertise-client-urls http://$${MYSELF}:2379
--initial-advertise-peer-urls http://$${MYSELF}:2380
--initial-cluster $${CLUSTER}
--initial-cluster-token $${TOKEN}
--initial-cluster-state $${STATE}"
backendai-half-etcd-node03:
image: quay.io/coreos/etcd:v3.5.4
volumes:
- "./tmp/backend.ai-halfstack-ha/etcd03-data:/etcd-data:rw"
networks:
- half
environment:
- MYSELF=backendai-half-etcd-node03
- CLUSTER=etcd-node01=http://backendai-half-etcd-node01:2380,etcd-node02=http://backendai-half-etcd-node02:2380,etcd-node03=http://backendai-half-etcd-node03:2380
- TOKEN=backendai-etcd-token
- STATE=new
command: >
sh -c
"/usr/local/bin/etcd
--name etcd-node03
--data-dir /etcd-data
--listen-client-urls http://0.0.0.0:2379
--listen-peer-urls http://0.0.0.0:2380
--advertise-client-urls http://$${MYSELF}:2379
--initial-advertise-peer-urls http://$${MYSELF}:2380
--initial-cluster $${CLUSTER}
--initial-cluster-token $${TOKEN}
--initial-cluster-state $${STATE}"
backendai-half-grafana:
image: grafana/grafana-enterprise:11.4.0
profiles: ["observability"]
restart: unless-stopped
networks:
- half
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=backend
- GF_SECURITY_ADMIN_PASSWORD=develove
volumes:
- half-grafana:/var/lib/grafana:rw
- "./configs/grafana/dashboards:/var/lib/grafana/dashboards:ro"
- "./configs/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards:ro"
- "./configs/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources:ro"
backendai-half-pyroscope:
image: grafana/pyroscope:1.9.2
profiles: ["observability"]
restart: unless-stopped
networks:
- half
ports:
- "4040:4040"
volumes:
- half-pyroscope:/var/lib/pyroscope:rw
backendai-half-prometheus:
image: prom/prometheus:v3.1.0
restart: unless-stopped
networks:
- half
volumes:
- "./prometheus.yaml:/etc/prometheus/prometheus.yaml"
extra_hosts:
- "host.docker.internal:host-gateway"
command:
- '--config.file=/etc/prometheus/prometheus.yaml'
ports:
- "9090:9090"
backendai-half-otel-collector:
image: otel/opentelemetry-collector-contrib:0.126.0
profiles: ["telemetry", "observability"]
networks:
- half
command: ["--config=/etc/otel-collector-config.yaml"]
volumes:
- ./configs/otel/otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "4317:4317"
- "4318:4318"
backendai-half-loki:
image: grafana/loki:3.5.0
profiles: ["telemetry", "observability"]
networks:
- half
command: -config.file=/etc/loki/local-config.yaml
ports:
- "3100:3100"
volumes:
- ./configs/loki/loki-config.yaml:/etc/loki/local-config.yaml
backendai-half-tempo:
image: grafana/tempo:2.7.2
profiles: ["observability"]
networks:
- half
command: [ "-config.file=/etc/tempo.yaml" ]
volumes:
- ./configs/tempo/tempo-config.yaml:/etc/tempo.yaml
- half-tempo:/var/tempo
ports:
- "3200" # tempo
- "4317" # otlp grpc
backendai-half-apollo-router:
image: ghcr.io/graphql-hive/gateway:2.1.12
restart: unless-stopped
networks:
- half
ports:
- "4000:4000"
command: ["supergraph"]
environment:
- HOST=0.0.0.0
- PORT=4000
volumes:
- ./docs/manager/graphql-reference/supergraph.graphql:/gateway/supergraph.graphql:ro
- ./configs/graphql/gateway.config.ts:/gateway/gateway.config.ts:ro
extra_hosts:
- "host.docker.internal:host-gateway"
backendai-half-minio:
image: minio/minio:latest
profiles: ["storage"]
restart: unless-stopped
networks:
- half
ports:
- "9000:9000" # API port
- "9001:9001" # Console port
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
volumes:
- half-minio:/data:rw
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 5s
timeout: 3s
retries: 10
networks:
half:
volumes:
half-grafana:
half-pyroscope:
half-tempo:
half-minio: