-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
309 lines (287 loc) · 8.91 KB
/
docker-compose.yml
File metadata and controls
309 lines (287 loc) · 8.91 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
# VC Stack - Local Development Docker Compose
#
# IMPORTANT: Copy .env.example to .env and set secure credentials before use.
#
# Usage:
# cp .env.example .env && vim .env # Set DB_PASS, JWT_SECRET, etc.
# docker compose up -d # Start ALL services
# docker compose down -v # Stop and remove volumes
services:
# ---- PostgreSQL ----
postgres:
image: postgres:15-alpine
platform: linux/arm64
container_name: vc-stack-postgres
environment:
POSTGRES_DB: ${DB_NAME:-vcstack}
POSTGRES_USER: ${DB_USER:-vcstack}
POSTGRES_PASSWORD: ${DB_PASS:-vcstack-dev-password}
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
volumes:
- postgres_data:/var/lib/postgresql
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U vcstack -d vcstack" ]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- vc-stack
# ---- vc-management ----
vc-management:
build:
context: .
target: vc-management
platforms:
- linux/arm64
platform: linux/arm64
container_name: vc-stack-management
depends_on:
postgres:
condition: service_healthy
environment:
DB_HOST: postgres
DB_NAME: ${DB_NAME:-vcstack}
DB_USER: ${DB_USER:-vcstack}
DB_PASS: ${DB_PASS:-vcstack-dev-password}
JWT_SECRET: ${JWT_SECRET:-dev-secret-do-not-use-in-production}
VC_MANAGEMENT_PORT: "8080"
ADMIN_DEFAULT_PASSWORD: ${ADMIN_DEFAULT_PASSWORD:-ChangeMe123!}
LOGGING_LEVEL: ${LOGGING_LEVEL:-debug}
LOGGING_FORMAT: ${LOGGING_FORMAT:-text}
# SDN / OVN configuration
OVN_NB_ADDRESS: "tcp:ovn-central:6641"
VC_BRIDGE_MAPPINGS: "provider:br-provider,external:br-ex"
# InfluxDB (metrics collector backend)
INFLUXDB_URL: ${INFLUXDB_URL:-http://influxdb:8086}
INFLUXDB_TOKEN: ${INFLUXDB_TOKEN:-vc-stack-monitoring-token-dev}
INFLUXDB_ORG: ${INFLUXDB_ORG:-vc-stack}
INFLUXDB_BUCKET: ${INFLUXDB_BUCKET:-monitoring}
networks:
- vc-stack
volumes:
- vcstack_images:/tmp/vcstack/images
restart: unless-stopped
# ---- Nginx reverse proxy ----
nginx:
image: nginx:1.27-alpine
platform: linux/arm64
container_name: vc-stack-nginx
depends_on:
- vc-management
ports:
- "80:80"
volumes:
- ./configs/nginx/vc-stack.conf:/etc/nginx/conf.d/default.conf:ro
networks:
- vc-stack
restart: unless-stopped
# ---- OVN Central (NB + SB databases) ----
ovn-central:
image: debian:bookworm-slim
platform: linux/arm64
container_name: vc-stack-ovn-central
command: >
bash -c "
apt-get update -qq && apt-get install -y -qq ovn-central > /dev/null 2>&1 &&
mkdir -p /var/run/ovn /var/lib/ovn /var/log/ovn &&
/usr/share/ovn/scripts/ovn-ctl start_northd &&
ovn-nbctl set-connection ptcp:6641:0.0.0.0 &&
ovn-sbctl set-connection ptcp:6642:0.0.0.0 &&
echo '[ovn-central] OVN NB/SB databases listening on tcp:6641/6642' &&
tail -f /var/log/ovn/ovn-northd.log
"
healthcheck:
test: [ "CMD-SHELL", "ovn-nbctl --timeout=3 show > /dev/null 2>&1 || exit 1" ]
interval: 10s
timeout: 5s
start_period: 30s
retries: 5
networks:
- vc-stack
restart: unless-stopped
# ---- vc-compute (auto-detects KVM or uses QEMU TCG) ----
vc-compute:
build:
context: .
target: vc-compute
platforms:
- linux/arm64
platform: linux/arm64
container_name: vc-stack-compute
depends_on:
postgres:
condition: service_healthy
ovn-central:
condition: service_healthy
environment:
DB_HOST: postgres
DB_NAME: ${DB_NAME:-vcstack}
DB_USER: ${DB_USER:-vcstack}
DB_PASS: ${DB_PASS:-vcstack-dev-password}
VC_COMPUTE_PORT: "8081"
NODE_NAME: dev-compute-1
CONTROLLER_URL: http://vc-management:8080
IMAGES_BACKEND: local
IMAGES_LOCAL_PATH: /var/lib/vcstack/images
VOLUMES_BACKEND: local
VOLUMES_LOCAL_PATH: /var/lib/vcstack/volumes
# OVN networking
NETWORK_OVN_SB_ADDRESS: "tcp:ovn-central:6642"
OVN_NB_ADDRESS: "tcp:ovn-central:6641"
NETWORK_ENCAP_TYPE: geneve
VC_BRIDGE_MAPPINGS: "provider:br-provider"
LOGGING_LEVEL: debug
LOGGING_FORMAT: text
VC_METADATA_PORT: "8082"
privileged: true
volumes:
- vcstack_images:/tmp/vcstack/images
- vcstack_vm_config:/etc/vc-compute/vms
- vcstack_vm_run:/var/run/vc-compute
- vcstack_volumes:/var/lib/vcstack/volumes
networks:
- vc-stack
restart: unless-stopped
# ===========================================================================
# Monitoring Stack
# ===========================================================================
# ---- Prometheus ----
prometheus:
image: prom/prometheus:v2.53.0
platform: linux/arm64
container_name: vc-stack-prometheus
depends_on:
- vc-management
ports:
- "9091:9090"
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=15d'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- '--web.enable-lifecycle'
volumes:
- ./monitoring/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/prometheus/rules:/etc/prometheus/rules:ro
- prometheus_data:/prometheus
networks:
- vc-stack
restart: unless-stopped
# ---- Grafana ----
grafana:
image: grafana/grafana:11.1.0
platform: linux/arm64
container_name: vc-stack-grafana
depends_on:
- prometheus
ports:
- "3001:3000"
environment:
GF_SECURITY_ADMIN_USER: ${GF_ADMIN_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: ${GF_ADMIN_PASSWORD:?Set GF_ADMIN_PASSWORD in .env}
GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH: /var/lib/grafana/dashboards/cluster-overview.json
GF_INSTALL_PLUGINS: ""
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro
networks:
- vc-stack
restart: unless-stopped
# ---- InfluxDB (time-series metrics backend) ----
influxdb:
image: influxdb:2.7
platform: linux/arm64
container_name: vc-stack-influxdb
ports:
- "8086:8086"
environment:
DOCKER_INFLUXDB_INIT_MODE: setup
DOCKER_INFLUXDB_INIT_USERNAME: ${INFLUXDB_ADMIN_USER:-admin}
DOCKER_INFLUXDB_INIT_PASSWORD: ${INFLUXDB_ADMIN_PASSWORD:?Set INFLUXDB_ADMIN_PASSWORD in .env}
DOCKER_INFLUXDB_INIT_ORG: ${INFLUXDB_ORG:-vc-stack}
DOCKER_INFLUXDB_INIT_BUCKET: ${INFLUXDB_BUCKET:-monitoring}
DOCKER_INFLUXDB_INIT_RETENTION: 30d
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${INFLUXDB_TOKEN:-vc-stack-monitoring-token-dev}
volumes:
- influxdb_data:/var/lib/influxdb2
- influxdb_config:/etc/influxdb2
healthcheck:
test: [ "CMD", "influx", "ping" ]
interval: 10s
timeout: 5s
start_period: 15s
retries: 5
networks:
- vc-stack
restart: unless-stopped
# ---- Alertmanager ----
alertmanager:
image: prom/alertmanager:v0.27.0
platform: linux/arm64
container_name: vc-stack-alertmanager
ports:
- "9093:9093"
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
volumes:
- ./configs/alertmanager:/etc/alertmanager:ro
networks:
- vc-stack
restart: unless-stopped
# ---- PostgreSQL Exporter ----
postgres-exporter:
image: prometheuscommunity/postgres-exporter:v0.16.0
platform: linux/arm64
container_name: vc-stack-postgres-exporter
depends_on:
postgres:
condition: service_healthy
environment:
DATA_SOURCE_NAME: "postgresql://${DB_USER:-vcstack}:${DB_PASS:-vcstack-dev-password}@postgres:5432/${DB_NAME:-vcstack}?sslmode=disable"
ports:
- "9187:9187"
networks:
- vc-stack
restart: unless-stopped
# ---- Node Exporter (host-level metrics) ----
node-exporter:
image: prom/node-exporter:v1.8.0
platform: linux/arm64
container_name: vc-stack-node-exporter
ports:
- "9100:9100"
command:
- '--path.rootfs=/host'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
volumes:
- /:/host:ro,rslave
pid: host
networks:
- vc-stack
restart: unless-stopped
volumes:
postgres_data:
driver: local
vcstack_images:
driver: local
vcstack_vm_config:
driver: local
vcstack_vm_run:
driver: local
vcstack_volumes:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local
influxdb_data:
driver: local
influxdb_config:
driver: local
networks:
vc-stack:
driver: bridge