-
Notifications
You must be signed in to change notification settings - Fork 24
/
run-docker.sh
executable file
·96 lines (81 loc) · 2.32 KB
/
run-docker.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
MODE=${MODE}
MASTERIP=${MASTERIP}
WORKERS=${WORKERS}
WORKERIP=${WORKERIP}
HOST_NAME=${HOST_NAME}
SERVER_PORT=${SERVER_PORT}
SERVER_DATA_PORT=${SERVER_DATA_PORT}
ENABLE_NMON=${ENABLE_NMON}
DEBUG=${DEBUG}
PROFILE=${PROFILE}
# Set default value for PROFILE if not provided
if [ -z "$PROFILE" ]; then
PROFILE="docker"
fi
while [ $# -gt 0 ]; do
if [[ $1 == *"--"* ]]; then
param="${1/--/}"
declare $param="$2"
echo $1 $2 // Optional to see the parameter:value result
fi
shift
done
if [ -z "$MODE" ]; then
echo "MODE OF OPERATION SHOULD BE SPECIFIED"
echo "Use argument 1 <MASTERIP> <NUMBER OF WORKERS> <WORKER IPS> to start JasmineGraph in Master mode."
echo "Use 2 <hostName> <serverPort> <serverDataPort> to start in Worker mode."
exit 1
fi
if [ $MODE -eq 1 ]; then
# If profile is k8s, then master and worker IPs are not required. Set them to dummy values
if [ "$PROFILE" = "k8s" ]; then
MASTERIP="x"
WORKERIP="x"
fi
if [ -z "$MASTERIP" ]; then
echo "MASTER IP SHOULD BE SPECIFIED"
exit 1
fi
if [ -z "$WORKERS" ]; then
echo "Number of workers SHOULD BE SPECIFIED"
exit 1
fi
if [ -z "$WORKERIP" ]; then
echo "Worker IPs SHOULD BE SPECIFIED"
exit 1
fi
else
if [ -z "$MASTERIP" ]; then
echo "MASTER IP SHOULD BE SPECIFIED"
exit 1
fi
if [ -z "$SERVER_PORT" ]; then
echo "SERVER PORT SHOULD BE SPECIFIED"
exit 1
fi
if [ -z "$SERVER_DATA_PORT" ]; then
echo "SERVER DATA PORT SHOULD BE SPECIFIED"
exit 1
fi
fi
if [ ! -d /tmp/jasminegraph ]; then
mkdir /tmp/jasminegraph
fi
export LD_LIBRARY_PATH=/usr/local/lib
if [ -n "$DEBUG" ]; then
if [ $MODE -eq 1 ]; then
gdbserver 0.0.0.0:$DEBUG ./JasmineGraph $PROFILE $MODE $MASTERIP $WORKERS $WORKERIP $ENABLE_NMON
else
gdbserver 0.0.0.0:$DEBUG ./JasmineGraph $PROFILE $MODE $HOST_NAME $MASTERIP $SERVER_PORT $SERVER_DATA_PORT $ENABLE_NMON
fi
else
if [ $MODE -eq 1 ]; then
./JasmineGraph $PROFILE $MODE $MASTERIP $WORKERS $WORKERIP $ENABLE_NMON
else
./JasmineGraph $PROFILE $MODE $HOST_NAME $MASTERIP $SERVER_PORT $SERVER_DATA_PORT $ENABLE_NMON
fi
fi
if [ "$TESTING" = "true" ]; then
chmod -R go+w /tmp/jasminegraph
fi