-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-dev.sh
More file actions
executable file
·62 lines (53 loc) · 1.44 KB
/
run-dev.sh
File metadata and controls
executable file
·62 lines (53 loc) · 1.44 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
#!/bin/bash
# Script to run both backend and frontend in development mode
# Requires two terminal windows or use a process manager
echo "Starting Ear2Finger development servers..."
echo ""
echo "Backend will run on: http://localhost:9528"
echo "Frontend will run on: http://localhost:3000"
echo ""
echo "Press Ctrl+C to stop all servers"
echo ""
# Function to cleanup on exit
cleanup() {
echo ""
echo "Stopping servers..."
kill $BACKEND_PID $FRONTEND_PID 2>/dev/null
exit
}
trap cleanup SIGINT SIGTERM
# Start backend (installs the `ear2finger` package from repo root in editable mode)
echo "Starting backend..."
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
cd "$REPO_ROOT/backend"
if [ ! -d "venv" ]; then
echo "Creating virtual environment..."
python3 -m venv venv
fi
source venv/bin/activate
if ! pip install -e ".."; then
echo "ERROR: pip install -e .. failed (fix pyproject.toml / network, then retry)." >&2
exit 1
fi
python -m uvicorn ear2finger.app:app --reload --host 0.0.0.0 --port 9528 &
BACKEND_PID=$!
cd "$REPO_ROOT"
# Wait a moment for backend to start
sleep 2
# Start frontend
echo "Starting frontend..."
cd "$REPO_ROOT/frontend"
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
fi
npm run dev &
FRONTEND_PID=$!
cd "$REPO_ROOT"
echo ""
echo "Both servers are running!"
echo "Backend PID: $BACKEND_PID"
echo "Frontend PID: $FRONTEND_PID"
echo ""
# Wait for both processes
wait