-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·34 lines (26 loc) · 798 Bytes
/
start.sh
File metadata and controls
executable file
·34 lines (26 loc) · 798 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
VENV_PATH="${VENV_PATH:-$ROOT_DIR/.venv}"
API_HOST="${API_HOST:-0.0.0.0}"
API_PORT="${API_PORT:-8000}"
UI_PORT="${UI_PORT:-3000}"
if [ ! -d "$VENV_PATH" ]; then
python -m venv "$VENV_PATH"
fi
source "$VENV_PATH/bin/activate"
pip install -r "$ROOT_DIR/backend/requirements.txt"
if [ ! -d "$ROOT_DIR/web/node_modules" ]; then
(cd "$ROOT_DIR/web" && npm install)
fi
uvicorn backend.api:app --host "$API_HOST" --port "$API_PORT" &
API_PID=$!
cleanup() {
if kill -0 "$API_PID" >/dev/null 2>&1; then
kill "$API_PID"
fi
}
trap cleanup EXIT
echo "API running on http://$API_HOST:$API_PORT"
echo "Web UI running on http://localhost:$UI_PORT"
(cd "$ROOT_DIR/web" && PORT="$UI_PORT" npm start)