-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_server_client.sh
More file actions
executable file
·41 lines (30 loc) · 1.26 KB
/
setup_server_client.sh
File metadata and controls
executable file
·41 lines (30 loc) · 1.26 KB
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
#!/bin/bash
echo ""
echo "Installing Python dependencies..."
echo ""
pip install -r requirements_server_client.txt ||
pip3 install -r requirements_server_client.txt ||
{ echo "Failed to install dependencies"; exit 1; }
echo ""
echo "Generating gRPC code from lms.proto and raft.proto..."
echo ""
# Generate gRPC code for LMS
python3 -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/lms.proto ||
python -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/lms.proto ||
{ echo "Failed to generate gRPC code for lms.proto"; exit 1; }
# Generate gRPC code for Raft
python3 -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/raft.proto ||
python -m grpc_tools.protoc -I./proto --python_out=./proto --grpc_python_out=./proto ./proto/raft.proto ||
{ echo "Failed to generate gRPC code for lms.proto"; exit 1; }
echo "gRPC code generated successfully."
echo ""
echo "Initializing database content..."
echo ""
rm lms_db.sqlite
python3 ./server/database.py ||
python ./server/database.py ||
{ echo "Failed to setup database"; exit 1; }
python3 ./server/initialize_content.py ||
python ./server/initialize_content.py ||
{ echo "Failed to initialize content"; exit 1; }
mkdir logs