-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathstart_server.sh
executable file
·76 lines (59 loc) · 1.6 KB
/
start_server.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
echo "start_server.sh" | tee -a /root/debug.log
date;
env | grep _ >> /etc/environment;
export BACKEND=$1
if [ -z "$BACKEND" ]; then
echo "BACKEND must be set!"
exit 1
fi
echo "$BACKEND" | tee -a /root/debug.log
if [ ! -f /root/hasbooted2 ]
then
echo "booting" | tee -a /root/debug.log
mkdir /home/workspace
cd /home/workspace
git clone https://github.com/vast-ai/vast-pyworker
python3 -m venv /home/workspace/worker-env
source /home/workspace/worker-env/bin/activate
pip install requests
pip install psutil
pip install flask
pip install nltk
pip install pycryptodome
pip install numpy
touch ~/.no_auto_tmux
touch /root/hasbooted2
fi
if [ "$VIRTUAL_ENV" != "/home/workspace/worker-env" ]
then
source /home/workspace/worker-env/bin/activate
echo "environment activated" | tee -a /root/debug.log
fi
echo "venv: $VIRTUAL_ENV" | tee -a /root/debug.log
cd /home/workspace/vast-pyworker
export SERVER_DIR="/home/workspace/vast-pyworker"
if [ -z "$REPORT_ADDR" ]
then
export REPORT_ADDR="https://run.vast.ai"
fi
if [ -z "$MASTER_TOKEN" ]
then
export MASTER_TOKEN="mtoken"
fi
export AUTH_PORT=3000
if [ ! -d "$SERVER_DIR/$BACKEND" ]
then
echo "$BACKEND not supported!" | tee -a /root/debug.log
exit 1
fi
source "$SERVER_DIR/start_auth.sh"
source "$SERVER_DIR/start_watch.sh"
echo "start server done" | tee -a /root/debug.log
# sleep 1
# source "$SERVER_DIR/init_check.sh"
# if [ $? -eq 0 ]; then
# echo "init_check passed, all server functions operating correctly."
# else
# echo "init_check failed. Exit code: $?"
# fi