-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·50 lines (41 loc) · 1.23 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·50 lines (41 loc) · 1.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
#!/usr/bin/env bash
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
if [ ! -d "$DIR/.venv/demucs" ]; then
echo "Demucs venv not found. Run scripts/build_venvs.sh first."
exit 1
fi
echo "Starting Stemper..."
echo ""
echo " Backend: http://localhost:8000"
echo " Frontend: http://localhost:5173"
echo ""
cleanup() {
trap - EXIT INT TERM
echo ""
echo "Shutting down..."
for pid in "$BACKEND_PID" "$FRONTEND_PID"; do
[ -n "$pid" ] && pkill -TERM -P "$pid" 2>/dev/null || true
[ -n "$pid" ] && kill -TERM "$pid" 2>/dev/null || true
done
sleep 0.5
for pid in "$BACKEND_PID" "$FRONTEND_PID"; do
[ -n "$pid" ] && pkill -KILL -P "$pid" 2>/dev/null || true
[ -n "$pid" ] && kill -KILL "$pid" 2>/dev/null || true
done
wait 2>/dev/null || true
exit 0
}
cd "$DIR/backend"
# Turn on yt-dlp diagnostic output (format selection, signature decode,
# extractor internals) so download failures are debuggable from the terminal.
export STEMPER_YTDLP_VERBOSE=1
"$DIR/.venv/demucs/bin/python" -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
# Give uvicorn a moment to bind port 8000 before Vite starts proxying.
sleep 2
cd "$DIR/frontend"
npm run dev &
FRONTEND_PID=$!
trap cleanup INT TERM EXIT
wait