Skip to content

Commit

Permalink
Merge pull request #1328 from ainblockchain/bugfix/platfowner/bugfix
Browse files Browse the repository at this point in the history
Improve deploy-related scripts
platfowner authored Sep 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents c040808 + 8ecd02d commit 6e6ffdb
Showing 15 changed files with 158 additions and 81 deletions.
51 changes: 31 additions & 20 deletions config_client_api_ip_whitelist.sh
Original file line number Diff line number Diff line change
@@ -2,44 +2,54 @@

function usage() {
printf "\n"
printf "Usage: bash config_client_api_ip_whitelist.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [get|add|remove] [<IP Address>]\n"
printf "Example: bash config_client_api_ip_whitelist.sh dev get\n"
printf "Example: bash config_client_api_ip_whitelist.sh dev add 32.190.239.181\n"
printf "Example: bash config_client_api_ip_whitelist.sh dev add '*'\n"
printf "Example: bash config_client_api_ip_whitelist.sh dev remove 32.190.239.181\n"
printf "Usage: bash config_client_api_ip_whitelist.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [gcp|onprem] [get|add|remove] [<IP Address>]\n"
printf "Example: bash config_client_api_ip_whitelist.sh staging onprem get\n"
printf "Example: bash config_client_api_ip_whitelist.sh staging onprem add 32.190.239.181\n"
printf "Example: bash config_client_api_ip_whitelist.sh staging onprem add '*'\n"
printf "Example: bash config_client_api_ip_whitelist.sh staging onprem remove 32.190.239.181\n"
printf "\n"
exit
}

