From 815f9e8bfc84975e8054f91c16ac76e03e5fe0dc Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Fri, 31 Mar 2023 12:14:55 +0900 Subject: [PATCH 1/8] Fix grafana version --- setup_monitoring_ubuntu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup_monitoring_ubuntu.sh b/setup_monitoring_ubuntu.sh index ec8fc3777..240af47ce 100644 --- a/setup_monitoring_ubuntu.sh +++ b/setup_monitoring_ubuntu.sh @@ -54,4 +54,5 @@ wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list sudo apt-get update -sudo apt-get install -y grafana \ No newline at end of file +# NOTE(platfowner): Fix grafana version to 8.5.13 for compatibility. +sudo apt-get install -y grafana=8.5.13 From 20822afc6f58688ff50a234c0b7bd774d5a7ff7f Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Fri, 31 Mar 2023 12:16:37 +0900 Subject: [PATCH 2/8] Tweak deploy script options and examples --- deploy_blockchain_genesis_gcp.sh | 4 +++- deploy_blockchain_incremental_gcp.sh | 5 ++++- deploy_monitoring_gcp.sh | 11 ++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/deploy_blockchain_genesis_gcp.sh b/deploy_blockchain_genesis_gcp.sh index 9bc64d088..2392b00e1 100644 --- a/deploy_blockchain_genesis_gcp.sh +++ b/deploy_blockchain_genesis_gcp.sh @@ -2,7 +2,9 @@ if [[ $# -lt 2 ]] || [[ $# -gt 8 ]]; then printf "Usage: bash deploy_blockchain_genesis_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> [--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-only|--skip-kill]\n" - printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --setup --keystore --no-keep-code --no-chown-data\n" + printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --keystore --no-keep-code --keep-data\n" + printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --keystore --keep-code --keep-data\n" + printf "Example: bash deploy_blockchain_genesis_gcp.sh dev 0 --setup --keystore --no-keep-code\n" printf "\n" exit fi diff --git a/deploy_blockchain_incremental_gcp.sh b/deploy_blockchain_incremental_gcp.sh index 5d28b1131..f7ffd6cba 100644 --- a/deploy_blockchain_incremental_gcp.sh +++ b/deploy_blockchain_incremental_gcp.sh @@ -2,7 +2,10 @@ if [[ $# -lt 4 ]] || [[ $# -gt 11 ]]; then printf "Usage: bash deploy_blockchain_incremental_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] <# of Shards> [--setup] [--keystore|--mnemonic|--private-key] [--keep-code|--no-keep-code] [--keep-data|--no-keep-data] [--full-sync|--fast-sync] [--chown-data|--no-chown-data]\n" - printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 1 --setup --keystore --no-keep-code --full-sync --no-chown-data\n" + printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 9 --keystore --no-keep-code --keep-data\n" + printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 0 0 --keystore --keep-code --keep-data\n" + printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 0 0 --setup --keystore --no-keep-code --keep-data\n" + printf "Example: bash deploy_blockchain_incremental_gcp.sh dev 0 -1 -1 --setup --keystore --no-keep-code\n" printf "Note: = -1 is for tracker\n" printf "Note: is inclusive\n" printf "\n" diff --git a/deploy_monitoring_gcp.sh b/deploy_monitoring_gcp.sh index c35599857..c86e3f60a 100644 --- a/deploy_monitoring_gcp.sh +++ b/deploy_monitoring_gcp.sh @@ -1,8 +1,9 @@ #!/bin/bash -if [[ "$#" -lt 2 ]]; then - printf "Usage: bash deploy_monitoring_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [--setup]\n" - printf "Example: bash deploy_monitoring_gcp.sh dev gcp_user \n" +if [[ "$#" -lt 1 ]]; then + printf "Usage: bash deploy_monitoring_gcp.sh [dev|staging|sandbox|exp|spring|summer|mainnet] [--setup]\n" + printf "Example: bash deploy_monitoring_gcp.sh dev --setup\n" + printf "Example: bash deploy_monitoring_gcp.sh dev\n" printf "\n" exit fi @@ -24,10 +25,10 @@ fi printf "SEASON=$SEASON\n" printf "PROJECT_ID=$PROJECT_ID\n" -GCP_USER="$2" +GCP_USER="runner" printf "GCP_USER=$GCP_USER\n" -OPTIONS="$3" +OPTIONS="$2" printf "OPTIONS=$OPTIONS\n" # Get confirmation. From 96e9f468b2d0971aaa44866f75b26fd7c5565a79 Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Thu, 6 Apr 2023 12:23:30 +0900 Subject: [PATCH 3/8] Upgrade node-js 16 to 18 --- package.json | 2 +- setup_blockchain_ubuntu.sh | 2 +- setup_monitoring_ubuntu.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b50aa7944..d275ef00e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/ainblockchain/ain-blockchain" }, "engines": { - "node": ">=14" + "node": ">=18" }, "scripts": { "client": "UNSAFE_PRIVATE_KEY=b22c95ffc4a5c096f7d7d0487ba963ce6ac945bdc91c79b64ce209de289bec96 DEBUG=true node ./client/index.js", diff --git a/setup_blockchain_ubuntu.sh b/setup_blockchain_ubuntu.sh index dd1f9fafb..870b59935 100644 --- a/setup_blockchain_ubuntu.sh +++ b/setup_blockchain_ubuntu.sh @@ -10,7 +10,7 @@ apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options: printf 'Installing NodeJS..\n' sudo apt update sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates -curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash - +curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt -y install nodejs printf 'node -v\n' diff --git a/setup_monitoring_ubuntu.sh b/setup_monitoring_ubuntu.sh index 240af47ce..347c454c3 100644 --- a/setup_monitoring_ubuntu.sh +++ b/setup_monitoring_ubuntu.sh @@ -4,7 +4,7 @@ printf "\n[[[[[ setup_monitoring_ubuntu.sh ]]]]]\n\n" printf 'Installing NodeJS..\n' sudo apt update -curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - +curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - sudo apt install -y nodejs printf 'node -v\n' From 0440c34f0816b96ba77893669cfe51d09a27aac0 Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Thu, 6 Apr 2023 15:52:08 +0900 Subject: [PATCH 4/8] Upgrade github build pipeline node version to 18 --- .github/workflows/github-actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 94029868a..1585dfede 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] - node-version: [ '14.x', '16.x' ] + node-version: [ '18.x' ] runs-on: ${{ matrix.os }} steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it From b51e87587e7ba1747a4e68b3b616cb548b544dd0 Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Tue, 11 Apr 2023 18:15:05 +0900 Subject: [PATCH 5/8] Uninstall existing nodejs before installing --- setup_blockchain_ubuntu.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup_blockchain_ubuntu.sh b/setup_blockchain_ubuntu.sh index 870b59935..0e6f0e0b4 100644 --- a/setup_blockchain_ubuntu.sh +++ b/setup_blockchain_ubuntu.sh @@ -7,6 +7,10 @@ sudo apt update # skip prompting (see https://serverfault.com/questions/527789/how-to-automate-changed-config-files-during-apt-get-upgrade-in-ubuntu-12) apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade +printf 'Uninstalling NodeJS..\n' +sudo apt-get -y purge nodejs +sudo apt-get -y autoremove + printf 'Installing NodeJS..\n' sudo apt update sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates From 4366975d22898da117586cecd13525926ca711c3 Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Tue, 11 Apr 2023 18:26:35 +0900 Subject: [PATCH 6/8] Rename: inject_account_gcp.js -> inject_node_account.js --- README.md | 6 +++--- deploy_blockchain_genesis_gcp.sh | 6 +++--- deploy_blockchain_incremental_gcp.sh | 6 +++--- deploy_blockchain_sandbox_gcp.sh | 2 +- inject_account_gcp.js => inject_node_account.js | 2 +- start_node_docker.sh | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) rename inject_account_gcp.js => inject_node_account.js (97%) diff --git a/README.md b/README.md index 77cc3ed76..5250bd86f 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,9 @@ You can use some environment variables, and these have the following options. ``` After the node is executed, you should inject your account into the node. ``` -node inject_account_gcp.js --private-key -node inject_account_gcp.js --keystore -node inject_account_gcp.js --mnemonic +node inject_node_account.js --private-key +node inject_node_account.js --keystore +node inject_node_account.js --mnemonic ``` If you want to inject your account automatically, add one of these environment variables before running the node. ``` diff --git a/deploy_blockchain_genesis_gcp.sh b/deploy_blockchain_genesis_gcp.sh index 2392b00e1..ffc1aaa8d 100644 --- a/deploy_blockchain_genesis_gcp.sh +++ b/deploy_blockchain_genesis_gcp.sh @@ -160,7 +160,7 @@ function inject_account() { echo $KEYSTORE_FILE_PATH sleep 1 echo $PASSWORD - } | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + } | node inject_node_account.js $node_ip_addr $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" @@ -169,7 +169,7 @@ function inject_account() { echo $MNEMONIC sleep 1 echo 0 - } | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + } | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION else printf "\n* >> Injecting an account for node $node_index ********************\n\n" printf "node_ip_addr='$node_ip_addr'\n" @@ -178,7 +178,7 @@ function inject_account() { 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_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION fi } diff --git a/deploy_blockchain_incremental_gcp.sh b/deploy_blockchain_incremental_gcp.sh index f7ffd6cba..8d6982b6e 100644 --- a/deploy_blockchain_incremental_gcp.sh +++ b/deploy_blockchain_incremental_gcp.sh @@ -269,7 +269,7 @@ function deploy_node() { echo $KEYSTORE_FILE_PATH sleep 1 echo $PASSWORD - } | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + } | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION elif [[ $ACCOUNT_INJECTION_OPTION = "--mnemonic" ]]; then local node_ip_addr=${IP_ADDR_LIST[${node_index}]} local MNEMONIC=${MNEMONIC_LIST[${node_index}]} @@ -280,7 +280,7 @@ function deploy_node() { echo $MNEMONIC sleep 1 echo 0 - } | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + } | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION else local node_ip_addr=${IP_ADDR_LIST[${node_index}]} printf "\n* >> Injecting an account for node $node_index ($node_target_addr) ********************\n\n" @@ -290,7 +290,7 @@ function deploy_node() { 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_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION fi # 5. Wait until node is synced diff --git a/deploy_blockchain_sandbox_gcp.sh b/deploy_blockchain_sandbox_gcp.sh index e009a195f..c1679ed28 100644 --- a/deploy_blockchain_sandbox_gcp.sh +++ b/deploy_blockchain_sandbox_gcp.sh @@ -100,7 +100,7 @@ function inject_account() { printf "\n* >> Injecting an account for node $node_index ********************\n\n" printf "node_ip_addr='$node_ip_addr'\n" PRIVATE_KEY=$(cat $GENESIS_ACCOUNTS_PATH | jq -r '.others['$node_index'].private_key') - echo $PRIVATE_KEY | node inject_account_gcp.js $node_ip_addr $ACCOUNT_INJECTION_OPTION + echo $PRIVATE_KEY | node inject_node_account.js $node_ip_addr $ACCOUNT_INJECTION_OPTION } # GCP node address diff --git a/inject_account_gcp.js b/inject_node_account.js similarity index 97% rename from inject_account_gcp.js rename to inject_node_account.js index 2946406e5..d0784efee 100644 --- a/inject_account_gcp.js +++ b/inject_node_account.js @@ -142,7 +142,7 @@ async function processArguments() { } function usage() { - console.log('\nExample commandlines:\n node inject_account_gcp.js \n'); + console.log('\nExample commandlines:\n node inject_node_account.js \n'); process.exit(0); } diff --git a/start_node_docker.sh b/start_node_docker.sh index 254402198..7c83ce8f1 100644 --- a/start_node_docker.sh +++ b/start_node_docker.sh @@ -31,7 +31,7 @@ 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_account_gcp.js $NODE_ENDPOINT --private-key + echo $PRIVATE_KEY | node inject_node_account.js $NODE_ENDPOINT --private-key unset PRIVATE_KEY fi elif [[ $ACCOUNT_INJECTION_OPTION = "keystore" ]]; then @@ -42,7 +42,7 @@ elif [[ $ACCOUNT_INJECTION_OPTION = "keystore" ]]; then echo $KEYSTORE_FILE_PATH sleep 1 echo $PASSWORD - } | node inject_account_gcp.js $NODE_ENDPOINT --keystore + } | node inject_node_account.js $NODE_ENDPOINT --keystore fi elif [[ $ACCOUNT_INJECTION_OPTION = "mnemonic" ]]; then if [[ -z "$MNEMONIC" ]]; then @@ -52,7 +52,7 @@ elif [[ $ACCOUNT_INJECTION_OPTION = "mnemonic" ]]; then echo $MNEMONIC sleep 1 echo 0 - } | node inject_account_gcp.js $NODE_ENDPOINT --mnemonic + } | node inject_node_account.js $NODE_ENDPOINT --mnemonic unset MNEMONIC fi else From bd45b282c74237f20cccbac2089896709e196d33 Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Wed, 12 Apr 2023 12:20:05 +0900 Subject: [PATCH 7/8] Skip prompting for daemon restart --- setup_blockchain_ubuntu.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/setup_blockchain_ubuntu.sh b/setup_blockchain_ubuntu.sh index 0e6f0e0b4..a230b78a1 100644 --- a/setup_blockchain_ubuntu.sh +++ b/setup_blockchain_ubuntu.sh @@ -2,20 +2,21 @@ printf "\n[[[[[ setup_blockchain_ubuntu.sh ]]]]]\n\n" -printf 'Upgrading apt..\n' +printf '\n[[ Upgrading apt.. ]]\n' sudo apt update # skip prompting (see https://serverfault.com/questions/527789/how-to-automate-changed-config-files-during-apt-get-upgrade-in-ubuntu-12) -apt-get --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade +sudo apt-get --yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade -printf 'Uninstalling NodeJS..\n' +printf '\n[[ Uninstalling NodeJS.. ]]\n' sudo apt-get -y purge nodejs sudo apt-get -y autoremove -printf 'Installing NodeJS..\n' +printf '\n[[ Installing NodeJS.. ]]\n' sudo apt update sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash - -sudo apt -y install nodejs +# skip prompting for daemon restart (see https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services) +sudo NEEDRESTART_MODE=a apt -y install nodejs printf 'node -v\n' node -v @@ -24,29 +25,30 @@ printf 'npm --version\n' npm --version -printf 'Installing yarn..\n' +printf '\n[[ Installing yarn.. ]]\n' sudo npm install -g yarn printf 'yarn --version\n' sudo yarn --version -printf 'Installing make..\n' +printf '\n[[ Installing make.. ]]\n' sudo apt update -sudo apt-get install -y build-essential +# skip prompting for daemon restart (see https://askubuntu.com/questions/1367139/apt-get-upgrade-auto-restart-services) +sudo NEEDRESTART_MODE=a apt-get install -y build-essential printf 'make --version\n' make --version -printf 'Installing vim..\n' +printf '\n[[ Installing vim.. ]]\n' sudo apt update sudo apt install -y vim printf 'vim --version\n' vim --version -printf 'Installing jq..\n' +printf '\n[[ Installing jq.. ]]\n' sudo apt update sudo apt install -y jq From e52775dcbf8a55a63d9e5727aafbd059f446bc4b Mon Sep 17 00:00:00 2001 From: Dongil Seo Date: Thu, 20 Apr 2023 11:09:15 +0900 Subject: [PATCH 8/8] Upgrade package version to 1.0.13 --- client/protocol_versions.json | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/protocol_versions.json b/client/protocol_versions.json index 8780756c6..ca6224fee 100644 --- a/client/protocol_versions.json +++ b/client/protocol_versions.json @@ -113,5 +113,8 @@ }, "1.0.12": { "min": "1.0.0" + }, + "1.0.13": { + "min": "1.0.0" } } \ No newline at end of file diff --git a/package.json b/package.json index d275ef00e..c5ed41868 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ain-blockchain", "description": "AI Network Blockchain", - "version": "1.0.12", + "version": "1.0.13", "private": true, "license": "MIT", "author": "dev@ainetwork.ai",