@@ -215,38 +215,25 @@ function deploy_node() {
215
215
# 1. Copy files for node (if necessary)
216
216
if [[ $KEEP_CODE_OPTION = " --no-keep-code" ]]; then
217
217
printf " \n<<< Copying files for node $node_index ($node_target_addr ) >>>\n\n"
218
- printf " FILES_FOR_NODE=${FILES_FOR_NODE} \n\n"
219
218
220
219
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"
221
220
SCP_CMD=" scp -r $FILES_FOR_NODE ${node_target_addr} :~/ain-blockchain"
222
- printf " SCP_CMD =$SCP_CMD \n\n"
221
+ printf " \n\nSCP_CMD =$SCP_CMD \n\n"
223
222
eval " sshpass -f <(printf '%s\n' ${node_login_pw} ) ${SCP_CMD} "
224
223
fi
225
224
226
225
# 2. Set up node (if necessary)
227
226
# ssh into each instance, set up the ubuntu VM instance (ONLY NEEDED FOR THE FIRST TIME)
228
227
if [[ $SETUP_OPTION = " --setup" ]]; then
229
- printf " \n<<< Setting up node $node_index ($node_target_addr ) >>>\n\n"
228
+ printf " \n\n <<< Setting up node $node_index ($node_target_addr ) >>>\n\n"
230
229
231
230
SETUP_CMD=" ssh $node_target_addr 'cd ./ain-blockchain; . setup_blockchain_ubuntu_onprem.sh'"
232
- printf " SETUP_CMD =$SETUP_CMD \n\n"
231
+ printf " \nSETUP_CMD =$SETUP_CMD \n\n"
233
232
eval " echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw} ) ${SETUP_CMD} "
234
233
fi
235
234
236
- # 3. Remove old data (if necessary)
237
- if [[ $KEEP_DATA_OPTION = " --no-keep-data" ]]; then
238
- printf " \n<<< Removing old data from node $node_index ($node_target_addr ) >>>\n\n"
239
-
240
- # Remove chains, snapshots, and log files (but keep the keys)
241
- CHAINS_DIR=/home/${SEASON} /ain_blockchain_data/chains
242
- SNAPSHOTS_DIR=/home/${SEASON} /ain_blockchain_data/snapshots
243
- LOGS_DIR=/home/${SEASON} /ain_blockchain_data/logs
244
- RM_CMD=" ssh $node_target_addr 'sudo -S rm -rf $CHAINS_DIR $SNAPSHOTS_DIR $LOGS_DIR '"
245
- eval " echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw} ) ${RM_CMD} "
246
- fi
247
-
248
- # 4. Start node
249
- printf " \n<<< Starting node $node_index ($node_target_addr ) >>>\n\n"
235
+ # 3. Start node
236
+ printf " \n\n<<< Starting node $node_index ($node_target_addr ) >>>\n\n"
250
237
251
238
if [[ $node_index -ge $JSON_RPC_NODE_INDEX_GE ]] && [[ $node_index -le $JSON_RPC_NODE_INDEX_LE ]]; then
252
239
JSON_RPC_OPTION=" --json-rpc"
@@ -277,14 +264,14 @@ function deploy_node() {
277
264
278
265
printf " \n"
279
266
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 '"
280
- printf " START_NODE_CMD =$START_NODE_CMD \n\n"
267
+ printf " \nSTART_NODE_CMD =$START_NODE_CMD \n\n"
281
268
eval " echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw} ) ${START_NODE_CMD} "
282
269
283
- # 5 . Inject node account
270
+ # 4 . Inject node account
284
271
sleep 5
285
272
if [[ $ACCOUNT_INJECTION_OPTION = " --keystore" ]]; then
286
273
local node_url=${NODE_URL_LIST[${node_index}]}
287
- printf " \n* >> Initializing account for node $node_index ($node_target_addr ) ********************\n\n"
274
+ printf " \n\n * >> Initializing account for node $node_index ($node_target_addr ) ********************\n\n"
288
275
printf " node_url='$node_url '\n"
289
276
290
277
KEYSTORE_FILE_PATH=" $KEYSTORE_DIR /keystore_node_$node_index .json"
@@ -296,7 +283,7 @@ function deploy_node() {
296
283
elif [[ $ACCOUNT_INJECTION_OPTION = " --mnemonic" ]]; then
297
284
local node_url=${NODE_URL_LIST[${node_index}]}
298
285
local MNEMONIC=${MNEMONIC_LIST[${node_index}]}
299
- printf " \n* >> Injecting an account for node $node_index ($node_target_addr ) ********************\n\n"
286
+ printf " \n\n * >> Injecting an account for node $node_index ($node_target_addr ) ********************\n\n"
300
287
printf " node_url='$node_url '\n"
301
288
302
289
{
@@ -306,7 +293,7 @@ function deploy_node() {
306
293
} | node inject_node_account.js $node_url $ACCOUNT_INJECTION_OPTION
307
294
else
308
295
local node_url=${NODE_URL_LIST[${node_index}]}
309
- printf " \n* >> Injecting an account for node $node_index ($node_target_addr ) ********************\n\n"
296
+ printf " \n\n * >> Injecting an account for node $node_index ($node_target_addr ) ********************\n\n"
310
297
printf " node_url='$node_url '\n"
311
298
312
299
local GENESIS_ACCOUNTS_PATH=" blockchain-configs/base/genesis_accounts.json"
@@ -317,11 +304,11 @@ function deploy_node() {
317
304
echo $PRIVATE_KEY | node inject_node_account.js $node_url $ACCOUNT_INJECTION_OPTION
318
305
fi
319
306
320
- # 6 . Wait until node is synced
321
- printf " \n<<< Waiting until node $node_index ($node_target_addr ) is synced >>>\n\n"
307
+ # 5 . Wait until node is synced
308
+ printf " \n\n <<< Waiting until node $node_index ($node_target_addr ) is synced >>>\n\n"
322
309
323
310
WAIT_CMD=" ssh $node_target_addr 'cd \$ (find /home/${SEASON} /ain-blockchain* -maxdepth 0 -type d); . wait_until_node_sync_gcp.sh'"
324
- printf " WAIT_CMD =$WAIT_CMD \n\n"
311
+ printf " \nWAIT_CMD =$WAIT_CMD \n\n"
325
312
eval " echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw} ) ${WAIT_CMD} "
326
313
}
327
314
0 commit comments