-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-dev.sh
More file actions
106 lines (86 loc) · 2.61 KB
/
Copy pathstart-dev.sh
File metadata and controls
106 lines (86 loc) · 2.61 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
#!/bin/bash
# AETHER-SCORE Development Startup Script
# This script starts both backend and frontend in development mode
set -e
echo "🚀 Starting AETHER-SCORE Development Environment"
echo ""
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if backend is already running
if lsof -ti:8000 > /dev/null 2>&1; then
echo -e "${YELLOW}âš ï¸ Backend is already running on port 8000${NC}"
echo " Kill it first with: lsof -ti:8000 | xargs kill -9"
echo ""
else
echo -e "${GREEN}✓${NC} Port 8000 is available for backend"
fi
# Check if frontend is already running
if lsof -ti:3000 > /dev/null 2>&1; then
echo -e "${YELLOW}âš ï¸ Frontend is already running on port 3000${NC}"
echo " Kill it first with: lsof -ti:3000 | xargs kill -9"
echo ""
else
echo -e "${GREEN}✓${NC} Port 3000 is available for frontend"
fi
echo ""
echo "Starting services..."
echo ""
# Start backend in background
echo "📦 Starting Backend (port 8000)..."
cd backend
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
source venv/bin/activate
# Check environment variables
if [ ! -f ".env" ]; then
echo "âš ï¸ Warning: .env file not found. Copy from .env.example"
fi
# Start backend
python -m uvicorn app:app --reload --port 8000 > ../backend.log 2>&1 &
BACKEND_PID=$!
echo " Backend started (PID: $BACKEND_PID)"
echo " Logs: tail -f backend.log"
# Wait a bit for backend to start
sleep 3
# Check if backend started successfully
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
echo -e " ${GREEN}✓ Backend is healthy${NC}"
else
echo -e " ${YELLOW}âš ï¸ Backend may not be ready yet. Check backend.log${NC}"
fi
cd ..
# Start frontend
echo ""
echo "🎨 Starting Frontend (port 3000)..."
cd frontend
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo " Installing dependencies..."
npm install
fi
# Start frontend
npm run dev > ../frontend.log 2>&1 &
FRONTEND_PID=$!
echo " Frontend started (PID: $FRONTEND_PID)"
echo " Logs: tail -f frontend.log"
cd ..
echo ""
echo -e "${GREEN}✅ Development environment started!${NC}"
echo ""
echo "📠Services:"
echo " Backend: http://localhost:8000"
echo " Frontend: http://localhost:3000"
echo " API Docs: http://localhost:8000/docs"
echo ""
echo "📋 Logs:"
echo " Backend: tail -f backend.log"
echo " Frontend: tail -f frontend.log"
echo ""
echo "🛑 To stop:"
echo " kill $BACKEND_PID $FRONTEND_PID"
echo " OR: lsof -ti:8000,3000 | xargs kill -9"
echo ""