-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·97 lines (83 loc) · 3.23 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·97 lines (83 loc) · 3.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
91
92
93
94
95
96
97
#!/usr/bin/env bash
set -e
# ==============================================================================
# ContextCortex - Automated Setup Script (Linux & macOS)
# ==============================================================================
echo "======================================================================"
echo "🧠 Initializing ContextCortex Bare-Metal Environment"
echo "======================================================================"
# 1. Check Python 3.11+
PYTHON_BIN=""
if command -v python3 >/dev/null 2>&1; then
PYTHON_BIN="python3"
elif command -v python >/dev/null 2>&1; then
PYTHON_BIN="python"
else
echo "❌ Error: Python 3 is not installed or not in PATH."
exit 1
fi
PY_VERSION=$($PYTHON_BIN -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
PY_MAJOR=$($PYTHON_BIN -c 'import sys; print(sys.version_info.major)')
PY_MINOR=$($PYTHON_BIN -c 'import sys; print(sys.version_info.minor)')
if [ "$PY_MAJOR" -lt 3 ] || ([ "$PY_MAJOR" -eq 3 ] && [ "$PY_MINOR" -lt 11 ]); then
echo "❌ Error: Python 3.11 or newer is required (detected Python $PY_VERSION)."
exit 1
fi
echo "✅ Python detected: $($PYTHON_BIN --version)"
# 2. Check Node.js and npm
if ! command -v node >/dev/null 2>&1; then
echo "❌ Error: Node.js is not installed or not in PATH (v20+ recommended)."
exit 1
fi
echo "✅ Node.js detected: $(node --version)"
if ! command -v npm >/dev/null 2>&1; then
echo "❌ Error: npm is not installed or not in PATH."
exit 1
fi
echo "✅ npm detected: v$(npm --version)"
# 3. Check Git
if ! command -v git >/dev/null 2>&1; then
echo "❌ Error: Git is not installed or not in PATH."
exit 1
fi
echo "✅ Git detected: $(git --version)"
# 4. Set up Python Virtual Environment
VENV_DIR="venv"
if [ ! -d "$VENV_DIR" ]; then
echo "📦 Creating Python virtual environment in './$VENV_DIR'..."
$PYTHON_BIN -m venv "$VENV_DIR"
else
echo "📦 Using existing Python virtual environment in './$VENV_DIR'."
fi
# Activate virtual environment
source "$VENV_DIR/bin/activate"
echo "⬆️ Upgrading pip and installing backend dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
# 5. Build Frontend React Dashboard
if [ -d "frontend" ]; then
echo "⚛️ Setting up and compiling React 19 administrative dashboard..."
cd frontend
npm install
npm run build
cd ..
else
echo "⚠️ Warning: 'frontend' directory not found; skipping frontend build."
fi
# 6. Ensure default runtime data directories exist
mkdir -p data/qdrant_storage data/chroma_db docs
echo ""
echo "======================================================================"
echo "🎉 ContextCortex Setup Complete!"
echo "======================================================================"
echo "To start the ContextCortex server, run:"
echo ""
echo " source venv/bin/activate"
echo " python main.py"
echo ""
echo "Available Endpoints:"
echo " • Web Admin Dashboard: http://localhost:3000/admin/"
echo " • MCP SSE Transport: http://localhost:3000/sse"
echo " • MCP Streamable HTTP: http://localhost:3000/mcp"
echo " • System Health Check: http://localhost:3000/health"
echo "======================================================================"