-
Notifications
You must be signed in to change notification settings - Fork 129
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
387 lines (371 loc) · 11.4 KB
/
docker-compose.yml
File metadata and controls
387 lines (371 loc) · 11.4 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
volumes:
aperag-postgres-data: {}
aperag-qdrant-data: {}
aperag-redis-data: {}
aperag-es-data: {}
aperag-neo4j-data: {}
aperag-nebula-meta-data: {}
aperag-nebula-storage-data: {}
aperag-nebula-logs: {}
aperag-shared-data: {}
services:
# ==============================================
# Application Services (Default startup, excluded from infra)
# ==============================================
api: &api
build:
context: .
dockerfile: ./Dockerfile
image: ${REGISTRY:-docker.io}/apecloud/aperag:${VERSION:-v0.0.0-nightly}
container_name: aperag-api
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
es:
condition: service_healthy
volumes:
- ~/.cache:/root/.cache
- aperag-shared-data:/shared
env_file:
- .env
- envs/docker.env.overrides
ports:
- "8000:8000"
command: ["/app/scripts/entrypoint.sh", "/app/scripts/start-api.sh"]
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:8000/health || curl -f http://localhost:8000/docs || exit 1"]
interval: 10s
timeout: 5s
retries: 12 # 12 * 10s = 120s (2 minutes)
start_period: 30s # Give API time to start up before first check
frontend:
build:
context: ./web
dockerfile: ./Dockerfile
image: ${REGISTRY:-docker.io}/apecloud/aperag-frontend:${VERSION:-v0.0.0-nightly}
container_name: aperag-frontend
depends_on:
api:
condition: service_healthy
env_file:
- web/deploy/env.local.template
environment:
- API_SERVER_ENDPOINT=http://api:8000
- API_SERVER_BASE_PATH=/api/v1
ports:
- "3000:3000"
celeryworker:
image: ${REGISTRY:-docker.io}/apecloud/aperag:${VERSION:-v0.0.0-nightly}
build:
context: .
dockerfile: ./Dockerfile
container_name: aperag-celeryworker
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
qdrant:
condition: service_healthy
es:
condition: service_healthy
volumes:
- ~/.cache:/root/.cache
- ./resources:/data/resources
- aperag-shared-data:/shared
env_file:
- .env
- envs/docker.env.overrides
environment:
- NODE_IP=aperag-celeryworker
- APERAG_API_BASE_URL=http://aperag-api:8000
command: ["/app/scripts/entrypoint.sh", "/app/scripts/start-celery-worker.sh"]
celerybeat:
image: ${REGISTRY:-docker.io}/apecloud/aperag:${VERSION:-v0.0.0-nightly}
build:
context: .
dockerfile: ./Dockerfile
container_name: aperag-celerybeat
env_file:
- .env
- envs/docker.env.overrides
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
environment:
- NODE_IP=aperag-celerybeat
command: ["/app/scripts/entrypoint.sh", "/app/scripts/start-celery-beat.sh"]
flower:
image: ${REGISTRY:-docker.io}/apecloud/aperag:${VERSION:-v0.0.0-nightly}
build:
context: .
dockerfile: ./Dockerfile
container_name: aperag-flower
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
env_file:
- .env
- envs/docker.env.overrides
ports:
- "5555:5555"
environment:
- NODE_IP=aperag-flower
command: ["/app/scripts/entrypoint.sh", "/app/scripts/start-celery-flower.sh"]
# ==============================================
# Infrastructure Services (always available)
# ==============================================
postgres:
image: ${REGISTRY:-docker.io}/apecloud/pgvector:pg16
container_name: aperag-postgres
volumes:
- aperag-postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=aperag
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d aperag"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: ${REGISTRY:-docker.io}/apecloud/redis:6
container_name: aperag-redis
volumes:
- aperag-redis-data:/data
ports:
- "6379:6379"
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
interval: 10s
timeout: 3s
retries: 5
start_period: 5s
qdrant:
image: ${REGISTRY:-docker.io}/apecloud/qdrant:v1.13.4
container_name: aperag-qdrant
volumes:
- aperag-qdrant-data:/qdrant/storage
ports:
- "6333:6333"
healthcheck:
test: ["CMD-SHELL", "nc -z localhost 6333 || timeout 3 bash -c '</dev/tcp/localhost/6333' || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
es:
image: ${REGISTRY:-docker.io}/apecloud/elasticsearch:8.8.2
container_name: aperag-es
ports:
- "9200:9200"
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- "xpack.security.enabled=false"
- "ES_REQUIRE_IK_PLUGIN=true"
- "ES_AUTO_INSTALL_IK=true"
- "ES_IK_PLUGIN_URL=https://get.infini.cloud/elasticsearch/analysis-ik/8.8.2"
volumes:
- aperag-es-data:/usr/share/elasticsearch/data
- ./scripts/init-es.sh:/usr/share/elasticsearch/bin/init-es.sh
healthcheck:
test: ["CMD-SHELL", "bash /usr/share/elasticsearch/bin/init-es.sh check"]
interval: 10s
timeout: 5s
retries: 12 # 12 * 10s = 120s (2 minutes)
start_period: 10s # Give ES some time to start up before first check
command: bash /usr/share/elasticsearch/bin/init-es.sh
restart: on-failure
jaeger:
image: jaegertracing/all-in-one:1.60
container_name: aperag-jaeger
ports:
- "16686:16686" # Jaeger UI
- "14268:14268" # HTTP collector
- "14250:14250" # gRPC collector
- "6831:6831/udp" # UDP agent
- "6832:6832/udp" # UDP agent
environment:
- COLLECTOR_OTLP_ENABLED=true
- LOG_LEVEL=info
restart: unless-stopped
profiles: ["jaeger"]
# ==============================================
# Optional Services
# ==============================================
neo4j:
image: neo4j:5.26.5-enterprise
container_name: aperag-neo4j
ports:
- "7474:7474" # HTTP
- "7687:7687" # Bolt
environment:
- NEO4J_AUTH=neo4j/password
- NEO4J_PLUGINS=["apoc"]
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
- NEO4J_apoc_export_file_enabled=true
volumes:
- aperag-neo4j-data:/data
profiles: ["neo4j"]
nebula-metad:
image: vesoft/nebula-metad:v3.8.0
container_name: aperag-nebula-metad
command:
- --meta_server_addrs=nebula-metad:9559
- --local_ip=nebula-metad
- --ws_ip=nebula-metad
- --port=9559
- --ws_http_port=19559
- --data_path=/data/meta
- --logtostderr=true
- --redirect_stdout=false
- --v=0
- --minloglevel=0
healthcheck:
test: ["CMD", "curl", "-sf", "http://nebula-metad:19559/status"]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
ports:
- "9559:9559"
- "19559:19559"
volumes:
- aperag-nebula-meta-data:/data/meta
- aperag-nebula-logs:/logs
restart: on-failure
profiles: ["nebula"]
nebula-storaged:
image: vesoft/nebula-storaged:v3.8.0
container_name: aperag-nebula-storaged
command:
- --meta_server_addrs=nebula-metad:9559
- --local_ip=nebula-storaged
- --ws_ip=nebula-storaged
- --port=9779
- --ws_http_port=19779
- --data_path=/data/storage
- --logtostderr=true
- --redirect_stdout=false
- --v=0
- --minloglevel=0
depends_on:
- nebula-metad
healthcheck:
test: ["CMD", "curl", "-sf", "http://nebula-storaged:19779/status"]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
ports:
- "9779:9779"
- "19779:19779"
volumes:
- aperag-nebula-storage-data:/data/storage
- aperag-nebula-logs:/logs
restart: on-failure
profiles: ["nebula"]
nebula-graphd:
image: vesoft/nebula-graphd:v3.8.0
container_name: aperag-nebula-graphd
command:
- --meta_server_addrs=nebula-metad:9559
- --port=9669
- --local_ip=nebula-graphd
- --ws_ip=nebula-graphd
- --ws_http_port=19669
- --logtostderr=true
- --redirect_stdout=false
- --v=0
- --minloglevel=0
depends_on:
- nebula-storaged
healthcheck:
test: ["CMD", "curl", "-sf", "http://nebula-graphd:19669/status"]
interval: 30s
timeout: 10s
retries: 5
start_period: 20s
ports:
- "9669:9669"
- "19669:19669"
volumes:
- aperag-nebula-logs:/logs
restart: on-failure
profiles: ["nebula"]
nebula-storage-activator:
image: vesoft/nebula-console:v3.8.0
container_name: aperag-nebula-storage-activator
entrypoint: ""
environment:
- ACTIVATOR_RETRY=${ACTIVATOR_RETRY:-30}
command:
- sh
- -c
- |
# Phase 1 — register storaged with metad (ADD HOSTS).
# Returning OK here only means the host is now in metad's
# registry; metad still needs at least one successful heartbeat
# round before it marks the host ONLINE, and CREATE SPACE with
# replica_factor>=1 requires ONLINE hosts — so ADD-HOSTS-success
# alone is not a green light for callers. See Phase 2 below.
registered=0
for i in `seq 1 $$ACTIVATOR_RETRY`; do
output=$$(nebula-console -addr nebula-graphd -port 9669 -u root -p nebula -e 'ADD HOSTS "nebula-storaged":9779' 2>&1)
if [ $$? -eq 0 ]; then
echo "Storage registered via ADD HOSTS."
registered=1
break
fi
if echo "$$output" | grep -q "Existed"; then
echo "Storage already registered (ADD HOSTS returned Existed)."
registered=1
break
fi
if [ $$i -lt $$ACTIVATOR_RETRY ]; then
echo "Attempt $$i/$$ACTIVATOR_RETRY registering storaged; retrying..."
sleep 5
continue
fi
echo "Failed to register storaged after $$ACTIVATOR_RETRY attempts."
echo "$$output"
exit 1
done
if [ "$$registered" -ne 1 ]; then
echo "Storage never got registered; aborting."
exit 1
fi
# Phase 2 — wait until storaged is visible as ONLINE to metad
# via the usual heartbeat cycle. Without this poll, the
# activator can exit 0 while storaged is still OFFLINE, and any
# immediately-following `CREATE SPACE replica_factor=1` call
# fails with "Host not enough!" in metad's placement check.
# This is the Nebula race symptom tracked in task #22.
for i in `seq 1 $$ACTIVATOR_RETRY`; do
status=$$(nebula-console -addr nebula-graphd -port 9669 -u root -p nebula -e 'SHOW HOSTS' 2>&1)
if echo "$$status" | grep -q "ONLINE"; then
echo "Storaged is ONLINE."
exit 0
fi
echo "Storaged not ONLINE yet (attempt $$i/$$ACTIVATOR_RETRY); retrying..."
sleep 5
done
echo "Storaged failed to reach ONLINE status within $$ACTIVATOR_RETRY attempts."
echo "$$status"
exit 1
depends_on:
- nebula-graphd
profiles: ["nebula"]