-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·51 lines (43 loc) · 917 Bytes
/
run.sh
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
#!/bin/bash
tok=$(cat .token-openai)
export OPENAI_API_KEY=$tok
echo $tok
mkdir -p data
mkdir -p store
start_frontend()
{
cd frontend
nohup npm run serve > ../frontend.log &
echo $! > ../frontend.nohup
echo "started (" $! ")"
}
stop_frontend()
{
job_id=$(cat frontend.nohup)
kill -9 $job_id
echo "stopped ($job_id)"
}
start_backend()
{
cd backend2
nohup uvicorn server:app --port 3001 --reload > ../backend.log &
echo $! > ../backend.nohup
echo "started (" $! ")"
}
stop_backend()
{
job_id=$(cat backend.nohup)
kill -9 $job_id
echo "stopped ($job_id)"
}
case $1 in
query) python backend/query.py ;;
store) python backend/store.py ;;
run) cd backend && uvicorn server:app --port 3001 --reload ;;
start-backend) start_backend ;;
stop-backend) stop_backend ;;
log-backend) cat backend.log ;;
start-frontend) start_frontend ;;
stop-frontend) stop_frontend ;;
*) echo "?"
esac