-
Notifications
You must be signed in to change notification settings - Fork 28
/
start_node_docker.sh
68 lines (63 loc) · 2.35 KB
/
start_node_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
if [[ $SEASON = 'mainnet' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/mainnet-prod
elif [[ $SEASON = 'summer' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-prod
export TRACKER_UPDATE_JSON_RPC_URL="http://35.194.172.106:8080/json-rpc"
export PEER_CANDIDATE_JSON_RPC_URL="http://35.194.169.78:8080/json-rpc"
elif [[ $SEASON = 'spring' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-prod
elif [[ $SEASON = 'sandbox' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-sandbox
elif [[ $SEASON = 'staging' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-staging
elif [[ $SEASON = 'exp' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-exp
elif [[ $SEASON = 'dev' ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/testnet-dev
fi
export LOG_BANDAGE_INFO=true
printf "LOG_BANDAGE_INFO=$LOG_BANDAGE_INFO\n"
nohup node --max-old-space-size=55000 ./client/index.js 2>error_logs.txt &
sleep 1
if [[ -z "$PORT" ]]; then
NODE_ENDPOINT="http://localhost:8080"
else
NODE_ENDPOINT="http://localhost:$PORT"
fi
if [[ -z "$ACCOUNT_INJECTION_OPTION" ]]; then
printf "You must provide a ACCOUNT_INJECTION_OPTION\n"
exit
elif [[ $ACCOUNT_INJECTION_OPTION = "private_key" ]]; then
if [[ -z "$PRIVATE_KEY" ]]; then
printf 'You should manually inject your account into this node.\n'
else
echo $PRIVATE_KEY | node inject_node_account.js $NODE_ENDPOINT --private-key
unset PRIVATE_KEY
fi
elif [[ $ACCOUNT_INJECTION_OPTION = "keystore" ]]; then
if [[ -z "$KEYSTORE_FILE_PATH" ]] || [[ -z "$PASSWORD" ]]; then
printf 'You should manually inject your account into this node.\n'
else
{
echo $KEYSTORE_FILE_PATH
sleep 1
echo $PASSWORD
} | node inject_node_account.js $NODE_ENDPOINT --keystore
fi
elif [[ $ACCOUNT_INJECTION_OPTION = "mnemonic" ]]; then
if [[ -z "$MNEMONIC" ]]; then
printf 'You should manually inject your account into this node.\n'
else
{
echo $MNEMONIC
sleep 1
echo 0
} | node inject_node_account.js $NODE_ENDPOINT --mnemonic
unset MNEMONIC
fi
else
printf "Invalid ACCOUNT_INJECTION_OPTION:"$ACCOUNT_INJECTION_OPTION"\n"
exit
fi
printf 'Done\n'
tail -f /dev/null