if [[ $# -lt 2 ]] || [[ $# -gt 3 ]]; then
if [[ $# -lt 3 ]] || [[ $# -gt 4 ]]; then
usage
fi
printf "\n[[[[[ config_client_api_ip_whitelist.sh ]]]]]\n\n"

if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[ "$1" = 'exp' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid <Project/Season> argument: $1\n"
printf "\nInvalid <Season> argument: $1\n"
usage
fi
printf "SEASON=$SEASON\n"

if [[ "$2" = 'get' ]]; then
COMMAND="$2"
IP_ADDR="$3"
if [[ "$2" = 'gcp' ]] || [[ "$2" = 'onprem' ]]; then
BLOCKCHAIN_HOSTING="$2"
else
printf "\nInvalid <Blockchain Hosting> argument: $2\n"
usage
fi
printf "BLOCKCHAIN_HOSTING=$BLOCKCHAIN_HOSTING\n"

COMMAND="$3"
IP_ADDR=""
if [[ $# = 4 ]]; then
IP_ADDR="$4"
fi

if [[ "$COMMAND" = 'get' ]]; then
if [[ ! "$IP_ADDR" = "" ]]; then
printf "\nInvalid argument: $IP_ADDR\n"
printf "\nInvalid <IP Address> argument: $IP_ADDR\n"
usage
fi
elif [[ "$2" = 'add' ]] || [[ "$2" = 'remove' ]]; then
COMMAND="$2"
IP_ADDR="$3"
elif [[ "$COMMAND" = 'add' ]] || [[ "$COMMAND" = 'remove' ]]; then
if [[ "$IP_ADDR" = "" ]]; then
printf "\nInvalid <IP Address> argument: $IP_ADDR\n"
usage
fi
else
printf "Invalid <Command> argument: $2\n"
printf "\nInvalid <Command> argument: $COMMAND\n"
usage
fi
printf "COMMAND=$COMMAND\n"
@@ -65,7 +75,7 @@ else
fi

# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/$SEASON.txt
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_${BLOCKCHAIN_HOSTING}.txt

# Get keystore password
printf "Enter keystore password: "
@@ -101,16 +111,17 @@ function config_node() {
printf "\n\n<<< Configuring ip whitelist of node $node_index ($node_url) >>>\n\n"

KEYSTORE_FILE_PATH="$KEYSTORE_DIR/keystore_node_$node_index.json"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID keystore $KEYSTORE_FILE_PATH"
if [[ ! $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="$CONFIG_NODE_CMD '$IP_ADDR'"
if [[ $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID keystore $KEYSTORE_FILE_PATH"
else
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID $IP_ADDR keystore $KEYSTORE_FILE_PATH"
fi

printf "\n"
printf "CONFIG_NODE_CMD=$CONFIG_NODE_CMD\n\n"
eval "echo $KEYSTORE_PW | $CONFIG_NODE_CMD"
}

for j in `seq $(( 0 )) $(( 9 ))`; do
for j in `seq $(( 0 )) $(( 4 ))`; do
config_node "$j"
done
60 changes: 35 additions & 25 deletions config_node_param.sh
Original file line number Diff line number Diff line change
@@ -2,42 +2,51 @@

function usage() {
printf "\n"
printf "Usage: bash config_node_param.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [get|add|remove] <Param> [<Value>]\n"
printf "Example: bash config_node_param.sh dev get DEV_CLIENT_API_IP_WHITELIST\n"
printf "Example: bash config_node_param.sh dev add DEV_CLIENT_API_IP_WHITELIST 32.190.239.181\n"
printf "Example: bash config_node_param.sh dev add DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh dev remove DEV_CLIENT_API_IP_WHITELIST 32.190.239.181\n"
printf "Example: bash config_node_param.sh dev set DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh dev get CORS_WHITELIST\n"
printf "Usage: bash config_node_param.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [gcp|onprem] [get|add|remove] <Param> [<Value>]\n"
printf "Example: bash config_node_param.sh staging onprem get DEV_CLIENT_API_IP_WHITELIST\n"
printf "Example: bash config_node_param.sh staging onprem add DEV_CLIENT_API_IP_WHITELIST 32.190.239.181\n"
printf "Example: bash config_node_param.sh staging onprem add DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh staging onprem remove DEV_CLIENT_API_IP_WHITELIST 32.190.239.181\n"
printf "Example: bash config_node_param.sh staging onprem set DEV_CLIENT_API_IP_WHITELIST '*'\n"
printf "Example: bash config_node_param.sh staging onprem get CORS_WHITELIST\n"
printf "\n"
exit
}

if [[ $# -lt 3 ]] || [[ $# -gt 4 ]]; then
if [[ $# -lt 4 ]] || [[ $# -gt 5 ]]; then
usage
fi
printf "\n[[[[[ config_node_param.sh ]]]]]\n\n"

if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[ "$1" = 'exp' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid <Project/Season> argument: $1\n"
printf "\nInvalid <Season> argument: $1\n"
usage
fi
printf "SEASON=$SEASON\n"

if [[ "$2" = 'get' ]]; then
COMMAND="$2"
PARAM="$3"
VALUE="$4"
if [[ "$2" = 'gcp' ]] || [[ "$2" = 'onprem' ]]; then
BLOCKCHAIN_HOSTING="$2"
else
printf "\nInvalid <Blockchain Hosting> argument: $2\n"
usage
fi
printf "BLOCKCHAIN_HOSTING=$BLOCKCHAIN_HOSTING\n"

COMMAND="$3"
PARAM="$4"
VALUE=""
if [[ $# = 5 ]]; then
VALUE="$5"
fi

if [[ "$COMMAND" = 'get' ]]; then
if [[ ! "$VALUE" = "" ]]; then
printf "\nInvalid argument: $VALUE\n"
printf "\nInvalid <Value> argument: $VALUE\n"
usage
fi
elif [[ "$2" = 'add' ]] || [[ "$2" = 'remove' ]] || [[ "$2" = 'set' ]]; then
COMMAND="$2"
PARAM="$3"
VALUE="$4"
elif [[ "$COMMAND" = 'add' ]] || [[ "$COMMAND" = 'remove' ]] || [[ "$COMMAND" = 'set' ]]; then
if [[ "$PARAM" = "" ]]; then
printf "\nInvalid <Param> argument: $PARAM\n"
usage
@@ -47,7 +56,7 @@ elif [[ "$2" = 'add' ]] || [[ "$2" = 'remove' ]] || [[ "$2" = 'set' ]]; then
usage
fi
else
printf "Invalid <Command> argument: $2\n"
printf "\nInvalid <Command> argument: $COMMAND\n"
usage
fi
printf "COMMAND=$COMMAND\n"
@@ -74,7 +83,7 @@ else
fi

# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/$SEASON.txt
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_${BLOCKCHAIN_HOSTING}.txt

# Get keystore password
printf "Enter keystore password: "
@@ -109,19 +118,20 @@ function config_node() {
local node_index="$1"
local node_url=${NODE_URL_LIST[${node_index}]}

printf "\n\n<<< Configuring ip whitelist of node $node_index ($node_url) >>>\n\n"
printf "\n\n<<< Configuring node params of node $node_index ($node_url) >>>\n\n"

KEYSTORE_FILE_PATH="$KEYSTORE_DIR/keystore_node_$node_index.json"
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID keystore $KEYSTORE_FILE_PATH $PARAM"
if [[ ! $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="$CONFIG_NODE_CMD '$VALUE'"
if [[ $COMMAND = "get" ]]; then
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID $PARAM $VALUE keystore $KEYSTORE_FILE_PATH"
else
CONFIG_NODE_CMD="node tools/api-access/$COMMAND_NODE_JS_FILE $node_url $CHAIN_ID $PARAM $VALUE keystore $KEYSTORE_FILE_PATH"
fi

printf "\n"
printf "CONFIG_NODE_CMD=$CONFIG_NODE_CMD\n\n"
eval "echo $KEYSTORE_PW | $CONFIG_NODE_CMD"
}

for j in `seq $(( 0 )) $(( 9 ))`; do
for j in `seq $(( 0 )) $(( 4 ))`; do
config_node "$j"
done
38 changes: 33 additions & 5 deletions copy_blockchain_data_gcp.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/bin/bash

function usage() {
printf "Usage: bash copy_blockchain_data_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <Node Index> [download|upload]\n"
printf "Usage: bash copy_blockchain_data_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <Node Index> [download|upload] [<Old Port Number> <New Port Number>]\n"
printf "Example: bash copy_blockchain_data_gcp.sh spring 0 download\n"
printf "Example: bash copy_blockchain_data_gcp.sh spring 1 upload\n"
printf "Example: bash copy_blockchain_data_gcp.sh spring 1 upload 8079 8080\n"
printf "\n"
exit
}

if [[ $# -lt 3 ]] || [[ $# -gt 3 ]]; then
if [[ $# != 3 ]] && [[ $# != 5 ]]; then
usage
fi

@@ -22,7 +22,7 @@ if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[
PROJECT_ID="testnet-$1-ground"
fi
else
printf "Invalid <Project/Season> argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "\n"
@@ -56,6 +56,28 @@ else
fi
printf "COMMAND=$COMMAND\n"

if [[ "$COMMAND" = 'download' ]]; then
if [[ $# != 3 ]]; then
printf "\n"
printf "<Old Port Number> and <New Port Number> can be used only with 'upload' command.\n"
printf "\n"
usage
fi
OLD_PORT=""
NEW_PORT=""
else
if [[ $# != 5 ]]; then
printf "\n"
printf "<Old Port Number> and <New Port Number> should be specified with 'upload' command.\n"
printf "\n"
usage
fi
OLD_PORT="$4"
NEW_PORT="$5"
fi
printf "OLD_PORT=$OLD_PORT\n"
printf "NEW_PORT=$NEW_PORT\n"

# Get confirmation.
if [[ "$SEASON" = "mainnet" ]]; then
printf "\n"
@@ -151,7 +173,13 @@ function upload_data() {
printf "TGZ_CMD=$TGZ_CMD\n\n"
eval $TGZ_CMD

# 3. Clean up tgz file for node
# 3. Change port number directory
printf "\n\n<<< Changing port number directory for node $node_index >>>\n\n"
MV_CMD="gcloud compute ssh $node_target_addr --command 'mv /home/ain_blockchain_data/chains/${OLD_PORT} /home/ain_blockchain_data/chains/${NEW_PORT}; mv /home/ain_blockchain_data/snapshots/${OLD_PORT} /home/ain_blockchain_data/snapshots/${NEW_PORT}' --project $PROJECT_ID --zone $node_zone"
printf "MV_CMD=$MV_CMD\n\n"
eval $MV_CMD

# 4. Clean up tgz file for node
printf "\n\n<<< Cleaning up tgz file for node $node_index >>>\n\n"
CLEANUP_CMD="gcloud compute ssh $node_target_addr --command 'rm ~/ain_blockchain_data.tar.gz' --project $PROJECT_ID --zone $node_zone"
printf "CLEANUP_CMD=$CLEANUP_CMD\n\n"
38 changes: 33 additions & 5 deletions copy_blockchain_data_onprem.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/bin/bash

function usage() {
printf "Usage: bash copy_blockchain_data_onprem.sh [staging|spring|mainnet] <Node Index> [download|upload]\n"
printf "Usage: bash copy_blockchain_data_onprem.sh [staging|spring|mainnet] <Node Index> [download|upload] [<Old Port Number> <New Port Number>]\n"
printf "Example: bash copy_blockchain_data_onprem.sh staging 0 download\n"
printf "Example: bash copy_blockchain_data_onprem.sh staging 1 upload\n"
printf "Example: bash copy_blockchain_data_onprem.sh staging 1 upload 8080 8079\n"
printf "\n"
exit
}

if [[ $# -lt 3 ]] || [[ $# -gt 3 ]]; then
if [[ $# != 3 ]] && [[ $# != 5 ]]; then
usage
fi

if [[ "$1" = 'staging' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid <Project/Season> argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "\n"
@@ -48,6 +48,28 @@ else
fi
printf "COMMAND=$COMMAND\n"

if [[ "$COMMAND" = 'download' ]]; then
if [[ $# != 3 ]]; then
printf "\n"
printf "<Old Port Number> and <New Port Number> can be used only with 'upload' command.\n"
printf "\n"
usage
fi
OLD_PORT=""
NEW_PORT=""
else
if [[ $# != 5 ]]; then
printf "\n"
printf "<Old Port Number> and <New Port Number> should be specified with 'upload' command.\n"
printf "\n"
usage
fi
OLD_PORT="$4"
NEW_PORT="$5"
fi
printf "OLD_PORT=$OLD_PORT\n"
printf "NEW_PORT=$NEW_PORT\n"

# Get confirmation.
if [[ "$SEASON" = "mainnet" ]]; then
printf "\n"
@@ -120,7 +142,13 @@ function upload_data() {
printf "TGZ_CMD=$TGZ_CMD\n\n"
eval "echo ${node_login_pw} | sshpass -f <(printf '%s\n' ${node_login_pw}) ${TGZ_CMD}"

# 3. Clean up tgz file for node
# 3. Change port number directory
printf "\n\n<<< Changing port number directory for node $node_index >>>\n\n"
MV_CMD="ssh $node_target_addr 'mv /home/${SEASON}/ain_blockchain_data/chains/${OLD_PORT} /home/${SEASON}/ain_blockchain_data/chains/${NEW_PORT}; mv /home/${SEASON}/ain_blockchain_data/snapshots/${OLD_PORT} /home/${SEASON}/ain_blockchain_data/snapshots/${NEW_PORT}'"
printf "MV_CMD=$MV_CMD\n\n"
eval "sshpass -f <(printf '%s\n' ${node_login_pw}) ${MV_CMD}"

# 4. Clean up tgz file for node
printf "\n\n<<< Cleaning up tgz file for node $node_index >>>\n\n"
CLEANUP_CMD="ssh $node_target_addr 'rm ~/ain_blockchain_data.tar.gz'"
printf "CLEANUP_CMD=$CLEANUP_CMD\n\n"
4 changes: 2 additions & 2 deletions deploy_blockchain_genesis_gcp.sh
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[
PROJECT_ID="testnet-$1-ground"
fi
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
@@ -162,7 +162,7 @@ fi

if [[ ! $KILL_OPTION = '--kill-only' ]]; then
# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/$SEASON.txt
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_gcp.txt
if [[ "$ACCOUNT_INJECTION_OPTION" = "--keystore" ]]; then
# Get keystore password
printf "Enter keystore password: "
2 changes: 1 addition & 1 deletion deploy_blockchain_genesis_onprem.sh
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ 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"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
4 changes: 2 additions & 2 deletions deploy_blockchain_incremental_gcp.sh
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[
PROJECT_ID="testnet-$1-ground"
fi
else
printf "Invalid <Project/Season> argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
@@ -161,7 +161,7 @@ fi

if [[ ! $KILL_OPTION = '--kill-only' ]]; then
# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/$SEASON.txt
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_gcp.txt
if [[ $ACCOUNT_INJECTION_OPTION = "--keystore" ]]; then
# Get keystore password
printf "Enter keystore password: "
2 changes: 1 addition & 1 deletion deploy_blockchain_incremental_onprem.sh
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ printf "\n[[[[[ deploy_blockchain_incremental_onprem.sh ]]]]]\n\n"
if [[ "$1" = 'staging' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid <Project/Season> argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
2 changes: 1 addition & 1 deletion deploy_blockchain_sandbox_gcp.sh
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ then
fi

# Read node urls
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/$SEASON.txt
IFS=$'\n' read -d '' -r -a NODE_URL_LIST < ./ip_addresses/${SEASON}_gcp.txt

function inject_account() {
local node_index="$1"
2 changes: 1 addition & 1 deletion deploy_monitoring_gcp.sh
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[
PROJECT_ID="testnet-$1-ground"
fi
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
printf "SEASON=$SEASON\n"
2 changes: 1 addition & 1 deletion setup_monitoring_gcp.sh
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ fi
printf "\n[[[[[ setup_monitoring_gcp.sh ]]]]]\n\n"

if [[ "$1" != 'dev' ]] && [[ "$1" != 'staging' ]] && [[ "$1" != 'sandbox' ]] && [[ "$1" != 'exp' ]] && [[ "$1" != 'spring' ]] && [[ "$1" != 'summer' ]] && [[ "$1" != 'mainnet' ]]; then
printf "Invalid season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi

8 changes: 4 additions & 4 deletions start_node_genesis_gcp.sh
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ function parse_options() {
if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[ "$1" = 'exp' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
GCP_USER="$2"
@@ -119,7 +119,7 @@ printf "PEER_WHITELIST_NODE_INDEX_LE=$PEER_WHITELIST_NODE_INDEX_LE\n"

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "--private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
return 1
fi

@@ -293,14 +293,14 @@ elif [[ $SEASON = 'dev' ]]; then
elif [[ $SHARD_INDEX = 20 ]]; then
export TRACKER_UPDATE_JSON_RPC_URL="http://35.201.248.92:8080/json-rpc" # dev-shard-20-tracker-ip
else
printf "Invalid shard ID argument: $SHARD_INDEX\n"
printf "Invalid <Shard ID> argument: $SHARD_INDEX\n"
return 1
fi
if [[ $SHARD_INDEX -gt 0 ]]; then
export BLOCKCHAIN_CONFIGS_DIR=blockchain-configs/sim-shard
fi
else
printf "Invalid season argument: $SEASON\n"
printf "Invalid <Season> argument: $SEASON\n"
return 1
fi

8 changes: 4 additions & 4 deletions start_node_genesis_onprem.sh
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ function parse_options() {
if [[ "$1" = 'staging' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
ONPREM_USER="$2"
@@ -129,7 +129,7 @@ printf "PEER_WHITELIST_NODE_INDEX_LE=$PEER_WHITELIST_NODE_INDEX_LE\n"

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "--private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
return 1
fi

@@ -183,7 +183,7 @@ if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
printf 'Setting up new working directory..\n'
sudo rm -rf /home/${SEASON}/ain-blockchain*
# NOTE(platfowner): Add $SEASON to the node job name to be selectively killed in restarts.
CODE_CMD="sudo mkdir -p /home/${SEASON}; sudo chmod -R 777 /home/${SEASON}; sudo chown -R $ONPREM_USER:$ONPREM_USER /home/${SEASON}; cd ~; sudo mv ./ain-blockchain /home/${SEASON}; sudo chmod -R 777 /home/${SEASON}/ain-blockchain; sudo chown -R $ONPREM_USER:$ONPREM_USER /home/${SEASON}/ain-blockchain; cd /home/${SEASON}/ain-blockchain; mv client/index.js client/${SEASON}-ain-blockchain-index.js"
CODE_CMD="sudo mkdir -p /home/${SEASON}; sudo chmod 777 /home/${SEASON}; sudo chown $ONPREM_USER:$ONPREM_USER /home/${SEASON}; cd ~; sudo mv ./ain-blockchain /home/${SEASON}; sudo chmod -R 777 /home/${SEASON}/ain-blockchain; sudo chown -R $ONPREM_USER:$ONPREM_USER /home/${SEASON}/ain-blockchain; cd /home/${SEASON}/ain-blockchain; mv client/index.js client/${SEASON}-ain-blockchain-index.js"
printf "\nCODE_CMD=$CODE_CMD\n"
eval $CODE_CMD
else
@@ -240,7 +240,7 @@ elif [[ $SEASON = 'staging' ]]; then
export PEER_WHITELIST="0x00ADEc28B6a845a085e03591bE7550dd68673C1C,0x01A0980d2D4e418c7F27e1ef539d01A5b5E93204,0x02A2A1DF4f630d760c82BE07F18e5065d103Fa00,0x03AAb7b6f16A92A1dfe018Fe34ee420eb098B98A,0x04A456C92A880cd59D7145C457475515a6f6E0f2,0x05A1247A7400f0C2A893611adD1505743552c631,0x06AD9C8F611f1e9d9CACD4738167A51aA2e80a1A,0x07A43138CC760C85A5B1F115aa60eADEaa0bf417,0x08Aed7AF9354435c38d52143EE50ac839D20696b,0x09A0d53FDf1c36A131938eb379b98910e55EEfe1"
fi
else
printf "Invalid season argument: $SEASON\n"
printf "Invalid <Season> argument: $SEASON\n"
return 1
fi

8 changes: 4 additions & 4 deletions start_node_incremental_gcp.sh
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ function parse_options() {
if [[ "$1" = 'dev' ]] || [[ "$1" = 'staging' ]] || [[ "$1" = 'sandbox' ]] || [[ "$1" = 'exp' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'summer' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
GCP_USER="$2"
@@ -224,7 +224,7 @@ elif [[ $SEASON = 'dev' ]]; then
EOF
fi
else
printf "Invalid <Project/Season> argument: $SEASON\n"
printf "Invalid <Season> argument: $SEASON\n"
exit
fi

@@ -235,7 +235,7 @@ printf "PEER_WHITELIST=$PEER_WHITELIST\n"

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "--private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
return 1
fi

@@ -285,7 +285,7 @@ fi

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
exit
fi

10 changes: 5 additions & 5 deletions start_node_incremental_onprem.sh
Original file line number Diff line number Diff line change
@@ -60,7 +60,7 @@ function parse_options() {
if [[ "$1" = 'staging' ]] || [[ "$1" = 'spring' ]] || [[ "$1" = 'mainnet' ]]; then
SEASON="$1"
else
printf "Invalid project/season argument: $1\n"
printf "Invalid <Season> argument: $1\n"
exit
fi
ONPREM_USER="$2"
@@ -157,7 +157,7 @@ elif [[ $SEASON = 'staging' ]]; then
# NOTE(platfowner): For non-api-servers, the value in the blockchain configs
# (https://staging-api.ainetwork.ai/json-rpc) is used.
else
printf "Invalid <Project/Season> argument: $SEASON\n"
printf "Invalid <Season> argument: $SEASON\n"
exit
fi

@@ -168,7 +168,7 @@ printf "PEER_WHITELIST=$PEER_WHITELIST\n"

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "--private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
return 1
fi

@@ -218,7 +218,7 @@ fi

# NOTE(liayoo): Currently this script supports [--keystore|--mnemonic] option only for the parent chain.
if [[ $ACCOUNT_INJECTION_OPTION != "private_key" ]] && [[ "$SHARD_INDEX" -gt 0 ]]; then
printf 'Invalid account injection option\n'
printf 'Invalid <Account Injection> option\n'
exit
fi

@@ -247,7 +247,7 @@ if [[ $KEEP_CODE_OPTION = "--no-keep-code" ]]; then
printf '\n'
printf 'Setting up new working directory..\n'
# NOTE(platfowner): Add $SEASON to the node job name to be selectively killed in restarts.
CODE_CMD="sudo mkdir -p /home/${SEASON}; sudo chmod -R 777 /home/${SEASON}; sudo chown -R $ONPREM_USER:$ONPREM_USER /home/${SEASON}; cd ~; sudo mv ain-blockchain $NEW_DIR_PATH; sudo chmod -R 777 $NEW_DIR_PATH; sudo chown -R $ONPREM_USER:$ONPREM_USER $NEW_DIR_PATH; cd $NEW_DIR_PATH; mv client/index.js client/${SEASON}-ain-blockchain-index.js"
CODE_CMD="sudo mkdir -p /home/${SEASON}; sudo chmod 777 /home/${SEASON}; sudo chown $ONPREM_USER:$ONPREM_USER /home/${SEASON}; cd ~; sudo mv ain-blockchain $NEW_DIR_PATH; sudo chmod -R 777 $NEW_DIR_PATH; sudo chown -R $ONPREM_USER:$ONPREM_USER $NEW_DIR_PATH; cd $NEW_DIR_PATH; mv client/index.js client/${SEASON}-ain-blockchain-index.js"
printf "\nCODE_CMD=$CODE_CMD\n"
eval $CODE_CMD
else

0 comments on commit 6e6ffdb

Please sign in to comment.