-
Notifications
You must be signed in to change notification settings - Fork 28
/
deploy_blockchain_genesis_onprem.sh
415 lines (365 loc) · 18.3 KB
/
deploy_blockchain_genesis_onprem.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
#!/bin/bash
if [[ $# -lt 4 ]] || [[ $# -gt 10 ]]; then
printf "Usage: bash deploy_blockchain_genesis_onprem.sh [staging|spring|mainnet] <# of Shards> <Parent Node Index Begin> <Parent Node Index End> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data] [--kill-job|--kill-only]\n"
printf "Example: bash deploy_blockchain_genesis_onprem.sh staging 0 0 4 --keystore --no-keep-code\n"
printf "Example: bash deploy_blockchain_genesis_onprem.sh staging 0 0 0 --keystore --keep-code\n"
#printf "Example: bash deploy_blockchain_genesis_onprem.sh staging 0 -1 -1 --setup --keystore --no-keep-code\n"
printf "Example: bash deploy_blockchain_genesis_onprem.sh staging 0 0 0 --setup --keystore --no-keep-code\n"
#printf "Note: <Parent Node Index Begin> = -1 is for tracker\n"
printf "Note: <Parent Node Index End> is inclusive\n"
printf "\n"
exit
fi
printf "\n[[[[[ deploy_blockchain_genesis_onprem.sh ]]]]]\n\n"
if [[ "$1" = 'staging' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid project/season argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
ONPREM_USER="nvidia"
printf "ONPREM_USER=$ONPREM_USER\n"
number_re='^[0-9]+$'
if [[ ! $2 =~ $number_re ]] ; then
printf "Invalid <# of Shards> argument: $2\n"
exit
fi
if [[ $3 -lt 0 ]] || [[ $3 -gt 4 ]]; then
printf "Invalid <Parent Node Index Begin> argument: $3\n"
exit
fi
PARENT_NODE_INDEX_BEGIN=$3
printf "PARENT_NODE_INDEX_BEGIN=$PARENT_NODE_INDEX_BEGIN\n"
if [[ $4 -lt 0 ]] || [[ $4 -gt 4 ]]; then
printf "Invalid <Parent Node Index End> argument: $4\n"
exit
fi
PARENT_NODE_INDEX_END=$4
printf "PARENT_NODE_INDEX_END=$PARENT_NODE_INDEX_END\n"
printf "\n"
function parse_options() {
local option="$1"
if [[ $option = '--setup' ]]; then
SETUP_OPTION="$option"
elif [[ $option = '--private-key' ]]; then
ACCOUNT_INJECTION_OPTION="$option"
elif [[ $option = '--keystore' ]]; then
ACCOUNT_INJECTION_OPTION="$option"
elif [[ $option = '--mnemonic' ]]; then
ACCOUNT_INJECTION_OPTION="$option"
elif [[ $option = '--keep-code' ]]; then
KEEP_CODE_OPTION="$option"
elif [[ $option = '--no-keep-code' ]]; then
KEEP_CODE_OPTION="$option"
elif [[ $option = '--keep-data' ]]; then
KEEP_DATA_OPTION="$option"
elif [[ $option = '--no-keep-data' ]]; then
KEEP_DATA_OPTION="$option"
elif [[ $option = '--full-sync' ]]; then
SYNC_MODE_OPTION="$option"
elif [[ $option = '--fast-sync' ]]; then
SYNC_MODE_OPTION="$option"
elif [[ $option = '--chown-data' ]]; then
CHOWN_DATA_OPTION="$option"
elif [[ $option = '--no-chown-data' ]]; then
CHOWN_DATA_OPTION="$option"
elif [[ $option = '--kill-job' ]]; then
KILL_OPTION="$option"
elif [[ $option = '--kill-only' ]]; then
KILL_OPTION="$option"
else
printf "Invalid options: $option\n"
exit
fi
}
# Parse options.
SETUP_OPTION=""
ACCOUNT_INJECTION_OPTION="--private-key"
KEEP_CODE_OPTION="--keep-code"
KEEP_DATA_OPTION="--keep-data"
SYNC_MODE_OPTION="--fast-sync"
CHOWN_DATA_OPTION="--no-chown-data"
KILL_OPTION="--kill-job"
ARG_INDEX=5
while [ $ARG_INDEX -le $# ]; do
parse_options "${!ARG_INDEX}"
((ARG_INDEX++))
done
if [[ $SETUP_OPTION = "--setup" ]] && [[ ! $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
printf "You cannot use --setup without --no-keep-code\n"
exit
fi
if [[ $PARENT_NODE_INDEX_BEGIN -lt 0 ]]; then
printf "Please use deploy_blockchain_incremental_gcp.sh instead for the tracker job.\n"
exit
fi
printf "SETUP_OPTION=$SETUP_OPTION\n"
printf "ACCOUNT_INJECTION_OPTION=$ACCOUNT_INJECTION_OPTION\n"
printf "KEEP_CODE_OPTION=$KEEP_CODE_OPTION\n"
printf "KEEP_DATA_OPTION=$KEEP_DATA_OPTION\n"
printf "SYNC_MODE_OPTION=$SYNC_MODE_OPTION\n"
printf "CHOWN_DATA_OPTION=$CHOWN_DATA_OPTION\n"
printf "KILL_OPTION=$KILL_OPTION\n"
# Json-RPC-enabled blockchain nodes
JSON_RPC_NODE_INDEX_GE=0
JSON_RPC_NODE_INDEX_LE=4
# Rest-Function-enabled blockchain nodes
REST_FUNC_NODE_INDEX_GE=0
REST_FUNC_NODE_INDEX_LE=2
# Event-Handler-enabled blockchain nodes
EVENT_HANDLER_NODE_INDEX_GE=0
EVENT_HANDLER_NODE_INDEX_LE=4
printf "\n"
printf "JSON_RPC_NODE_INDEX_GE=$JSON_RPC_NODE_INDEX_GE\n"
printf "JSON_RPC_NODE_INDEX_LE=$JSON_RPC_NODE_INDEX_LE\n"
printf "REST_FUNC_NODE_INDEX_GE=$REST_FUNC_NODE_INDEX_GE\n"
printf "REST_FUNC_NODE_INDEX_LE=$REST_FUNC_NODE_INDEX_LE\n"
printf "EVENT_HANDLER_NODE_INDEX_GE=$EVENT_HANDLER_NODE_INDEX_GE\n"
printf "EVENT_HANDLER_NODE_INDEX_LE=$EVENT_HANDLER_NODE_INDEX_LE\n"
if [[ "$ACCOUNT_INJECTION_OPTION" = "" ]]; then
printf "Must provide an ACCOUNT_INJECTION_OPTION\n"
exit
fi
# Get confirmation.
if [[ "$SEASON" = "mainnet" ]]; then
printf "\n"
printf "Do you want to proceed for $SEASON? Enter [mainnet]: "
read CONFIRM
printf "\n"
if [[ ! $CONFIRM = "mainnet" ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
elif [[ "$SEASON" = "spring" ]] || [[ "$SEASON" = "summer" ]]; then
printf "\n"
printf "Do you want to proceed for $SEASON? Enter [testnet]: "
read CONFIRM
printf "\n"
if [[ ! $CONFIRM = "testnet" ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
else
printf "\n"
read -p "Do you want to proceed for $SEASON? [y/N]: " -n 1 -r
printf "\n\n"
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
fi
# Read node ip addresses and passwords
IFS=$'\n' read -d '' -r -a NODE_IP_LIST < ./ip_addresses/${SEASON}_onprem_ip.txt
IFS=$'\n' read -d '' -r -a NODE_PW_LIST < ./ip_addresses/${SEASON}_onprem_pw.txt
if [[ ! $KILL_OPTION = '--kill-only' ]]; then
# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_onprem.txt
if [[ "$ACCOUNT_INJECTION_OPTION" = "--keystore" ]]; then
# Get keystore password
printf "Enter keystore password: "
read -s KEYSTORE_PW
printf "\n\n"
if [[ "$SEASON" = "mainnet" ]]; then
KEYSTORE_DIR="mainnet_prod_keys"
elif [[ "$SEASON" = "spring" ]] || [[ "$SEASON" = "summer" ]]; then
KEYSTORE_DIR="testnet_prod_keys"
else
KEYSTORE_DIR="testnet_dev_staging_keys"
fi
elif [[ "$ACCOUNT_INJECTION_OPTION" = "--mnemonic" ]]; then
IFS=$'\n' read -d '' -r -a MNEMONIC_LIST < ./testnet_mnemonics/$SEASON.txt
fi
fi
function inject_account() {
local node_index="$1"
local node_url=${NODE_URL_LIST[${node_index}]}
if [[ "$ACCOUNT_INJECTION_OPTION" = "--keystore" ]]; then
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
printf "node_url='$node_url'\n"
KEYSTORE_FILE_PATH="$KEYSTORE_DIR/keystore_node_$node_index.json"
{
echo $KEYSTORE_FILE_PATH
sleep 1
echo $KEYSTORE_PW
} | node inject_node_account.js $node_url $ACCOUNT_INJECTION_OPTION
elif [[ "$ACCOUNT_INJECTION_OPTION" = "--mnemonic" ]]; then
local MNEMONIC=${MNEMONIC_LIST[${node_index}]}
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
printf "node_url='$node_url'\n"
{
echo $MNEMONIC
sleep 1
echo 0
} | node inject_node_account.js $node_url $ACCOUNT_INJECTION_OPTION
else
printf "\n* >> Injecting an account for node $node_index ********************\n\n"
printf "node_url='$node_url'\n"
local GENESIS_ACCOUNTS_PATH="blockchain-configs/base/genesis_accounts.json"
if [[ "$SEASON" = "spring" ]] || [[ "$SEASON" = "summer" ]]; then
GENESIS_ACCOUNTS_PATH="blockchain-configs/testnet-prod/genesis_accounts.json"
fi
PRIVATE_KEY=$(cat $GENESIS_ACCOUNTS_PATH | jq -r '.others['$node_index'].private_key')
echo $PRIVATE_KEY | node inject_node_account.js $node_url $ACCOUNT_INJECTION_OPTION
fi
}
# deploy files
#FILES_FOR_TRACKER="blockchain/ blockchain-configs/ block-pool/ client/ common/ consensus/ db/ logger/ tracker-server/ traffic/ package.json setup_blockchain_ubuntu_onprem.sh start_tracker_genesis_onprem.sh start_tracker_incremental_onprem.sh"
FILES_FOR_NODE="blockchain/ blockchain-configs/ block-pool/ client/ common/ consensus/ db/ event-handler/ json_rpc/ logger/ node/ p2p/ tools/ traffic/ tx-pool/ package.json setup_blockchain_ubuntu_onprem.sh start_node_genesis_onprem.sh start_node_incremental_onprem.sh wait_until_node_sync.sh stop_local_blockchain.sh"
printf "###############################################################################\n"
printf "# Deploying parent blockchain #\n"
printf "###############################################################################\n\n"
# deploy files to GCP instances
if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
# # Tracker server is deployed with PARENT_NODE_INDEX_BEGIN = -1
# if [[ $PARENT_NODE_INDEX_BEGIN = -1 ]]; then
# printf "\n* >> Deploying files for parent tracker (${TRACKER_TARGET_ADDR}) *********************************************************\n\n"
# gcloud compute ssh $TRACKER_TARGET_ADDR --command "sudo rm -rf ~/ain-blockchain; sudo mkdir ~/ain-blockchain; sudo chmod -R 777 ~/ain-blockchain" --project $PROJECT_ID --zone $TRACKER_ZONE
# gcloud compute scp --recurse $FILES_FOR_TRACKER ${TRACKER_TARGET_ADDR}:~/ain-blockchain/ --project $PROJECT_ID --zone $TRACKER_ZONE
# fi
begin_index=$PARENT_NODE_INDEX_BEGIN
if [[ $begin_index -lt 0 ]]; then
begin_index=0
fi
if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -ge 0 ]]; then
for node_index in `seq $(( $begin_index )) $(( $PARENT_NODE_INDEX_END ))`; do
NODE_TARGET_ADDR="${ONPREM_USER}@${NODE_IP_LIST[${node_index}]}"
NODE_LOGIN_PW="${NODE_PW_LIST[${node_index}]}"
printf "\n\n* >> Deploying files for parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"
printf "FILES_FOR_NODE=${FILES_FOR_NODE}\n\n"
echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh $NODE_TARGET_ADDR "sudo -S rm -rf ~/ain-blockchain; mkdir ~/ain-blockchain; chmod -R 777 ~/ain-blockchain"
sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) scp -r $FILES_FOR_NODE ${NODE_TARGET_ADDR}:~/ain-blockchain/
done
fi
fi
# ssh into each instance, set up the ubuntu VM instance (ONLY NEEDED FOR THE FIRST TIME)
if [[ $SETUP_OPTION = "--setup" ]]; then
# # Tracker server is set up with PARENT_NODE_INDEX_BEGIN = -1
# if [[ $PARENT_NODE_INDEX_BEGIN = -1 ]]; then
# printf "\n* >> Setting up parent tracker (${TRACKER_TARGET_ADDR}) *********************************************************\n\n"
# gcloud compute ssh $TRACKER_TARGET_ADDR --command "cd ./ain-blockchain; . setup_blockchain_ubuntu_onprem.sh" --project $PROJECT_ID --zone $TRACKER_ZONE
# fi
begin_index=$PARENT_NODE_INDEX_BEGIN
if [[ $begin_index -lt 0 ]]; then
begin_index=0
fi
if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -ge 0 ]]; then
for node_index in `seq $(( $begin_index )) $(( $PARENT_NODE_INDEX_END ))`; do
NODE_TARGET_ADDR="${ONPREM_USER}@${NODE_IP_LIST[${node_index}]}"
NODE_LOGIN_PW="${NODE_PW_LIST[${node_index}]}"
printf "\n\n* >> Setting up parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"
echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh ${NODE_TARGET_ADDR} "cd ./ain-blockchain; . setup_blockchain_ubuntu_onprem.sh"
done
fi
fi
# install node modules on GCP instances
if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
# # Tracker server is installed with PARENT_NODE_INDEX_BEGIN = -1
# if [[ $PARENT_NODE_INDEX_BEGIN = -1 ]]; then
# printf "\n* >> Installing node modules for parent tracker (${TRACKER_TARGET_ADDR}) *********************************************************\n\n"
# gcloud compute ssh $TRACKER_TARGET_ADDR --command "cd ./ain-blockchain; yarn install --ignore-engines" --project $PROJECT_ID --zone $TRACKER_ZONE
# fi
begin_index=$PARENT_NODE_INDEX_BEGIN
if [[ $begin_index -lt 0 ]]; then
begin_index=0
fi
if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -ge 0 ]]; then
for node_index in `seq $(( $begin_index )) $(( $PARENT_NODE_INDEX_END ))`; do
NODE_TARGET_ADDR="${ONPREM_USER}@${NODE_IP_LIST[${node_index}]}"
NODE_LOGIN_PW="${NODE_PW_LIST[${node_index}]}"
printf "\n\n* >> Installing node modules for parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"
sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh ${NODE_TARGET_ADDR} "cd ./ain-blockchain; yarn install --ignore-engines"
done
fi
fi
# kill any processes still alive
printf "\n\nKilling tracker / blockchain node jobs...\n"
# # Tracker server is killed with PARENT_NODE_INDEX_BEGIN = -1
# if [[ $PARENT_NODE_INDEX_BEGIN = -1 ]]; then
# printf "\n* >> Killing tracker job (${TRACKER_TARGET_ADDR}) *********************************************************\n\n"
# gcloud compute ssh $TRACKER_TARGET_ADDR --command "sudo killall node" --project $PROJECT_ID --zone $TRACKER_ZONE
# fi
begin_index=$PARENT_NODE_INDEX_BEGIN
if [[ $begin_index -lt 0 ]]; then
begin_index=0
fi
if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -ge 0 ]]; then
for node_index in `seq $(( $begin_index )) $(( $PARENT_NODE_INDEX_END ))`; do
NODE_TARGET_ADDR="${ONPREM_USER}@${NODE_IP_LIST[${node_index}]}"
NODE_LOGIN_PW="${NODE_PW_LIST[${node_index}]}"
printf "\n* >> Killing node $node_index job (${NODE_TARGET_ADDR}) *********************************************************\n\n"
echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh ${NODE_TARGET_ADDR} "sudo -S pkill -f client/${SEASON}-ain-blockchain-index.js"
done
fi
# If --kill-only, do not proceed any further
if [[ $KILL_OPTION = "--kill-only" ]]; then
exit
fi
printf "\n\nStarting blockchain servers...\n\n"
if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
GO_TO_PROJECT_ROOT_CMD="cd ./ain-blockchain"
else
GO_TO_PROJECT_ROOT_CMD="cd \$(find /home/${SEASON}/ain-blockchain* -maxdepth 0 -type d)"
fi
#START_TRACKER_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_tracker_genesis_onprem.sh"
START_NODE_CMD_BASE="$GO_TO_PROJECT_ROOT_CMD && . start_node_genesis_onprem.sh"
printf "\n"
#printf "START_TRACKER_CMD_BASE=$START_TRACKER_CMD_BASE\n"
printf "START_NODE_CMD_BASE=$START_NODE_CMD_BASE\n"
## Tracker server is started with PARENT_NODE_INDEX_BEGIN = -1
#if [[ $PARENT_NODE_INDEX_BEGIN = -1 ]]; then
# printf "\n* >> Starting parent tracker (${TRACKER_TARGET_ADDR}) *********************************************************\n\n"
#
# printf "\n"
# printf "KEEP_CODE_OPTION=$KEEP_CODE_OPTION\n"
# printf "KEEP_DATA_OPTION=$KEEP_DATA_OPTION\n"
# START_TRACKER_CMD="gcloud compute ssh $TRACKER_TARGET_ADDR --command '$START_TRACKER_CMD_BASE $ONPREM_USER $KEEP_CODE_OPTION' --project $PROJECT_ID --zone $TRACKER_ZONE"
# printf "START_TRACKER_CMD=$START_TRACKER_CMD\n"
# eval $START_TRACKER_CMD
#fi
begin_index=$PARENT_NODE_INDEX_BEGIN
if [[ $begin_index -lt 0 ]]; then
begin_index=0
fi
if [[ $begin_index -le $PARENT_NODE_INDEX_END ]] && [[ $PARENT_NODE_INDEX_END -ge 0 ]]; then
for node_index in `seq $(( $begin_index )) $(( $PARENT_NODE_INDEX_END ))`; do
NODE_TARGET_ADDR="${ONPREM_USER}@${NODE_IP_LIST[${node_index}]}"
NODE_LOGIN_PW="${NODE_PW_LIST[${node_index}]}"
if [[ $KEEP_DATA_OPTION = "--no-keep-data" ]]; then
printf "\n\n* >> Removing old data for parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"
CHAINS_DIR=/home/${SEASON}/ain_blockchain_data/chains
SNAPSHOTS_DIR=/home/${SEASON}/ain_blockchain_data/snapshots
LOGS_DIR=/home/${SEASON}/ain_blockchain_data/logs
echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ssh ${NODE_TARGET_ADDR} "sudo -S rm -rf $CHAINS_DIR $SNAPSHOTS_DIR $LOGS_DIR"
fi
printf "\n\n* >> Starting parent node $node_index (${NODE_TARGET_ADDR}) *********************************************************\n\n"
if [[ $node_index -ge $JSON_RPC_NODE_INDEX_GE ]] && [[ $node_index -le $JSON_RPC_NODE_INDEX_LE ]]; then
JSON_RPC_OPTION="--json-rpc"
else
JSON_RPC_OPTION=""
fi
UPDATE_FRONT_DB_OPTION="--update-front-db"
if [[ $node_index -ge $REST_FUNC_NODE_INDEX_GE ]] && [[ $node_index -le $REST_FUNC_NODE_INDEX_LE ]]; then
REST_FUNC_OPTION="--rest-func"
else
REST_FUNC_OPTION=""
fi
if [[ $node_index -ge $EVENT_HANDLER_NODE_INDEX_GE ]] && [[ $node_index -le $EVENT_HANDLER_NODE_INDEX_LE ]]; then
EVENT_HANDLER_OPTION="--event-handler"
else
EVENT_HANDLER_OPTION=""
fi
printf "ACCOUNT_INJECTION_OPTION=$ACCOUNT_INJECTION_OPTION\n"
printf "KEEP_CODE_OPTION=$KEEP_CODE_OPTION\n"
printf "KEEP_DATA_OPTION=$KEEP_DATA_OPTION\n"
printf "SYNC_MODE_OPTION=$SYNC_MODE_OPTION\n"
printf "CHOWN_DATA_OPTION=$CHOWN_DATA_OPTION\n"
printf "JSON_RPC_OPTION=$JSON_RPC_OPTION\n"
printf "UPDATE_FRONT_DB_OPTION=$UPDATE_FRONT_DB_OPTION\n"
printf "REST_FUNC_OPTION=$REST_FUNC_OPTION\n"
printf "EVENT_HANDLER_OPTION=$EVENT_HANDLER_OPTION\n"
START_NODE_CMD="ssh ${NODE_TARGET_ADDR} '$START_NODE_CMD_BASE $SEASON $ONPREM_USER 0 $node_index $KEEP_CODE_OPTION $KEEP_DATA_OPTION $SYNC_MODE_OPTION $CHOWN_DATA_OPTION $ACCOUNT_INJECTION_OPTION $JSON_RPC_OPTION $UPDATE_FRONT_DB_OPTION $REST_FUNC_OPTION $EVENT_HANDLER_OPTION'"
printf "\nSTART_NODE_CMD=$START_NODE_CMD\n"
eval "echo ${NODE_LOGIN_PW} | sshpass -f <(printf '%s\n' ${NODE_LOGIN_PW}) ${START_NODE_CMD}"
sleep 5
inject_account "$node_index"
done
fi