-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·71 lines (61 loc) · 2.37 KB
/
Copy pathstartup.sh
File metadata and controls
executable file
·71 lines (61 loc) · 2.37 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
#!/bin/bash
# Threat Vector — start everything for demo
# Usage: ./startup.sh
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo ""
echo "╔══════════════════════════════════════════════╗"
echo "║ THREAT VECTOR — STARTUP ║"
echo "╚══════════════════════════════════════════════╝"
echo ""
# 1. Check .env exists
if [ ! -f ".env" ]; then
echo "❌ No .env found. Copy .env.example → .env and fill in keys."
exit 1
fi
# 2. Install Python deps if needed
if ! python -c "import fastapi" 2>/dev/null; then
echo "📦 Installing Python dependencies..."
pip install -r requirements.txt -q
fi
# 3. Start Python backend
echo "🐍 Starting FastAPI backend on http://localhost:8000 ..."
python main.py &
BACKEND_PID=$!
echo " PID: $BACKEND_PID"
sleep 2
# 4. Show integration status
echo ""
echo "🔍 Integration status:"
curl -s http://localhost:8001/health | python -c "
import sys, json
d = json.load(sys.stdin)
for k, v in d.get('integrations', {}).items():
icon = '✅' if v else '⚠️ '
print(f' {icon} {k}')
"
# 5. Start dashboard
DASHBOARD_DIR="$(dirname "$SCRIPT_DIR")/threat-vector-dashboard"
if [ -d "$DASHBOARD_DIR" ]; then
echo ""
echo "🖥️ Starting dashboard on http://localhost:3002 ..."
cd "$DASHBOARD_DIR"
npm run dev -- -p 3002 &
DASH_PID=$!
echo " PID: $DASH_PID"
fi
echo ""
echo "╔══════════════════════════════════════════════╗"
echo "║ Backend: http://localhost:8001 ║"
echo "║ Dashboard: http://localhost:3002 ║"
echo "║ Health: http://localhost:8001/health ║"
echo "║ Test tip: curl -X POST localhost:8001/webhook/test \\"
echo "║ -H 'Content-Type: application/json' \\"
echo "║ -d '{\"transcript\":\"...\"}' ║"
echo "╚══════════════════════════════════════════════╝"
echo ""
echo "Press Ctrl+C to stop all services."
# Wait and clean up on exit
trap "echo ''; echo 'Shutting down...'; kill $BACKEND_PID 2>/dev/null; kill $DASH_PID 2>/dev/null" EXIT
wait