forked from seifghazi/claude-code-proxy
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·91 lines (74 loc) · 2.2 KB
/
run.sh
File metadata and controls
executable file
·91 lines (74 loc) · 2.2 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
#!/bin/bash
# Claude Code Monitor - Build and Run Script
set -e
echo "🚀 Claude Code Monitor - Starting Services"
echo "========================================="
# Colors for output
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if Go is installed
if ! command -v go &> /dev/null; then
echo "❌ Go is not installed. Please install Go 1.20 or higher."
exit 1
fi
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "❌ Node.js is not installed. Please install Node.js 18 or higher."
exit 1
fi
# Check for .env file
if [ ! -f .env ]; then
echo -e "${YELLOW}⚠️ No .env file found. Creating from .env.example...${NC}"
if [ -f .env.example ]; then
cp .env.example .env
echo -e "${GREEN}✅ Created .env file.${NC}"
else
echo "❌ No .env.example file found."
exit 1
fi
fi
# Function to cleanup on exit
cleanup() {
echo -e "\n${YELLOW}Shutting down services...${NC}"
kill $PROXY_PID $WEB_PID 2>/dev/null || true
exit
}
trap cleanup EXIT INT TERM
# Build and start proxy server
echo -e "\n${BLUE}📦 Building proxy server...${NC}"
cd proxy
go mod download
go build -o ../bin/proxy cmd/proxy/main.go
cd ..
echo -e "${GREEN}✅ Proxy server built${NC}"
# Install web dependencies if needed
if [ ! -d "web/node_modules" ]; then
echo -e "\n${BLUE}📦 Installing web dependencies...${NC}"
cd web
npm install
cd ..
echo -e "${GREEN}✅ Web dependencies installed${NC}"
fi
# Start proxy server
echo -e "\n${BLUE}🚀 Starting proxy server on port 3001...${NC}"
./bin/proxy &
PROXY_PID=$!
# Wait for proxy to start
sleep 2
# Start web server
echo -e "${BLUE}🚀 Starting web interface on port 5173...${NC}"
cd web
npm run dev &
WEB_PID=$!
cd ..
echo -e "\n${GREEN}✨ All services started!${NC}"
echo "========================================="
echo -e "📊 Web Dashboard: ${BLUE}http://localhost:5173${NC}"
echo -e "🔌 API Proxy: ${BLUE}http://localhost:3001${NC}"
echo -e "💚 Health Check: ${BLUE}http://localhost:3001/health${NC}"
echo "========================================="
echo -e "${YELLOW}Press Ctrl+C to stop all services${NC}\n"
# Wait for processes
wait