-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·106 lines (87 loc) · 2.73 KB
/
run.sh
File metadata and controls
executable file
·106 lines (87 loc) · 2.73 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
#!/bin/bash
# Davecodes Dashboard Launcher
# Starts both the Vite dev server and WebSocket server
DASHBOARD_DIR="$HOME/.openclaw/workspace/davecodes-dashboard"
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
echo -e "${BLUE}🤖 Davecodes Dashboard + Live Agent${NC}"
echo "======================================"
# Check if directory exists
if [ ! -d "$DASHBOARD_DIR" ]; then
echo -e "${YELLOW}❌ Dashboard directory not found at $DASHBOARD_DIR${NC}"
exit 1
fi
# Navigate to dashboard directory
cd "$DASHBOARD_DIR"
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}📦 Installing dependencies...${NC}"
npm install
if [ $? -ne 0 ]; then
echo -e "${YELLOW}❌ Failed to install dependencies${NC}"
exit 1
fi
fi
# Check if tsx is installed
if ! command -v npx tsx &> /dev/null; then
echo -e "${YELLOW}📦 Installing tsx for TypeScript execution...${NC}"
npm install -D tsx
fi
# Check if servers are already running
VITE_PID=$(lsof -t -i:3000 2>/dev/null)
WS_PID=$(lsof -t -i:3002 2>/dev/null)
if [ ! -z "$VITE_PID" ]; then
echo -e "${YELLOW}⚠️ Vite server already running on port 3000${NC}"
echo -e " Stopping existing server..."
kill $VITE_PID 2>/dev/null
sleep 1
fi
if [ ! -z "$WS_PID" ]; then
echo -e "${YELLOW}⚠️ WebSocket server already running on port 3002${NC}"
echo -e " Stopping existing server..."
kill $WS_PID 2>/dev/null
sleep 1
fi
echo ""
echo -e "${CYAN}🚀 Starting services...${NC}"
echo ""
# Start WebSocket server in background
echo -e "${GREEN}📡 Starting WebSocket server on port 3002...${NC}"
npx tsx server/ws-server.ts &
WS_SERVER_PID=$!
echo -e " PID: $WS_SERVER_PID"
# Wait for WebSocket to start
sleep 2
# Start Vite dev server in background
echo -e "${GREEN}🌐 Starting Vite dev server on port 3000...${NC}"
npm run dev &
VITE_SERVER_PID=$!
echo -e " PID: $VITE_SERVER_PID"
echo ""
echo -e "${BLUE}✅ Dashboard servers started!${NC}"
echo ""
echo -e "${CYAN}📊 Dashboard:${NC} http://localhost:3000"
echo -e "${CYAN}📡 WebSocket:${NC} ws://localhost:3002"
echo -e "${CYAN}🏥 Health:${NC} http://localhost:3002/"
echo ""
echo -e "${YELLOW}Press Ctrl+C to stop both servers${NC}"
echo ""
# Handle shutdown
cleanup() {
echo ""
echo -e "${YELLOW}🛑 Shutting down servers...${NC}"
kill $VITE_SERVER_PID 2>/dev/null
kill $WS_SERVER_PID 2>/dev/null
# Clean up any remaining processes on those ports
lsof -t -i:3000 2>/dev/null | xargs kill 2>/dev/null
lsof -t -i:3002 2>/dev/null | xargs kill 2>/dev/null
echo -e "${GREEN}✅ Servers stopped${NC}"
exit 0
}
trap cleanup INT TERM
# Wait for both processes
wait