-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
385 lines (367 loc) · 13.6 KB
/
docker-compose.yml
File metadata and controls
385 lines (367 loc) · 13.6 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
# =============================================================================
# TelemetryFlow Platform - Docker Compose Configuration
# =============================================================================
#
# PROFILES:
# core - Infrastructure services (Postgres, ClickHouse, Redis, NATS)
# plus backend and frontend
# monitoring - OpenTelemetry Collector, TFO-Agent
# tools - Portainer management UI
# all - Everything: core + monitoring + tools
# all-in - Core with OTEL-instrumented backend/frontend variants
#
# USAGE EXAMPLES:
# # Start core platform only (dev default):
# docker compose --profile core up -d
#
# # Start with monitoring stack:
# docker compose --profile core --profile monitoring up -d
#
# # Start everything:
# docker compose --profile all up -d
#
# # Start all-in-one with built-in OTEL instrumentation:
# docker compose --profile all-in --profile monitoring --profile tools up -d
#
# QUICK START:
# 1. Copy .env.example to .env:
# cp .env.example .env
# 2. Generate secrets:
# sed -i '' 's/^JWT_SECRET=$/JWT_SECRET='$(openssl rand -hex 32)'/' .env
# sed -i '' 's/^SESSION_SECRET=$/SESSION_SECRET='$(openssl rand -hex 32)'/' .env
# 3. Start the platform:
# docker compose --profile core up -d
# 4. Access:
# Frontend -> http://localhost:${FRONTEND_PORT:-8080}
# Backend -> http://localhost:${BACKEND_PORT:-3000}
# Portainer -> http://localhost:${PORTAINER_PORT:-9000} (tools profile)
#
# =============================================================================
networks:
telemetryflow_platform_net:
driver: bridge
ipam:
config:
- subnet: 172.151.0.0/16
volumes:
postgres_data:
driver: local
clickhouse_data:
driver: local
redis_data:
driver: local
nats_data:
driver: local
portainer_data:
driver: local
backend_logs:
driver: local
services:
# ===========================================================================
# INFRASTRUCTURE SERVICES (profiles: core, all)
# ===========================================================================
postgres:
image: postgres:${POSTGRES_VERSION:-16-alpine}
profiles: ["core", "all"]
container_name: ${POSTGRES_CONTAINER_NAME:-telemetryflow-postgres}
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB:-telemetryflow}
POSTGRES_USER: ${POSTGRES_USER:-telemetryflow}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "${POSTGRES_PORT:-5432}:5432"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/postgres/data:/var/lib/postgresql/data
networks:
telemetryflow_platform_net:
ipv4_address: ${POSTGRES_IP:-172.151.151.20}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-telemetryflow} -d ${POSTGRES_DB:-telemetryflow}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
clickhouse:
image: clickhouse/clickhouse-server:${CLICKHOUSE_VERSION:-latest}
profiles: ["core", "all"]
container_name: ${CLICKHOUSE_CONTAINER_NAME:-telemetryflow-clickhouse}
restart: unless-stopped
environment:
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-telemetryflow}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1
ports:
- "${CLICKHOUSE_HTTP_PORT:-8123}:8123"
- "${CLICKHOUSE_TCP_PORT:-9000}:9000"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/clickhouse/data:/var/lib/clickhouse
- ${VOLUMES_BASE_PATH:-./volumes}/clickhouse/logs:/var/log/clickhouse-server
networks:
telemetryflow_platform_net:
ipv4_address: ${CLICKHOUSE_IP:-172.151.151.40}
healthcheck:
test: ["CMD-SHELL", "wget --spider --tries 1 http://localhost:8123/ping || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
ulimits:
nofile:
soft: 262144
hard: 262144
redis:
image: redis:${REDIS_VERSION:-7-alpine}
profiles: ["core", "all"]
container_name: ${REDIS_CONTAINER_NAME:-telemetryflow-redis}
restart: unless-stopped
command: >
redis-server
--requirepass ${REDIS_PASSWORD:-}
--maxmemory ${REDIS_MAXMEMORY:-256mb}
--maxmemory-policy allkeys-lru
--appendonly yes
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/redis/data:/data
networks:
telemetryflow_platform_net:
ipv4_address: ${REDIS_IP:-172.151.151.50}
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-}", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
nats:
image: nats:${NATS_VERSION:-2-alpine}
profiles: ["core", "all"]
container_name: ${NATS_CONTAINER_NAME:-telemetryflow-nats}
restart: unless-stopped
command: >
-js
--store_dir /data
--cluster_name ${NATS_CLUSTER_NAME:-telemetryflow-cluster}
--max_mem_store ${NATS_MAX_MEM_STORE:-256MB}
--max_file_store ${NATS_MAX_FILE_STORE:-1GB}
ports:
- "${NATS_CLIENT_PORT:-4222}:4222"
- "${NATS_MANAGEMENT_PORT:-8222}:8222"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/nats/data:/data
networks:
telemetryflow_platform_net:
ipv4_address: ${NATS_IP:-172.151.151.55}
healthcheck:
test: ["CMD-SHELL", "wget --spider --tries 1 http://localhost:8222/healthz || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
# ===========================================================================
# APPLICATION SERVICES (profiles: core, all-in)
# ===========================================================================
backend:
image: ${BACKEND_IMAGE:-telemetryflow/telemetryflow-platform}:${BACKEND_VERSION:-latest}
profiles: ["core"]
container_name: ${BACKEND_CONTAINER_NAME:-telemetryflow-backend}
restart: unless-stopped
env_file:
- .env
environment:
NODE_ENV: ${NODE_ENV:-development}
PORT: 3000
POSTGRES_HOST: ${POSTGRES_IP:-172.151.151.20}
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-telemetryflow}
POSTGRES_USER: ${POSTGRES_USER:-telemetryflow}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
CLICKHOUSE_HOST: ${CLICKHOUSE_IP:-172.151.151.40}
CLICKHOUSE_PORT: 9000
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-telemetryflow}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
REDIS_HOST: ${REDIS_IP:-172.151.151.50}
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
NATS_URL: nats://${NATS_IP:-172.151.151.55}:4222
JWT_SECRET: ${JWT_SECRET:-}
SESSION_SECRET: ${SESSION_SECRET:-}
LLM_ENCRYPTION_KEY: ${LLM_ENCRYPTION_KEY:-}
API_KEY: ${API_KEY:-}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:${FRONTEND_PORT:-8080}}
ports:
- "${BACKEND_PORT:-3000}:3000"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/backend/logs:/app/logs
networks:
telemetryflow_platform_net:
ipv4_address: ${BACKEND_IP:-172.151.151.10}
depends_on:
postgres:
condition: service_healthy
clickhouse:
condition: service_healthy
redis:
condition: service_healthy
nats:
condition: service_healthy
backend-with-monitoring:
image: ${BACKEND_IMAGE:-telemetryflow/telemetryflow-platform}:${BACKEND_VERSION:-latest}
profiles: ["all-in"]
container_name: ${BACKEND_CONTAINER_NAME:-telemetryflow-backend}-monitored
restart: unless-stopped
env_file:
- .env
environment:
NODE_ENV: ${NODE_ENV:-development}
PORT: 3000
OTEL_ENABLED: "true"
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-telemetryflow-backend}
OTEL_EXPORTER_OTLP_ENDPOINT: http://${TFO_COLLECTOR_IP:-172.151.151.30}:4317
OTEL_EXPORTER_OTLP_PROTOCOL: ${OTEL_EXPORTER_OTLP_PROTOCOL:-grpc}
POSTGRES_HOST: ${POSTGRES_IP:-172.151.151.20}
POSTGRES_PORT: 5432
POSTGRES_DB: ${POSTGRES_DB:-telemetryflow}
POSTGRES_USER: ${POSTGRES_USER:-telemetryflow}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-}
CLICKHOUSE_HOST: ${CLICKHOUSE_IP:-172.151.151.40}
CLICKHOUSE_PORT: 9000
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-telemetryflow}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
REDIS_HOST: ${REDIS_IP:-172.151.151.50}
REDIS_PORT: 6379
REDIS_PASSWORD: ${REDIS_PASSWORD:-}
NATS_URL: nats://${NATS_IP:-172.151.151.55}:4222
JWT_SECRET: ${JWT_SECRET:-}
SESSION_SECRET: ${SESSION_SECRET:-}
LLM_ENCRYPTION_KEY: ${LLM_ENCRYPTION_KEY:-}
API_KEY: ${API_KEY:-}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost:${FRONTEND_PORT:-8080}}
ports:
- "${BACKEND_PORT:-3000}:3000"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/backend/logs:/app/logs
networks:
telemetryflow_platform_net:
ipv4_address: ${BACKEND_IP:-172.151.151.10}
depends_on:
postgres:
condition: service_healthy
clickhouse:
condition: service_healthy
redis:
condition: service_healthy
nats:
condition: service_healthy
tfo-collector:
condition: service_started
frontend:
image: ${FRONTEND_IMAGE:-telemetryflow/telemetryflow-viz}:${FRONTEND_VERSION:-latest}
profiles: ["core"]
container_name: ${FRONTEND_CONTAINER_NAME:-telemetryflow-frontend}
restart: unless-stopped
environment:
VITE_APP_TITLE: ${VITE_APP_TITLE:-TelemetryFlow}
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:${BACKEND_PORT:-3000}}
VITE_API_KEY: ${VITE_API_KEY:-}
VITE_MOCK_DATA_ENABLED: ${VITE_MOCK_DATA_ENABLED:-false}
VITE_REFRESH_INTERVAL_MS: ${VITE_REFRESH_INTERVAL_MS:-30000}
ports:
- "${FRONTEND_PORT:-8080}:80"
networks:
telemetryflow_platform_net:
ipv4_address: ${FRONTEND_IP:-172.151.151.15}
depends_on:
backend:
condition: service_started
frontend-with-monitoring:
image: ${FRONTEND_IMAGE:-telemetryflow/telemetryflow-viz}:${FRONTEND_VERSION:-latest}
profiles: ["all-in"]
container_name: ${FRONTEND_CONTAINER_NAME:-telemetryflow-frontend}-monitored
restart: unless-stopped
environment:
VITE_APP_TITLE: ${VITE_APP_TITLE:-TelemetryFlow}
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:${BACKEND_PORT:-3000}}
VITE_API_KEY: ${VITE_API_KEY:-}
VITE_MOCK_DATA_ENABLED: ${VITE_MOCK_DATA_ENABLED:-false}
VITE_REFRESH_INTERVAL_MS: ${VITE_REFRESH_INTERVAL_MS:-30000}
VITE_OTEL_ENABLED: "true"
VITE_OTEL_SERVICE_NAME: ${VITE_OTEL_SERVICE_NAME:-telemetryflow-frontend}
VITE_OTEL_COLLECTOR_URL: http://${TFO_COLLECTOR_IP:-172.151.151.30}:4318/v1/traces
ports:
- "${FRONTEND_PORT:-8080}:80"
networks:
telemetryflow_platform_net:
ipv4_address: ${FRONTEND_IP:-172.151.151.15}
depends_on:
backend-with-monitoring:
condition: service_started
# ===========================================================================
# MONITORING SERVICES (profiles: monitoring, all)
# ===========================================================================
tfo-collector:
image: telemetryflow/telemetryflow-collector:${TFO_COLLECTOR_VERSION:-1.2.1}
profiles: ["monitoring", "all", "all-in"]
container_name: ${TFO_COLLECTOR_CONTAINER_NAME:-telemetryflow-collector}
restart: unless-stopped
environment:
COLLECTOR_CONFIG: ${COLLECTOR_CONFIG:-/etc/otelcol/config.yaml}
CLICKHOUSE_HOST: ${CLICKHOUSE_IP:-172.151.151.40}
CLICKHOUSE_PORT: 9000
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-telemetryflow}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-default}
CLICKHOUSE_PASSWORD: ${CLICKHOUSE_PASSWORD:-}
ports:
- "${OTEL_GRPC_PORT:-4317}:4317"
- "${OTEL_HTTP_PORT:-4318}:4318"
- "${OTEL_METRICS_PORT:-8889}:8889"
- "${OTEL_HEALTH_PORT:-13133}:13133"
volumes:
- ${VOLUMES_BASE_PATH:-./volumes}/collector/config:/etc/otelcol
networks:
telemetryflow_platform_net:
ipv4_address: ${TFO_COLLECTOR_IP:-172.151.151.30}
tfo-agent:
image: telemetryflow/telemetryflow-agent:${TFO_AGENT_VERSION:-1.2.0}
profiles: ["monitoring", "all"]
container_name: ${TFO_AGENT_CONTAINER_NAME:-telemetryflow-agent}
restart: unless-stopped
environment:
TFO_AGENT_VERSION: ${TFO_AGENT_VERSION:-1.2.0}
TFO_COLLECTOR_URL: http://${TFO_COLLECTOR_IP:-172.151.151.30}:4317
TFO_AGENT_SCRAPE_INTERVAL: ${TFO_AGENT_SCRAPE_INTERVAL:-15s}
TFO_AGENT_LOG_LEVEL: ${TFO_AGENT_LOG_LEVEL:-info}
HOST_PROC: /host/proc
HOST_SYS: /host/sys
ports:
- "${TFO_AGENT_PORT:-2025}:2025"
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /var/log:/var/log:ro
networks:
telemetryflow_platform_net:
ipv4_address: ${TFO_AGENT_IP:-172.151.151.35}
# ===========================================================================
# TOOLS (profiles: tools, all)
# ===========================================================================
portainer:
image: portainer/portainer-ce:${PORTAINER_VERSION:-latest}
profiles: ["tools", "all"]
container_name: ${PORTAINER_CONTAINER_NAME:-telemetryflow-portainer}
restart: unless-stopped
command: --no-auth
ports:
- "${PORTAINER_PORT:-9000}:9000"
- "${PORTAINER_TUNNEL_PORT:-9443}:9443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ${VOLUMES_BASE_PATH:-./volumes}/portainer/data:/data
networks:
telemetryflow_platform_net:
ipv4_address: ${PORTAINER_IP:-172.151.151.5}