Skip to content

Commit c975cbd

Browse files
committed
Add: dstart script
1 parent acbcdcb commit c975cbd

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

dstart

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]; then
4+
echo "Usage: $0 service-name (book, assignment, author, runestone)"
5+
echo "This script starts a single service in the rs folder in development mode"
6+
echo "It will watch for changes to files and restart itself. You can use pdb and set_trace()"
7+
echo "to debug your code."
8+
exit 1
9+
fi
10+
11+
set -e
12+
SERVICE=$1
13+
cd $RUNESTONE_PATH
14+
15+
# check to see if the rs virtual environment is active
16+
if [[ -z "$VIRTUAL_ENV" && $VIRTUAL_ENV == *"rs/.venv" ]]; then
17+
echo "The rs virtual environment is not active. Please activate it first."
18+
exit 1
19+
fi
20+
21+
# check to see if the SERVICE is book
22+
if [ "$SERVICE" == "book" ]; then
23+
echo "Starting the book service on port 8100"
24+
uvicorn rsptx.book_server_api.main:app --host 0.0.0.0 --port 8100 --reload
25+
exit 0
26+
fi
27+
28+
if [ "$SERVICE" == "assignment" ]; then
29+
echo "Starting the assignment service on port 8101"
30+
uvicorn rsptx.assignment_server_api.core:app --host 0.0.0.0 --port 8101 --reload
31+
exit 0
32+
fi
33+
34+
if [ "$SERVICE" == "author" ]; then
35+
echo "Starting the author service on port 8102"
36+
uvicorn rsptx.author_server_api.main:app --host 0.0.0.0 --port 8102 --reload
37+
exit 0
38+
fi
39+
40+
if [ "$SERVICE" == "runestone" ]; then
41+
echo "Starting the web2py service on port 8103"
42+
cd bases/rsptx/web2py_server
43+
python web2py.py --no-gui --password "<recycle>" --ip 0.0.0.0 --port 8103
44+
exit 0
45+
fi
46+
47+
48+
# todo: start up a local nginx server to serve the static files
49+
# todo: with nginx running allow multiple servers to run

0 commit comments

Comments
 (0)