From 48c93af2080f8479a7adb29158ec501f1763766e Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Wed, 27 May 2020 21:58:19 +0530 Subject: [PATCH 1/7] fix: binary package for sentry node --- .github/workflows/linuxpackage.yml | 42 +++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index f41bc311ad..07da48d48c 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -39,7 +39,7 @@ jobs: [Service] WorkingDirectory=/etc/bor/ EnvironmentFile=/etc/bor/metadata - ExecStart=/bin/bash -c "/usr/bin/bor --datadir /etc/bor/dataDir --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid ${NETWORK_ID} --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s' --keystore /etc/bor/dataDir/keystore --unlock ${VALIDATOR_ADDRESS} --password /etc/bor/dataDir/password.txt --allow-insecure-unlock --maxpeers 150 --mine" + ExecStart=/etc/bor/start.sh ${NETWORK_ID} ${VALIDATOR_ADDRESS} ${NODE_TYPE} Type=simple User=root EOF @@ -47,11 +47,51 @@ jobs: cat > after_install.sh <<- "EOF" #!/bin/bash touch /etc/bor/metadata + touch /etc/bor/start.sh EOF cat > metadata <<- "EOF" NETWORK_ID= VALIDATOR_ADDRESS= + NODE_TYPE=sentry + EOF + + cat > start.sh <<- "EOF" + NETWORK_ID=$1 + VALIDATOR_ADDRESS=$2 + NODE_TYPE=$3 + + args="/usr/bin/bor --datadir /etc/bor/dataDir --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s'" + + if [[ $NODE_TYPE == 'validator' ]]; then + args+=" + --keystore $BOR_DIR/keystore \ + --unlock $VALIDATOR_ADDRESS \ + --password $BOR_DIR/password.txt \ + --allow-insecure-unlock \ + --nodiscover --maxpeers 1 \ + --mine + " + fi + + if [[ $NODE_TYPE == 'sentry' ]]; then + args+=" + --maxpeers 200 + " + fi + + if [[ $NODE_TYPE == 'validator-without-sentry' ]]; then + args+=" + --keystore $BOR_DIR/keystore \ + --unlock $VALIDATOR_ADDRESS \ + --password $BOR_DIR/password.txt \ + --allow-insecure-unlock \ + --maxpeers 200 \ + --mine + " + fi + + ${args[@]} EOF fpm -s dir -t deb --deb-user root --deb-group root -n matic-bor -v ${{ env.RELEASE_VERSION }} \ From 883aa5159fbaa1e1fdb5823b0328eab4eb2ea620 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Wed, 27 May 2020 23:54:28 +0530 Subject: [PATCH 2/7] fix: exec start command in bor service --- .github/workflows/linuxpackage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index 07da48d48c..bccb51b365 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -39,7 +39,7 @@ jobs: [Service] WorkingDirectory=/etc/bor/ EnvironmentFile=/etc/bor/metadata - ExecStart=/etc/bor/start.sh ${NETWORK_ID} ${VALIDATOR_ADDRESS} ${NODE_TYPE} + ExecStart=bash /etc/bor/start.sh ${NETWORK_ID} ${VALIDATOR_ADDRESS} ${NODE_TYPE} Type=simple User=root EOF @@ -57,6 +57,8 @@ jobs: EOF cat > start.sh <<- "EOF" + #!/usr/bin/env bash + NETWORK_ID=$1 VALIDATOR_ADDRESS=$2 NODE_TYPE=$3 From c502bceb13100d552d9a7a4619454bad955d36d8 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Thu, 28 May 2020 00:31:05 +0530 Subject: [PATCH 3/7] fix: typo --- .github/workflows/linuxpackage.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index bccb51b365..a89fdb89c6 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -63,13 +63,15 @@ jobs: VALIDATOR_ADDRESS=$2 NODE_TYPE=$3 - args="/usr/bin/bor --datadir /etc/bor/dataDir --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s'" + DATA_DIR=/etc/bor/dataDir + + args="/usr/bin/bor --datadir $DATA_DIR --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s'" if [[ $NODE_TYPE == 'validator' ]]; then args+=" - --keystore $BOR_DIR/keystore \ + --keystore $DATA_DIR/keystore \ --unlock $VALIDATOR_ADDRESS \ - --password $BOR_DIR/password.txt \ + --password $DATA_DIR/password.txt \ --allow-insecure-unlock \ --nodiscover --maxpeers 1 \ --mine @@ -84,9 +86,9 @@ jobs: if [[ $NODE_TYPE == 'validator-without-sentry' ]]; then args+=" - --keystore $BOR_DIR/keystore \ + --keystore $DATA_DIR/keystore \ --unlock $VALIDATOR_ADDRESS \ - --password $BOR_DIR/password.txt \ + --password $DATA_DIR/password.txt \ --allow-insecure-unlock \ --maxpeers 200 \ --mine From 1f6fd6de90c8df3fa8f282cc4c5a623ed0303e78 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Thu, 28 May 2020 01:15:12 +0530 Subject: [PATCH 4/7] fix: make start.sh executable --- .github/workflows/linuxpackage.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index a89fdb89c6..101432d1bd 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -39,7 +39,8 @@ jobs: [Service] WorkingDirectory=/etc/bor/ EnvironmentFile=/etc/bor/metadata - ExecStart=bash /etc/bor/start.sh ${NETWORK_ID} ${VALIDATOR_ADDRESS} ${NODE_TYPE} + ExecStartPre=/bin/chmod +x /etc/bor/start.sh + ExecStart=/bin/bash /etc/bor/start.sh ${NETWORK_ID} ${VALIDATOR_ADDRESS} ${NODE_TYPE} Type=simple User=root EOF @@ -57,7 +58,7 @@ jobs: EOF cat > start.sh <<- "EOF" - #!/usr/bin/env bash + #!/usr/bin/env sh NETWORK_ID=$1 VALIDATOR_ADDRESS=$2 @@ -65,11 +66,10 @@ jobs: DATA_DIR=/etc/bor/dataDir - args="/usr/bin/bor --datadir $DATA_DIR --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s'" + args="/usr/bin/bor --datadir $DATA_DIR --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s' " if [[ $NODE_TYPE == 'validator' ]]; then - args+=" - --keystore $DATA_DIR/keystore \ + args+="--keystore $DATA_DIR/keystore \ --unlock $VALIDATOR_ADDRESS \ --password $DATA_DIR/password.txt \ --allow-insecure-unlock \ @@ -79,14 +79,12 @@ jobs: fi if [[ $NODE_TYPE == 'sentry' ]]; then - args+=" - --maxpeers 200 + args+="--maxpeers 200 " fi if [[ $NODE_TYPE == 'validator-without-sentry' ]]; then - args+=" - --keystore $DATA_DIR/keystore \ + args+="--keystore $DATA_DIR/keystore \ --unlock $VALIDATOR_ADDRESS \ --password $DATA_DIR/password.txt \ --allow-insecure-unlock \ @@ -102,7 +100,8 @@ jobs: --after-install after_install.sh \ bor.service=/etc/systemd/system/ \ build/bin/bor=/usr/bin/ \ - metadata=/etc/bor/ + metadata=/etc/bor/ \ + start.sh=/etc/bor/ mkdir packages-v${{ env.RELEASE_VERSION }} From b2aca18608372a9c03ef80026d4762fd2d6df01b Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Thu, 28 May 2020 01:40:34 +0530 Subject: [PATCH 5/7] fix: typo --- .github/workflows/linuxpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index 101432d1bd..e686320ddb 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -93,7 +93,7 @@ jobs: " fi - ${args[@]} + eval $args EOF fpm -s dir -t deb --deb-user root --deb-group root -n matic-bor -v ${{ env.RELEASE_VERSION }} \ From 55d85bd716021b4b937dd8c330c9a641305a61c7 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Thu, 28 May 2020 13:18:28 +0530 Subject: [PATCH 6/7] chg: make bootnode command available in linux package --- .github/workflows/linuxpackage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index e686320ddb..edb74e8fef 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -31,7 +31,7 @@ jobs: gem install --no-document fpm fpm --version - make bor + make all cat > bor.service <<- "EOF" [Unit] @@ -100,6 +100,7 @@ jobs: --after-install after_install.sh \ bor.service=/etc/systemd/system/ \ build/bin/bor=/usr/bin/ \ + build/bin/bootnode=/usr/bin/ \ metadata=/etc/bor/ \ start.sh=/etc/bor/ From a418e6a6c072c92b72112de9c6dc4805a4e19a71 Mon Sep 17 00:00:00 2001 From: Jaynti Kanani Date: Thu, 28 May 2020 13:39:22 +0530 Subject: [PATCH 7/7] chg: change gas target --- .github/workflows/linuxpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linuxpackage.yml b/.github/workflows/linuxpackage.yml index edb74e8fef..c6ff23f770 100644 --- a/.github/workflows/linuxpackage.yml +++ b/.github/workflows/linuxpackage.yml @@ -66,7 +66,7 @@ jobs: DATA_DIR=/etc/bor/dataDir - args="/usr/bin/bor --datadir $DATA_DIR --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s' " + args="/usr/bin/bor --datadir $DATA_DIR --port '30303' --rpc --rpcaddr '0.0.0.0' --rpcvhosts '*' --rpccorsdomain '*' --rpcport '8545' --ipcpath /etc/bor/bor.ipc --rpcapi 'db,eth,net,web3,txpool,bor' --networkid $NETWORK_ID --miner.gaslimit '200000000' --miner.gastarget '20000000' --txpool.nolocals --txpool.accountslots '128' --txpool.globalslots '20000' --txpool.lifetime '0h16m0s' " if [[ $NODE_TYPE == 'validator' ]]; then args+="--keystore $DATA_DIR/keystore \