-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathstart-chatcve.sh
More file actions
executable file
·90 lines (73 loc) · 2.23 KB
/
start-chatcve.sh
File metadata and controls
executable file
·90 lines (73 loc) · 2.23 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
#!/bin/bash
# ChatCVE Startup Script
# This script starts both the Flask API backend and Next.js frontend
echo "🚀 Starting ChatCVE..."
# Check if we're in the right directory
if [ ! -f "README.md" ] || ! grep -q "ChatCVE" README.md 2>/dev/null; then
echo "❌ Please run this script from your ChatCVE directory"
exit 1
fi
# Quick prerequisites check
echo "🔍 Checking prerequisites..."
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3.10+ first."
echo " Run: ./check-prerequisites.sh for detailed setup instructions"
exit 1
fi
if ! command -v npm &> /dev/null; then
echo "❌ npm is not installed. Please install Node.js 18+ first."
echo " Run: ./check-prerequisites.sh for detailed setup instructions"
exit 1
fi
if [ ! -d ".env" ]; then
echo "❌ Python virtual environment not found."
echo " Run: python3 -m venv .env && source .env/bin/activate && pip install -r requirements.txt"
exit 1
fi
if [ ! -d "frontend-next/node_modules" ]; then
echo "❌ Frontend dependencies not installed."
echo " Run: cd frontend-next && npm install && cd .."
exit 1
fi
echo "✅ Prerequisites check passed!"
# Check for required files
if [ ! -d "frontend-next" ]; then
echo "❌ frontend-next directory not found"
exit 1
fi
if [ ! -d "api" ]; then
echo "❌ api directory not found"
exit 1
fi
# Function to cleanup background processes
cleanup() {
echo "🛑 Shutting down ChatCVE..."
jobs -p | xargs -r kill
exit 0
}
# Trap SIGINT and SIGTERM
trap cleanup SIGINT SIGTERM
echo "📡 Starting Flask API backend..."
# Activate virtual environment
source .env/bin/activate
cd api
python3 flask_backend.py &
FLASK_PID=$!
echo "⏳ Waiting for API to start..."
sleep 3
echo "🌐 Starting Next.js frontend..."
cd ../frontend-next
npm run dev &
NEXTJS_PID=$!
echo "✅ ChatCVE is starting up!"
echo ""
echo "📊 Dashboard: http://localhost:3000"
echo "💬 Chat: http://localhost:3000/chat"
echo "🔍 CVE Explorer: http://localhost:3000/cves"
echo "🛡️ Scans: http://localhost:3000/scans"
echo ""
echo "🔧 API Backend: http://localhost:5000"
echo ""
echo "Press Ctrl+C to stop all services"
# Wait for background processes
wait