-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
224 lines (217 loc) · 7.64 KB
/
Copy pathdocker-compose.yml
File metadata and controls
224 lines (217 loc) · 7.64 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
# Codeintel local dev stack — full infrastructure (Phase A.1 of
# the re-prioritized port plan, see
# docs/codeintel-port-gap-inventory.md §7).
#
# Services (all bound to 127.0.0.1 to avoid conflict with whatever
# the host already runs):
#
# - codeintel-postgres on 127.0.0.1:5433 (different from the
# legacy compose's
# 5432 so both can
# coexist during
# migration)
# - codeintel-redis on 127.0.0.1:6380 (different from 6379)
# - codeintel-nebula-* on 127.0.0.1:9559/9669/9779 + 19xxx
# (standard Nebula
# ports; no legacy
# conflict)
#
# Use the Makefile in this directory for the supported lifecycle
# commands:
#
# make stack-up — bring up + wait for all healthy
# make stack-down — graceful shutdown, keep data volumes
# make stack-down-volumes — full wipe (data lost; use with care)
# make stack-healthcheck — non-zero exit if any service isn't
# responding to a real client probe
# (pg_isready / redis PING / nebula
# SHOW HOSTS). This is the Phase A.1
# E2E gate.
#
# Bring up + smoke-test the Nebula track only (legacy slice 39):
#
# make stack-up
# CODEINTEL_NEBULA_ADDR=127.0.0.1:9669 \
# go test ./internal/nebulasmoke/... -run Smoke -v
#
# The Go smoke tests self-skip when CODEINTEL_NEBULA_ADDR is unset
# so the default `go test ./...` invocation stays green in CI
# without Docker.
services:
# Postgres backs every codeintel binary that touches durable
# state: codeintel-app (the read path on /api/repos, /api/status,
# /api/connections, etc.) and codeintel-backend (the audit
# AuditEvent table, the future queue-worker status tables).
# Port 5433 instead of 5432 so the legacy docker-compose-dev.yml
# (which uses 5432) can run alongside without conflict during
# the migration.
codeintel-postgres:
image: postgres:16-alpine
container_name: codeintel-postgres
restart: unless-stopped
environment:
POSTGRES_USER: codeintel
POSTGRES_PASSWORD: codeintel
POSTGRES_DB: codeintel
ports:
- "127.0.0.1:5433:5432"
volumes:
- codeintel-postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U codeintel -d codeintel"]
interval: 5s
timeout: 3s
retries: 20
# Redis hosts the asynq queue backend (BullMQ → asynq decision
# recorded in docs/codeintel-port-gap-inventory.md §3.1). Port
# 6380 instead of 6379 so the legacy compose's Redis can coexist
# during the migration. AOF persistence is on so a stack restart
# keeps in-flight queue state.
codeintel-redis:
image: redis:7-alpine
container_name: codeintel-redis
restart: unless-stopped
command: ["redis-server", "--appendonly", "yes"]
ports:
- "127.0.0.1:6380:6379"
volumes:
- codeintel-redis-data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 20
# NebulaGraph 3.x single-node topology: one metad (cluster
# metadata), one storaged (storage engine), one graphd (query
# entrypoint). For local dev, single-node is sufficient — the
# production deploy uses the Helm chart's HA topology.
nebula-metad:
image: vesoft/nebula-metad:v3.8.0
container_name: codeintel-nebula-metad
environment:
USER: root
TZ: UTC
command:
- --meta_server_addrs=codeintel-nebula-metad:9559
- --local_ip=codeintel-nebula-metad
- --ws_ip=0.0.0.0
- --port=9559
- --data_path=/data/meta
- --log_dir=/logs
- --v=0
- --minloglevel=0
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:19559/status"]
interval: 5s
timeout: 3s
retries: 20
ports:
- "127.0.0.1:9559:9559"
- "127.0.0.1:19559:19559"
volumes:
- codeintel-nebula-metad-data:/data/meta
- codeintel-nebula-metad-logs:/logs
restart: on-failure
# Storaged has a chicken-and-egg dependency on metad: its HTTP
# /status endpoint only becomes reachable after the host is
# registered with metad via `ADD HOSTS`. The nebula-console-init
# service (below) performs that registration on first bring-up.
# We use `depends_on: condition: service_started` (not
# service_healthy) on the storaged dependency for that reason —
# storaged can't reach `healthy` until console-init has run, but
# console-init needs storaged to be already listening so the
# `ADD HOSTS` resolves to a running peer.
nebula-storaged:
image: vesoft/nebula-storaged:v3.8.0
container_name: codeintel-nebula-storaged
environment:
USER: root
TZ: UTC
command:
- --meta_server_addrs=codeintel-nebula-metad:9559
- --local_ip=codeintel-nebula-storaged
- --ws_ip=0.0.0.0
- --port=9779
- --data_path=/data/storage
- --log_dir=/logs
- --v=0
- --minloglevel=0
depends_on:
nebula-metad:
condition: service_healthy
ports:
- "127.0.0.1:9779:9779"
- "127.0.0.1:19779:19779"
volumes:
- codeintel-nebula-storaged-data:/data/storage
- codeintel-nebula-storaged-logs:/logs
restart: on-failure
nebula-graphd:
image: vesoft/nebula-graphd:v3.8.0
container_name: codeintel-nebula-graphd
environment:
USER: root
TZ: UTC
command:
- --meta_server_addrs=codeintel-nebula-metad:9559
- --port=9669
- --local_ip=codeintel-nebula-graphd
- --ws_ip=0.0.0.0
- --log_dir=/logs
- --v=0
- --minloglevel=0
depends_on:
nebula-metad:
condition: service_healthy
nebula-storaged:
condition: service_started
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:19669/status"]
interval: 5s
timeout: 3s
retries: 20
ports:
- "127.0.0.1:9669:9669"
- "127.0.0.1:19669:19669"
volumes:
- codeintel-nebula-graphd-logs:/logs
restart: on-failure
# One-shot init: registers the storaged host with metad via the
# `ADD HOSTS` nGQL statement. Nebula 3.x requires explicit host
# registration before storaged can heartbeat successfully (the
# `Machine not existed!` log message is the diagnostic). The
# nebula-console image is the canonical client for this step.
#
# Service exits 0 on success so its containers don't restart;
# idempotency is provided by Nebula itself (ADD HOSTS on an
# already-registered host is a no-op error that the script
# tolerates).
nebula-console-init:
image: vesoft/nebula-console:v3.8.0
container_name: codeintel-nebula-console-init
depends_on:
nebula-graphd:
condition: service_healthy
restart: "no"
entrypoint:
- sh
- -c
- |
for i in $$(seq 1 30); do
if /usr/local/bin/nebula-console -addr codeintel-nebula-graphd -port 9669 -u root -p nebula -e 'ADD HOSTS "codeintel-nebula-storaged":9779' 2>&1; then
echo "ADD HOSTS succeeded on attempt $$i"
exit 0
fi
echo "ADD HOSTS attempt $$i failed; retrying in 2s"
sleep 2
done
echo "ADD HOSTS failed after 30 attempts"
exit 1
volumes:
codeintel-postgres-data:
codeintel-redis-data:
codeintel-nebula-metad-data:
codeintel-nebula-metad-logs:
codeintel-nebula-storaged-data:
codeintel-nebula-storaged-logs:
codeintel-nebula-graphd-logs: