forked from tbartel74/Vigil-Guard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
371 lines (358 loc) · 13 KB
/
docker-compose.yml
File metadata and controls
371 lines (358 loc) · 13 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
# Main orchestration file for Vigil Guard
# This file starts all services in the correct order
name: vigil-guard
networks:
vigil-net:
driver: bridge
name: vigil-net
services:
# ============================================
# MONITORING STACK (Start first)
# ============================================
clickhouse:
image: clickhouse/clickhouse-server:25.10.1@sha256:24fdba661a4414a67cdfa323807fa57d9c62ab0e815b1d1a4d443caf49092f24
container_name: vigil-clickhouse
ports:
- "${CLICKHOUSE_HTTP_PORT:-8123}:8123"
- "${CLICKHOUSE_TCP_PORT:-9000}:9000"
environment:
CLICKHOUSE_DB: ${CLICKHOUSE_DB:-n8n_logs}
CLICKHOUSE_USER: ${CLICKHOUSE_USER:-admin}
CLICKHOUSE_PASSWORD: "${CLICKHOUSE_PASSWORD:?ERROR - CLICKHOUSE_PASSWORD must be set in .env file}"
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: ${CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT:-1}
# Note: Init scripts run automatically on first start with empty volume
# Volume cleanup in install.sh ensures clean initialization with new password
volumes:
- ./vigil_data/clickhouse:/var/lib/clickhouse
- ./services/monitoring/sql/01-create-tables-v2.sql:/docker-entrypoint-initdb.d/01-create-tables-v2.sql:ro
- ./services/monitoring/sql/02-semantic-embeddings-v2.sql:/docker-entrypoint-initdb.d/02-semantic-embeddings-v2.sql:ro
- ./services/monitoring/sql/03-false-positives-views.sql:/docker-entrypoint-initdb.d/03-false-positives-views.sql:ro
networks:
vigil-net:
aliases:
- clickhouse
restart: unless-stopped
healthcheck:
# Verify ClickHouse server is ready to accept queries
# Note: Table creation via /docker-entrypoint-initdb.d/ happens after server starts
# install.sh verifies table existence separately
test: ["CMD-SHELL", "clickhouse-client --query 'SELECT 1' || exit 1"]
interval: 10s
timeout: 10s
retries: 10
start_period: 30s
grafana:
image: grafana/grafana:12.2.1@sha256:35c41e0fd0295f5d0ee5db7e780cf33506abfaf47686196f825364889dee878b
container_name: vigil-grafana
user: "${GRAFANA_UID:-472}:${GRAFANA_GID:-472}" # Default Grafana user, override in .env for macOS
environment:
GF_INSTALL_PLUGINS: ${GF_INSTALL_PLUGINS:-vertamedia-clickhouse-datasource}
GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER:-admin}
GF_SECURITY_ADMIN_PASSWORD: "${GF_SECURITY_ADMIN_PASSWORD:?ERROR - GF_SECURITY_ADMIN_PASSWORD must be set in .env file}"
GF_SECURITY_ALLOW_EMBEDDING: ${GF_SECURITY_ALLOW_EMBEDDING:-true}
GF_SECURITY_COOKIE_SAMESITE: ${GF_SECURITY_COOKIE_SAMESITE:-none}
GF_SECURITY_COOKIE_SECURE: ${GF_SECURITY_COOKIE_SECURE:-false}
# Disable CSP for iframe embedding (localhost only, not production)
GF_SECURITY_CONTENT_SECURITY_POLICY: ${GF_SECURITY_CONTENT_SECURITY_POLICY:-false}
# Anonymous access required for iframe embeds in Web UI (restricted to Viewer role, read-only)
# Web UI itself is protected by JWT authentication - this only affects embedded dashboards
GF_AUTH_ANONYMOUS_ENABLED: ${GF_AUTH_ANONYMOUS_ENABLED:-true}
GF_AUTH_ANONYMOUS_ORG_ROLE: ${GF_AUTH_ANONYMOUS_ORG_ROLE:-Viewer}
GF_SERVER_ROOT_URL: ${GF_SERVER_ROOT_URL:-http://localhost/grafana}
ports:
- "${GF_SERVER_HTTP_PORT:-3001}:3000"
volumes:
- ./services/monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./vigil_data/grafana:/var/lib/grafana
networks:
vigil-net:
aliases:
- grafana
restart: unless-stopped
depends_on:
clickhouse:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000/api/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
# ============================================
# WORKFLOW ENGINE
# ============================================
n8n:
image: n8nio/n8n:1.121.3@sha256:0a65e6e5995c19e0cf7e83d6b08ffa6c1898e8a53ff1658e6e7b22e68576c673
container_name: vigil-n8n
user: "node"
working_dir: /home/node
restart: unless-stopped
environment:
- TZ=${TZ:-UTC}
- GENERIC_TIMEZONE=${TZ:-UTC}
- N8N_HOST=${N8N_HOST:-localhost}
- NODE_ENV=${NODE_ENV:-production}
- N8N_RELEASE_TYPE=${N8N_RELEASE_TYPE:-stable}
- NODE_FUNCTION_ALLOW_EXTERNAL=axios
ports:
- "${N8N_PORT:-5678}:5678"
volumes:
- ./vigil_data/n8n:/home/node/.n8n
- ./services/workflow/config:/home/node/config:ro
- ./services/workflow/workflows:/home/node/workflows:ro
networks:
vigil-net:
aliases:
- n8n
depends_on:
clickhouse:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "localhost:5678/healthz"]
interval: 30s
timeout: 10s
retries: 3
# ============================================
# WEB UI (Configuration Panel)
# ============================================
web-ui-backend:
build:
context: .
dockerfile: ./services/web-ui/backend/Dockerfile
container_name: vigil-web-ui-backend
environment:
- NODE_ENV=${NODE_ENV:-production}
- PORT=8787
- TARGET_DIR=${TARGET_DIR:-/config}
- CORS_ORIGIN=${CORS_ORIGIN:-http://localhost:*}
- JWT_SECRET=${JWT_SECRET:?ERROR - JWT_SECRET must be set in .env file (min 32 characters)}
- SESSION_SECRET=${SESSION_SECRET:?ERROR - SESSION_SECRET must be set in .env file}
- WEB_UI_ADMIN_PASSWORD=${WEB_UI_ADMIN_PASSWORD:?ERROR - WEB_UI_ADMIN_PASSWORD must be set in .env file (run ./install.sh)}
- JWT_EXPIRES_IN=${JWT_EXPIRES_IN:-24h}
- DATABASE_PATH=/app/data/users.db
- CLICKHOUSE_HOST=${CLICKHOUSE_HOST:-vigil-clickhouse}
- CLICKHOUSE_PORT=${CLICKHOUSE_HTTP_PORT:-8123}
- CLICKHOUSE_USER=${CLICKHOUSE_USER:-admin}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:?ERROR - CLICKHOUSE_PASSWORD must be set in .env file}
- CLICKHOUSE_DATABASE=${CLICKHOUSE_DB:-n8n_logs}
- HEURISTICS_SERVICE_URL=${HEURISTICS_SERVICE_URL:-http://vigil-heuristics:5005}
- SEMANTIC_SERVICE_URL=${SEMANTIC_SERVICE_URL:-http://vigil-semantic-service:5006}
- PROMPT_GUARD_URL=${PROMPT_GUARD_URL:-http://vigil-prompt-guard-api:8000}
ports:
- "${BACKEND_PORT:-8787}:8787"
volumes:
- ./services/workflow/config:/config:rw
- ./vigil_data/web-ui:/app/data
networks:
vigil-net:
aliases:
- web-ui-backend
restart: unless-stopped
depends_on:
clickhouse:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8787/health"]
interval: 30s
timeout: 10s
retries: 3
web-ui-frontend:
build:
context: .
dockerfile: ./services/web-ui/frontend/Dockerfile
args:
VITE_DOCS_REF: ${DOCS_REF:-704b404b1ce0ac8298d8f548d8b385d318f4744b}
VITE_GRAFANA_ORIGIN: http://localhost/grafana
container_name: vigil-web-ui-frontend
ports:
- "${FRONTEND_PORT:-5173}:80"
networks:
vigil-net:
aliases:
- web-ui-frontend
restart: unless-stopped
depends_on:
- web-ui-backend
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
# ============================================
# PROMPT GUARD API
# ============================================
prompt-guard-api:
build: ./prompt-guard-api
container_name: vigil-prompt-guard-api
ports:
- "${PROMPT_GUARD_PORT:-8000}:8000"
volumes:
- ./vigil_data/prompt-guard-cache:/root/.cache/huggingface
- ./Llama-Prompt-Guard-2-86M:/app/model:ro
networks:
- vigil-net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
# ============================================
# PRESIDIO PII DETECTION API
# ============================================
presidio-pii-api:
build: ./services/presidio-pii-api
container_name: vigil-presidio-pii
image: vigil-presidio-pii:1.6.11
environment:
- PII_DETECTION_MODE=${PII_DETECTION_MODE:-balanced}
- PII_CONTEXT_ENHANCEMENT=${PII_CONTEXT_ENHANCEMENT:-true}
ports:
- "${PRESIDIO_PORT:-5001}:5001"
networks:
vigil-net:
aliases:
- presidio-pii-api
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
# ============================================
# SEMANTIC SERVICE (Branch B - Vector Similarity)
# ============================================
semantic-service:
build:
context: ./services/semantic-service
target: production
container_name: vigil-semantic-service
image: vigil-semantic-service:1.0.0
environment:
- NODE_ENV=production
- PORT=5006
- HOST=0.0.0.0
- LOG_LEVEL=info
- CLICKHOUSE_HOST=vigil-clickhouse
- CLICKHOUSE_PORT=8123
- CLICKHOUSE_DATABASE=${CLICKHOUSE_DB:-n8n_logs}
- CLICKHOUSE_USER=${CLICKHOUSE_USER:-admin}
- CLICKHOUSE_PASSWORD=${CLICKHOUSE_PASSWORD:?ERROR - CLICKHOUSE_PASSWORD must be set in .env file}
- SEARCH_TOP_K=5
- THRESHOLD_LOW=40
- THRESHOLD_MEDIUM=70
- RATE_LIMIT_MAX=1000
- CLICKHOUSE_TIMEOUT=10000
ports:
- "${SEMANTIC_SERVICE_PORT:-5006}:5006"
volumes:
# Persist model cache (avoid re-download)
- ./vigil_data/semantic-models:/app/models
# Pre-generated embeddings (loaded at startup)
- ./services/semantic-service/data:/app/data:ro
networks:
vigil-net:
aliases:
- semantic-service
restart: unless-stopped
depends_on:
clickhouse:
condition: service_healthy
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:5006/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Resource reservations (guaranteed minimum, no upper limits)
deploy:
resources:
reservations:
cpus: '1'
memory: 512M
# ============================================
# HEURISTICS SERVICE (Branch A - Pattern Detection)
# ============================================
heuristics-service:
build: ./services/heuristics-service
container_name: vigil-heuristics
image: vigil-heuristics:2.1.0
environment:
- NODE_ENV=${NODE_ENV:-production}
- LOG_LEVEL=${HEURISTICS_LOG_LEVEL:-info}
- PORT=5005
# Detection weights (must sum to 1.0)
- WEIGHT_OBFUSCATION=${WEIGHT_OBFUSCATION:-0.30}
- WEIGHT_STRUCTURE=${WEIGHT_STRUCTURE:-0.25}
- WEIGHT_WHISPER=${WEIGHT_WHISPER:-0.30}
- WEIGHT_ENTROPY=${WEIGHT_ENTROPY:-0.15}
# Thresholds
- THRESHOLD_LOW_MAX=${THRESHOLD_LOW_MAX:-39}
- THRESHOLD_MEDIUM_MAX=${THRESHOLD_MEDIUM_MAX:-69}
# Performance
- TARGET_LATENCY_MS=${TARGET_LATENCY_MS:-50}
- CIRCUIT_BREAKER_ENABLED=${CIRCUIT_BREAKER_ENABLED:-true}
ports:
- "${HEURISTICS_PORT:-5005}:5005"
volumes:
# Patterns directory (extracted from Roadmap)
- ./services/heuristics-service/patterns:/app/patterns:ro
networks:
vigil-net:
aliases:
- heuristics-service
restart: unless-stopped
mem_limit: 256m
cpus: "0.5"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:5005/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# ============================================
# LANGUAGE DETECTION SERVICE
# ============================================
language-detector:
build: ./services/language-detector
container_name: vigil-language-detector
image: vigil-language-detector:1.0.1
ports:
- "5002:5002"
networks:
vigil-net:
aliases:
- language-detector
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5002/health')"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
# ============================================
# REVERSE PROXY (Main entry point)
# ============================================
caddy:
image: caddy:2-alpine@sha256:953131cfea8e12bfe1c631a36308e9660e4389f0c3dfb3be957044d3ac92d446
container_name: vigil-caddy
restart: unless-stopped
ports:
- "${CADDY_HTTP_PORT:-80}:80"
- "${CADDY_HTTPS_PORT:-443}:443"
networks:
- vigil-net
volumes:
- ./services/proxy/Caddyfile:/etc/caddy/Caddyfile:ro
- ./vigil_data/caddy-data:/data
- ./vigil_data/caddy-config:/config
depends_on:
- n8n
- web-ui-frontend
- grafana
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:80/ui/"]
interval: 30s
timeout: 10s
retries: 3