-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·36 lines (26 loc) · 842 Bytes
/
run.sh
File metadata and controls
executable file
·36 lines (26 loc) · 842 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
35
36
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT_DIR"
export ENVIRONMENT=production
PIDS=()
cleanup() {
echo "Shutting down..."
for pid in "${PIDS[@]:-}"; do
kill "$pid" 2>/dev/null || true
done
}
trap cleanup INT TERM
# Ensure no lingering processes are holding the ports
echo "Terminating any existing processes on ports 3000 and 8000..."
fuser -k 8000/tcp 2>/dev/null || true
fuser -k 3000/tcp 2>/dev/null || true
# 1. Initialize Database (SQLite file will be created if not exists)
(cd backend && python3 -m app.db.init_db)
# 2. Start Services
echo "Starting backend and frontend..."
(cd backend && uvicorn app.main:app --workers 4 --host 0.0.0.0 --port 8000) &
PIDS+=($!)
(cd frontend && npm run build && npm run start) &
PIDS+=($!)
wait "${PIDS[@]}"