-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-services.sh
More file actions
executable file
Β·587 lines (508 loc) Β· 25.6 KB
/
start-services.sh
File metadata and controls
executable file
Β·587 lines (508 loc) Β· 25.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
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
#!/bin/bash
# Robust service startup script with retry logic and graceful degradation
# Uses Node.js-based service starter for better error handling and retry mechanisms
set -e
echo "π Starting Coding Services (Robust Mode)..."
# Get the script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Check if ROBUST_MODE is enabled (default: enabled)
ROBUST_MODE="${ROBUST_MODE:-true}"
if [ "$ROBUST_MODE" = "true" ]; then
echo "β¨ Using robust startup mode with retry logic and graceful degradation"
echo ""
# Use the Node.js-based robust service starter
exec node "$SCRIPT_DIR/scripts/start-services-robust.js"
fi
# LEGACY MODE (kept for backward compatibility, disable with ROBUST_MODE=false)
echo "β οΈ Using LEGACY startup mode (no retry logic)"
echo " To enable robust mode, unset ROBUST_MODE or set ROBUST_MODE=true"
echo ""
# Load environment variables from .env files (for API keys like GROQ_API_KEY)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/.env" ]; then
set -a
source "$SCRIPT_DIR/.env"
set +a
echo "β
Loaded environment variables from .env"
fi
if [ -f "$SCRIPT_DIR/.env.ports" ]; then
set -a
source "$SCRIPT_DIR/.env.ports"
set +a
fi
# Function to check if port is in use
check_port() {
local port=$1
lsof -i :$port >/dev/null 2>&1
}
# Function to kill process on port
kill_port() {
local port=$1
local pid=$(lsof -t -i :$port 2>/dev/null || echo "")
if [ ! -z "$pid" ]; then
echo "π₯ Killing process $pid on port $port"
kill -9 $pid 2>/dev/null || true
sleep 1
fi
}
# Function to check if Docker is running
check_docker() {
docker info >/dev/null 2>&1
}
# Kill any existing processes on our ports
echo "π§Ή Cleaning up existing processes..."
# Kill VKB server port and FastMCP server port
for port in 8080 8001; do
if check_port $port; then
kill_port $port
fi
done
# Kill any existing semantic analysis processes
echo "π§Ή Cleaning up existing semantic analysis processes..."
pkill -f "semantic_analysis_server.py" 2>/dev/null || true
# Get the script directory and coding project directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
CODING_DIR="$SCRIPT_DIR"
# Check and setup Constraint Monitor
CONSTRAINT_MONITOR_STATUS="β NOT RUNNING"
CONSTRAINT_MONITOR_WARNING=""
# Check if mcp-constraint-monitor exists in integrations, if not clone it
if [ ! -d "$CODING_DIR/integrations/mcp-constraint-monitor" ]; then
echo "π¦ Installing MCP Constraint Monitor..."
cd "$CODING_DIR/integrations"
# Check if we have local development version to copy
if [ -d "$CODING_DIR/mcp-constraint-monitor" ]; then
echo " π Copying local development version..."
cp -r "$CODING_DIR/mcp-constraint-monitor" "./mcp-constraint-monitor"
cd mcp-constraint-monitor
echo " π¦ Installing dependencies..."
npm install --production 2>/dev/null || echo " β οΈ npm install failed, continuing..."
echo " β
Local MCP Constraint Monitor installed"
else
echo " π Cloning from repository..."
if git clone https://github.com/fwornle/mcp-server-constraint-monitor.git mcp-constraint-monitor 2>/dev/null; then
cd mcp-constraint-monitor
echo " π¦ Installing dependencies..."
npm install --production 2>/dev/null || echo " β οΈ npm install failed, continuing..."
echo " β
MCP Constraint Monitor installed from GitHub"
else
echo " β οΈ Failed to clone repository"
echo " π‘ Ensure internet connection and GitHub access"
echo " π‘ Manual install: git clone https://github.com/fwornle/mcp-server-constraint-monitor.git mcp-constraint-monitor"
fi
fi
cd "$CODING_DIR"
fi
if check_docker; then
echo "π³ Docker is running. Starting Constraint Monitor databases..."
# Use constraint monitor in integrations directory
CONSTRAINT_DIR="$CODING_DIR/integrations/mcp-constraint-monitor"
if [ -d "$CONSTRAINT_DIR" ]; then
cd "$CONSTRAINT_DIR"
# Start databases with docker-compose
echo " Starting Docker containers (this may take a while on first run)..."
# Check if docker-compose.yml exists
if [ -f "docker-compose.yml" ]; then
echo " π Found docker-compose.yml, using docker-compose..."
# Check if containers are already running
if docker-compose ps | grep -E "(qdrant|redis)" | grep -q "Up"; then
echo "β
Constraint Monitor databases already running (docker-compose)"
CONSTRAINT_MONITOR_STATUS="β
FULLY OPERATIONAL"
else
echo " π Starting containers with docker-compose..."
# Pull images if needed (with timeout)
echo " π¦ Pulling latest images..."
timeout 120 docker-compose pull || echo " β οΈ Image pull timeout, using existing images"
# Start containers with docker-compose
if timeout 60 docker-compose up -d; then
echo " β³ Waiting for containers to be ready..."
sleep 5
# Wait for health checks
for i in {1..12}; do
if docker-compose ps | grep -E "(qdrant|redis)" | grep -q "Up.*healthy"; then
echo "β
Constraint Monitor databases started successfully"
CONSTRAINT_MONITOR_STATUS="β
FULLY OPERATIONAL"
break
elif [ $i -eq 12 ]; then
echo "β οΈ Containers started but health checks not passing"
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="Health checks failing"
else
echo " β³ Waiting for health checks... ($i/12)"
sleep 5
fi
done
# Initialize databases if needed
if [ "$CONSTRAINT_MONITOR_STATUS" = "β
FULLY OPERATIONAL" ] && [ -f "scripts/setup-databases.js" ] && [ ! -f ".initialized" ]; then
echo "π§ Initializing Constraint Monitor databases..."
if npm run setup 2>/dev/null; then
touch .initialized
echo "β
Databases initialized"
else
echo "β οΈ Database initialization failed, but continuing..."
fi
fi
else
echo "β οΈ Failed to start containers with docker-compose"
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="Docker compose startup failed"
fi
fi
else
echo " β οΈ No docker-compose.yml found, trying manual container startup..."
# Fallback to manual container startup (existing logic)
qdrant_running=$(docker ps --filter "name=constraint-monitor-qdrant" --format "table {{.Names}}" | grep -c constraint-monitor-qdrant || echo "0")
redis_running=$(docker ps --filter "name=constraint-monitor-redis" --format "table {{.Names}}" | grep -c constraint-monitor-redis || echo "0")
if [ "$qdrant_running" -gt 0 ] && [ "$redis_running" -gt 0 ]; then
echo "β
Constraint Monitor databases already running (manual containers)"
CONSTRAINT_MONITOR_STATUS="β
FULLY OPERATIONAL"
else
echo " π Starting containers manually..."
# Start Qdrant container
if ! docker ps | grep -q constraint-monitor-qdrant; then
docker run -d --name constraint-monitor-qdrant \
-p 6333:6333 -p 6334:6334 \
qdrant/qdrant:v1.15.0 || echo " β οΈ Failed to start Qdrant container"
fi
# Start Redis container
if ! docker ps | grep -q constraint-monitor-redis; then
docker run -d --name constraint-monitor-redis \
-p 6379:6379 \
redis:7-alpine || echo " β οΈ Failed to start Redis container"
fi
# Check if containers started successfully
sleep 3
qdrant_check=$(docker ps --filter "name=constraint-monitor-qdrant" --format "table {{.Names}}" | grep -c constraint-monitor-qdrant || echo "0")
redis_check=$(docker ps --filter "name=constraint-monitor-redis" --format "table {{.Names}}" | grep -c constraint-monitor-redis || echo "0")
if [ "$qdrant_check" -gt 0 ] && [ "$redis_check" -gt 0 ]; then
echo "β
Constraint Monitor databases started manually"
# Start constraint monitor web services
echo "π Starting constraint monitor web services..."
cd "$CODING_DIR/integrations/mcp-constraint-monitor"
# Start dashboard on port 3030 in background
PORT=3030 npm run dashboard > /dev/null 2>&1 &
dashboard_pid=$!
# Start API server on port 3031 in background
npm run api > /dev/null 2>&1 &
api_pid=$!
# Wait for services to start
sleep 3
# Check if web services are running
dashboard_running=$(lsof -ti:3030 | wc -l)
api_running=$(lsof -ti:3031 | wc -l)
if [ "$dashboard_running" -gt 0 ] && [ "$api_running" -gt 0 ]; then
echo "β
Constraint Monitor web services started (dashboard:3030, api:3031)"
CONSTRAINT_MONITOR_STATUS="β
FULLY OPERATIONAL"
else
echo "β οΈ Failed to start constraint monitor web services"
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="Web services startup failed"
fi
else
echo "β οΈ Failed to start some containers manually"
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="Manual container startup failed"
fi
fi
fi
cd "$CODING_DIR"
else
echo "β οΈ MCP Constraint Monitor not found"
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="MCP Constraint Monitor not installed"
fi
else
echo ""
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "β οΈ DOCKER NOT RUNNING - CONSTRAINT MONITOR IN DEGRADED MODE"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "The Live Guardrails system requires Docker for full functionality:"
echo ""
echo "β DISABLED FEATURES (Degraded Mode):"
echo " β’ No semantic analysis (Grok inference engine)"
echo " β’ No pattern learning from violations"
echo " β’ No cross-session knowledge persistence"
echo " β’ No predictive risk assessment"
echo " β’ No vector similarity search for constraints"
echo " β’ No analytical queries for trend detection"
echo ""
echo "β
STILL WORKING (Basic Mode):"
echo " β’ Basic pattern matching (regex-based)"
echo " β’ Simple constraint violation detection"
echo " β’ MCP server connectivity"
echo " β’ Basic warning messages"
echo ""
echo "π§ TO ENABLE FULL FUNCTIONALITY:"
echo " 1. Start Docker Desktop"
echo " 2. Wait for Docker to fully start"
echo " 3. Run: coding --restart"
echo " 4. Or manually: cd integrations/constraint-monitor && docker-compose up -d"
echo ""
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
CONSTRAINT_MONITOR_STATUS="β οΈ DEGRADED MODE"
CONSTRAINT_MONITOR_WARNING="Docker not running - no learning/persistence"
fi
# Start Live Logging System (with proper transcript monitoring)
echo "π’ Starting Live Logging System..."
cd "$CODING_DIR"
# Check for existing processes before starting (prevent duplicates)
echo "π§Ή Checking for existing live-logging processes..."
# Check if enhanced-transcript-monitor is already running
if node scripts/psm-register.js --check transcript-monitor global 2>/dev/null; then
echo "β οΈ Transcript Monitor already running globally, skipping startup..."
echo " (Per-project monitors will be started by global-lsl-coordinator)"
TRANSCRIPT_PID="already-running"
else
# Start the transcript monitor (this handles session transitions)
echo "π Starting Transcript Monitor with session transitions..."
nohup node scripts/enhanced-transcript-monitor.js > transcript-monitor.log 2>&1 &
TRANSCRIPT_PID=$!
echo " Transcript Monitor PID: $TRANSCRIPT_PID"
# Register with Process State Manager
if [ "$TRANSCRIPT_PID" != "already-running" ]; then
node scripts/psm-register.js transcript-monitor $TRANSCRIPT_PID global scripts/enhanced-transcript-monitor.js
fi
fi
# Check if live-logging coordinator is already running
if node scripts/psm-register.js --check live-logging-coordinator global 2>/dev/null; then
LIVE_LOGGING_PID="already-running"
echo "β οΈ Live Logging Coordinator already running, skipping startup..."
else
# Start the live-logging coordinator (this handles MCP integration)
echo "π Starting Live Logging Coordinator..."
nohup node scripts/live-logging-coordinator.js > logs/live-logging.log 2>&1 &
LIVE_LOGGING_PID=$!
echo " Live Logging Coordinator PID: $LIVE_LOGGING_PID"
# Register with Process State Manager
if [ "$LIVE_LOGGING_PID" != "already-running" ]; then
node scripts/psm-register.js live-logging-coordinator $LIVE_LOGGING_PID global scripts/live-logging-coordinator.js
fi
fi
# Log startup
echo "$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ") - Live Logging System started: Transcript Monitor PID $TRANSCRIPT_PID, Coordinator PID $LIVE_LOGGING_PID" >> logs/live-logging.log
# Start Knowledge Base Qdrant (for vector search and semantic retrieval)
echo "π’ Starting Knowledge Base Qdrant (port 6334)..."
cd "$CODING_DIR"
QDRANT_KB_STATUS="β οΈ DEGRADED"
if check_docker; then
# Check if knowledge-base-qdrant container already running
if docker ps --filter "name=knowledge-base-qdrant" --format "{{.Names}}" | grep -q "knowledge-base-qdrant"; then
echo "β
Knowledge Base Qdrant already running"
QDRANT_KB_STATUS="β
OPERATIONAL"
QDRANT_KB_PID=$(docker inspect -f '{{.State.Pid}}' knowledge-base-qdrant)
else
echo " Creating knowledge-base-qdrant container..."
# Create data directory if it doesn't exist
mkdir -p "$CODING_DIR/.data/qdrant"
# Start knowledge base Qdrant container (separate from constraint monitor)
if docker run -d --name knowledge-base-qdrant \
-p 6334:6333 \
-v "$CODING_DIR/.data/qdrant:/qdrant/storage" \
qdrant/qdrant:latest >/dev/null 2>&1; then
echo " β³ Waiting for Qdrant to be ready..."
sleep 3
# Wait for Qdrant health check
for i in {1..10}; do
if curl -f http://localhost:6334/health >/dev/null 2>&1; then
echo "β
Knowledge Base Qdrant started successfully on port 6334"
QDRANT_KB_STATUS="β
OPERATIONAL"
QDRANT_KB_PID=$(docker inspect -f '{{.State.Pid}}' knowledge-base-qdrant)
break
elif [ $i -eq 10 ]; then
echo "β οΈ Qdrant container started but health check failing"
QDRANT_KB_STATUS="β οΈ UNHEALTHY"
else
sleep 1
fi
done
else
echo "β οΈ Failed to start Knowledge Base Qdrant container"
QDRANT_KB_STATUS="β οΈ DEGRADED"
fi
fi
# Register with Process State Manager if started successfully
if [ "$QDRANT_KB_STATUS" = "β
OPERATIONAL" ] && [ -n "$QDRANT_KB_PID" ]; then
node scripts/psm-register.js knowledge-base-qdrant $QDRANT_KB_PID global docker-qdrant 2>/dev/null || true
fi
else
echo "β οΈ Docker not running - Knowledge Base Qdrant unavailable"
echo " Vector search and semantic retrieval will be disabled"
QDRANT_KB_STATUS="β οΈ DEGRADED"
fi
# Start VKB Server (with GraphDB knowledge)
echo "π’ Starting VKB Server (port 8080) with GraphDB..."
cd "$CODING_DIR"
# Use GraphDB as the primary data source
export VKB_DATA_SOURCE=online
nohup node lib/vkb-server/cli.js server start --foreground > vkb-server.log 2>&1 &
VKB_PID=$!
# Register with Process State Manager
node scripts/psm-register.js vkb-server $VKB_PID global lib/vkb-server/cli.js
# Start Semantic Analysis MCP Server
echo "π’ Starting Semantic Analysis MCP Server (Standard MCP)..."
cd "$CODING_DIR/integrations/mcp-server-semantic-analysis"
# Note: Standard MCP server uses stdio transport, not HTTP
# It will be started by Claude Code when needed
echo "βΉοΈ Semantic Analysis MCP Server configured for stdio transport"
SEMANTIC_PID="stdio"
# Start System Health Dashboard (API + Frontend)
echo "π’ Starting System Health Dashboard..."
cd "$CODING_DIR/integrations/system-health-dashboard"
# Check if dependencies are installed
if [ ! -d "node_modules" ]; then
echo " π¦ Installing System Health Dashboard dependencies..."
npm install --silent 2>/dev/null || pnpm install --silent 2>/dev/null || {
echo " β οΈ Failed to install dependencies - System Health Dashboard will be unavailable"
HEALTH_API_PID="not-installed"
HEALTH_DASHBOARD_PID="not-installed"
}
fi
if [ "$HEALTH_API_PID" != "not-installed" ]; then
# Load port configuration from .env.ports
if [ -f "$CODING_DIR/.env.ports" ]; then
export $(grep '^SYSTEM_HEALTH_' "$CODING_DIR/.env.ports" | sed 's/#.*//' | xargs)
fi
# Start the API server in background (port 3033)
SYSTEM_HEALTH_API_PORT=${SYSTEM_HEALTH_API_PORT:-3033} nohup npm run api > "$CODING_DIR/logs/system-health-api.log" 2>&1 &
HEALTH_API_PID=$!
echo " System Health API PID: $HEALTH_API_PID (port 3033)"
# Start the dashboard frontend in background (port 3032)
SYSTEM_HEALTH_DASHBOARD_PORT=${SYSTEM_HEALTH_DASHBOARD_PORT:-3032} nohup npm run dev > "$CODING_DIR/logs/system-health-dashboard.log" 2>&1 &
HEALTH_DASHBOARD_PID=$!
echo " System Health Dashboard PID: $HEALTH_DASHBOARD_PID (port 3032)"
# Register with Process State Manager
cd "$CODING_DIR"
node scripts/psm-register.js system-health-api $HEALTH_API_PID global integrations/system-health-dashboard/server.js 2>/dev/null || true
node scripts/psm-register.js system-health-dashboard $HEALTH_DASHBOARD_PID global integrations/system-health-dashboard 2>/dev/null || true
else
echo " β οΈ System Health Dashboard not available"
fi
cd "$CODING_DIR"
# Wait for services to start
echo "β³ Waiting for services to start..."
sleep 5
# Verify services are running
echo "π Verifying services..."
services_running=0
# Check Live Logging System
if [ "$TRANSCRIPT_PID" = "already-running" ]; then
echo "β
Transcript Monitor running (pre-existing)"
services_running=$((services_running + 1))
elif ps -p $TRANSCRIPT_PID > /dev/null 2>&1; then
echo "β
Transcript Monitor running (PID: $TRANSCRIPT_PID)"
services_running=$((services_running + 1))
else
echo "β Transcript Monitor NOT running"
fi
if [ "$LIVE_LOGGING_PID" = "already-running" ]; then
echo "β
Live Logging Coordinator running (pre-existing)"
services_running=$((services_running + 1))
elif ps -p $LIVE_LOGGING_PID > /dev/null 2>&1; then
echo "β
Live Logging Coordinator running (PID: $LIVE_LOGGING_PID)"
services_running=$((services_running + 1))
else
echo "β Live Logging Coordinator NOT running"
fi
if check_port 8080; then
echo "β
VKB Server running on port 8080"
services_running=$((services_running + 1))
else
echo "β VKB Server NOT running on port 8080"
fi
# Check if semantic analysis server is configured (stdio transport)
if [ -f "$CODING_DIR/integrations/mcp-server-semantic-analysis/dist/index.js" ]; then
echo "β
Semantic Analysis MCP Server configured (stdio transport)"
services_running=$((services_running + 1))
# Show Node.js executable verification for the MCP server
echo "π¦ MCP Server Node.js Verification:"
cd "$CODING_DIR/integrations/mcp-server-semantic-analysis"
node -e "
const path = require('path');
const fs = require('fs');
console.log(' Node.js version:', process.version);
console.log(' Current directory:', process.cwd());
console.log(' Server built:', fs.existsSync('./dist/index.js') ? 'β
YES' : 'β NO');
console.log(' ANTHROPIC_API_KEY:', process.env.ANTHROPIC_API_KEY ? 'β
Set' : 'β Not set');
console.log(' OPENAI_API_KEY:', process.env.OPENAI_API_KEY ? 'β
Set' : 'β Not set');
console.log(' KNOWLEDGE_BASE_PATH:', process.env.KNOWLEDGE_BASE_PATH || 'Not set');
"
cd "$CODING_DIR"
else
echo "β Semantic Analysis MCP Server NOT configured"
fi
# Check System Health API
if [ "$HEALTH_API_PID" = "not-installed" ]; then
echo "β οΈ System Health API not installed"
elif [ "$HEALTH_API_PID" = "already-running" ]; then
echo "β
System Health API running (pre-existing)"
services_running=$((services_running + 1))
elif check_port 3033; then
echo "β
System Health API running on port 3033"
services_running=$((services_running + 1))
else
echo "β System Health API NOT running on port 3033"
fi
# Check System Health Dashboard Frontend
if [ "$HEALTH_DASHBOARD_PID" = "not-installed" ]; then
echo "β οΈ System Health Dashboard not installed"
elif check_port 3032; then
echo "β
System Health Dashboard running on port 3032"
services_running=$((services_running + 1))
else
echo "β System Health Dashboard NOT running on port 3032"
fi
# Check Constraint Monitor web services (if status is FULLY OPERATIONAL)
if [ "$CONSTRAINT_MONITOR_STATUS" = "β
FULLY OPERATIONAL" ]; then
if check_port 3030; then
echo "β
Constraint Monitor Dashboard running on port 3030"
services_running=$((services_running + 1))
else
echo "β Constraint Monitor Dashboard NOT running on port 3030"
fi
if check_port 3031; then
echo "β
Constraint Monitor API running on port 3031"
services_running=$((services_running + 1))
else
echo "β Constraint Monitor API NOT running on port 3031"
fi
fi
# Process State Manager now handles service tracking
# Query current status
echo "π Querying Process State Manager status..."
node scripts/process-state-manager.js status > /dev/null 2>&1 || echo "β οΈ Warning: Process State Manager query failed"
echo ""
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "π SERVICES STATUS SUMMARY"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
# Calculate expected service count based on constraint monitor status
expected_services=6 # Core 4 + System Health API + System Health Dashboard
if [ "$CONSTRAINT_MONITOR_STATUS" = "β
FULLY OPERATIONAL" ]; then
expected_services=8 # Core 4 + System Health (API+Dashboard) + Constraint Monitor (Dashboard+API)
fi
if [ $services_running -ge $expected_services ]; then
echo "β
All services started successfully! ($services_running/$expected_services running)"
elif [ $services_running -ge 4 ]; then
echo "β
Core services started successfully! ($services_running/$expected_services running)"
else
echo "β οΈ Some core services not running ($services_running/$expected_services). Check logs for issues."
fi
echo ""
echo "π‘οΈ CONSTRAINT MONITOR: $CONSTRAINT_MONITOR_STATUS"
if [ -n "$CONSTRAINT_MONITOR_WARNING" ]; then
echo " β οΈ $CONSTRAINT_MONITOR_WARNING"
fi
echo ""
echo "π KNOWLEDGE BASE QDRANT: $QDRANT_KB_STATUS"
if [ "$QDRANT_KB_STATUS" != "β
OPERATIONAL" ]; then
echo " β οΈ Vector search and semantic retrieval disabled"
fi
echo ""
echo "π Process State: node scripts/process-state-manager.js status"
echo "π Logs: live-logging.log, vkb-server.log, logs/system-health-api.log, logs/system-health-dashboard.log"
echo "π System Health Dashboard: http://localhost:3032"
echo "βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
echo "π Startup complete!"