forked from RunestoneInteractive/rs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dstart
executable file
·49 lines (40 loc) · 1.49 KB
/
dstart
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
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 service-name (book, assignment, author, runestone)"
echo "This script starts a single service in the rs folder in development mode"
echo "It will watch for changes to files and restart itself. You can use pdb and set_trace()"
echo "to debug your code."
exit 1
fi
set -e
SERVICE=$1
cd $RUNESTONE_PATH
# check to see if the rs virtual environment is active
if [[ -z "$VIRTUAL_ENV" && $VIRTUAL_ENV == *"rs/.venv" ]]; then
echo "The rs virtual environment is not active. Please activate it first."
exit 1
fi
# check to see if the SERVICE is book
if [ "$SERVICE" == "book" ]; then
echo "Starting the book service on port 8100"
uvicorn rsptx.book_server_api.main:app --host 0.0.0.0 --port 8100 --reload
exit 0
fi
if [ "$SERVICE" == "assignment" ]; then
echo "Starting the assignment service on port 8101"
uvicorn rsptx.assignment_server_api.core:app --host 0.0.0.0 --port 8101 --reload
exit 0
fi
if [ "$SERVICE" == "author" ]; then
echo "Starting the author service on port 8102"
uvicorn rsptx.author_server_api.main:app --host 0.0.0.0 --port 8102 --reload
exit 0
fi
if [ "$SERVICE" == "runestone" ]; then
echo "Starting the web2py service on port 8103"
cd bases/rsptx/web2py_server
python web2py.py --no-gui --password "<recycle>" --ip 0.0.0.0 --port 8103
exit 0
fi
# todo: start up a local nginx server to serve the static files
# todo: with nginx running allow multiple servers to run