From aa052646372c825eee9c23be7f477f2e2b4a1107 Mon Sep 17 00:00:00 2001 From: Huy Ngo Date: Wed, 28 Feb 2024 14:56:28 +0700 Subject: [PATCH 1/4] ci: add migrating envs script for v0.2.8 --- scripts/migrate-env-for-v0.2.8.sh | 101 ++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100755 scripts/migrate-env-for-v0.2.8.sh diff --git a/scripts/migrate-env-for-v0.2.8.sh b/scripts/migrate-env-for-v0.2.8.sh new file mode 100755 index 0000000..88d33ee --- /dev/null +++ b/scripts/migrate-env-for-v0.2.8.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +set -e + +echo "Start Migrating Process" +echo "-----------------------" +echo "Backup env and docker-compose file" + +cp .env .env_backup +cp docker-compose.yml docker-compose.yml + +echo "Finish backup for 2 files" + +# To new docker-compose config in v0.2.8 +# Following docs here https://docs.roninchain.com/validators/setup/mainnet/run-combined + +# - LISTENERS__RONIN__RPCURL=${RPC_ENDPOINT} +# - LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY=${LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY} +# - RONIN_LEGACY_BRIDGE_OPERATOR_KEY=${LEGACY_BRIDGE_OPERATOR_PRIVATE_KEY} +# - RONIN_BRIDGE_VOTER_KEY=${BRIDGE_VOTER_PRIVATE_KEY} +# - RONIN_RELAYER_KEY=${RONIN_RELAYER_KEY} +# - LISTENERS__ETHEREUM__RPCURL=${LISTENERS__ETHEREUM__RPCURL} +# - ETHEREUM_VALIDATOR_KEY=${ETHEREUM_VALIDATOR_KEY} +# - ETHEREUM_RELAYER_KEY=${ETHEREUM_RELAYER_KEY} +# - DATABASE__HOST=db +# - DATABASE__DBNAME=${DATABASE__DBNAME} +# - DATABASE__PORT=5432 +# - DATABASE__USER=${DATABASE__USER} +# - DATABASE__PASSWORD=${DATABASE__PASSWORD} +# - VERBOSITY=${VERBOSITY} +# - CONFIG_PATH=${CONFIG_PATH} +# - LISTENERS__RONIN__TASKINTERVAL=${LISTENERS__RONIN__TASKINTERVAL} +# - LISTENERS__RONIN__TRANSACTIONCHECKPERIOD=${LISTENERS__RONIN__TRANSACTIONCHECKPERIOD} +# - LISTENERS__RONIN__MAXPROCESSINGTASKS=${LISTENERS__RONIN__MAXPROCESSINGTASKS} +# - LISTENERS__ETHEREUM__GETLOGSBATCHSIZE=${LISTENERS__ETHEREUM__GETLOGSBATCHSIZE} +# - LISTENERS__RONIN__GASLIMITBUMPRATIO=${LISTENERS__RONIN__GASLIMITBUMPRATIO} +# - LISTENERS__RONIN__STATS__NODE=${LISTENERS__RONIN__STATS__NODE} +# - LISTENERS__RONIN__STATS__HOST=${LISTENERS__RONIN__STATS__HOST} +# - LISTENERS__RONIN__STATS__SECRET=${LISTENERS__RONIN__STATS__SECRET} + +echo "-------------------" +echo "Start for replacing Ronin and Etherum Endpoint config" +sed -i -e 's/RPC_ENDPOINT/LISTENERS__RONIN__RPCURL/g' .env +sed -i -e 's/BRIDGE_OPERATOR_PRIVATE_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY/g' .env +sed -i -e 's/ETHEREUM_ENDPOINT/LISTENERS__ETHEREUM__RPCURL/g' .env + +sed -i -e 's/RONIN_RPC/LISTENERS__RONIN__RPCURL/g' docker-compose.yml +sed -i -e 's/RONIN_BRIDGE_OPERATOR_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY/g' docker-compose.yml +sed -i -e 's/ETHEREUM_RPC/LISTENERS__ETHEREUM__RPCURL/g' docker-compose.yml + +echo "-------------------" + +echo "Start for replacing DATABASE config" + +sed -i -e 's/DB_HOST/DATABASE__HOST/g' .env +sed -i -e 's/DB_NAME/DATABASE__DBNAME/g' .env +sed -i -e 's/DB_PORT/DATABASE__PORT/g' .env +sed -i -e 's/DB_USERNAME/DATABASE__USER/g' .env +sed -i -e 's/DB_PASSWORD/DATABASE__PASSWORD/g' .env + +sed -i -e 's/DB_HOST/DATABASE__HOST/g' docker-compose.yml +sed -i -e 's/DB_NAME/DATABASE__DBNAME/g' docker-compose.yml +sed -i -e 's/DB_PORT/DATABASE__PORT/g' docker-compose.yml +sed -i -e 's/DB_USERNAME/DATABASE__USER/g' docker-compose.yml +sed -i -e 's/DB_PASSWORD/DATABASE__PASSWORD/g' docker-compose.yml + +echo "-------------------" + + +echo "Start for replacing Ronin Task Process config" + +sed -i -e 's/RONIN_TASK_INTERVAL/LISTENERS__RONIN__TASKINTERVAL/g' .env +sed -i -e 's/RONIN_TRANSACTION_CHECK_PERIOD/LISTENERS__RONIN__TRANSACTIONCHECKPERIOD/g' .env +sed -i -e 's/RONIN_MAX_PROCESSING_TASKS/LISTENERS__RONIN__MAXPROCESSINGTASKS/g' .env + +sed -i -e 's/RONIN_TASK_INTERVAL/LISTENERS__RONIN__TASKINTERVAL/g' docker-compose.yml +sed -i -e 's/RONIN_TRANSACTION_CHECK_PERIOD/LISTENERS__RONIN__TRANSACTIONCHECKPERIOD/g' docker-compose.yml +sed -i -e 's/RONIN_MAX_PROCESSING_TASKS/LISTENERS__RONIN__MAXPROCESSINGTASKS/g' docker-compose.yml + +echo "-------------------" + +echo "Start for replacing Etherum Task Process config" + +sed -i -e 's/ETHEREUM_GET_LOGS_BATCH_SIZE/LISTENERS__ETHEREUM__GETLOGSBATCHSIZE/g' .env +sed -i -e 's/ETHEREUM_GET_LOGS_BATCH_SIZE/LISTENERS__ETHEREUM__GETLOGSBATCHSIZE/g' docker-compose.yml + +echo "-------------------" + +echo "Start for replacing Bridge Stats config" + +sed -i -e 's/BRIDGE_STATS_URL/LISTENERS__RONIN__STATS__HOST/g' .env +sed -i -e 's/BRIDGE_STATS_NODE_NAME/LISTENERS__RONIN__STATS__NODE/g' .env +sed -i -e 's/BRIDGE_STATS_SECRET/LISTENERS__RONIN__STATS__SECRET/g' .env + + +sed -i -e 's/BRIDGE_STATS_URL/LISTENERS__RONIN__STATS__HOST/g' docker-compose.yml +sed -i -e 's/BRIDGE_STATS_NODE_NAME/LISTENERS__RONIN__STATS__NODE/g' docker-compose.yml +sed -i -e 's/BRIDGE_STATS_SECRET/LISTENERS__RONIN__STATS__SECRET/g' docker-compose.yml + +echo "-------------------" +echo "Happy for new version v0.2.8, please Double check with the final docs, and start bridge." From b028bb246f6b35db0fc56e6cfd981aee2876cd89 Mon Sep 17 00:00:00 2001 From: Huy Ngo Date: Wed, 28 Feb 2024 14:58:46 +0700 Subject: [PATCH 2/4] fix: rename --- scripts/migrate-env-for-v0.2.8.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/migrate-env-for-v0.2.8.sh b/scripts/migrate-env-for-v0.2.8.sh index 88d33ee..c8c14ee 100755 --- a/scripts/migrate-env-for-v0.2.8.sh +++ b/scripts/migrate-env-for-v0.2.8.sh @@ -7,7 +7,7 @@ echo "-----------------------" echo "Backup env and docker-compose file" cp .env .env_backup -cp docker-compose.yml docker-compose.yml +cp docker-compose.yml docker-compose-backup.yml echo "Finish backup for 2 files" From 7f8f7a0fa0af770b25b33252c7fa5a60f7b8d7a7 Mon Sep 17 00:00:00 2001 From: Huy Ngo Date: Wed, 28 Feb 2024 15:20:59 +0700 Subject: [PATCH 3/4] fix: fix typo --- scripts/migrate-env-for-v0.2.8.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/migrate-env-for-v0.2.8.sh b/scripts/migrate-env-for-v0.2.8.sh index c8c14ee..22be01b 100755 --- a/scripts/migrate-env-for-v0.2.8.sh +++ b/scripts/migrate-env-for-v0.2.8.sh @@ -4,12 +4,12 @@ set -e echo "Start Migrating Process" echo "-----------------------" -echo "Backup env and docker-compose file" +echo "Backup env and docker-compose files" cp .env .env_backup cp docker-compose.yml docker-compose-backup.yml -echo "Finish backup for 2 files" +echo "Finished backup for 2 files" # To new docker-compose config in v0.2.8 # Following docs here https://docs.roninchain.com/validators/setup/mainnet/run-combined @@ -39,7 +39,7 @@ echo "Finish backup for 2 files" # - LISTENERS__RONIN__STATS__SECRET=${LISTENERS__RONIN__STATS__SECRET} echo "-------------------" -echo "Start for replacing Ronin and Etherum Endpoint config" +echo "Start replacing Ronin and Etherum Endpoint configs" sed -i -e 's/RPC_ENDPOINT/LISTENERS__RONIN__RPCURL/g' .env sed -i -e 's/BRIDGE_OPERATOR_PRIVATE_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY/g' .env sed -i -e 's/ETHEREUM_ENDPOINT/LISTENERS__ETHEREUM__RPCURL/g' .env @@ -50,7 +50,7 @@ sed -i -e 's/ETHEREUM_RPC/LISTENERS__ETHEREUM__RPCURL/g' docker-compose.yml echo "-------------------" -echo "Start for replacing DATABASE config" +echo "Start replacing DATABASE config" sed -i -e 's/DB_HOST/DATABASE__HOST/g' .env sed -i -e 's/DB_NAME/DATABASE__DBNAME/g' .env @@ -67,7 +67,7 @@ sed -i -e 's/DB_PASSWORD/DATABASE__PASSWORD/g' docker-compose.yml echo "-------------------" -echo "Start for replacing Ronin Task Process config" +echo "Start replacing Ronin Task Process config" sed -i -e 's/RONIN_TASK_INTERVAL/LISTENERS__RONIN__TASKINTERVAL/g' .env sed -i -e 's/RONIN_TRANSACTION_CHECK_PERIOD/LISTENERS__RONIN__TRANSACTIONCHECKPERIOD/g' .env @@ -79,14 +79,14 @@ sed -i -e 's/RONIN_MAX_PROCESSING_TASKS/LISTENERS__RONIN__MAXPROCESSINGTASKS/g' echo "-------------------" -echo "Start for replacing Etherum Task Process config" +echo "Start replacing Etherum Task Process config" sed -i -e 's/ETHEREUM_GET_LOGS_BATCH_SIZE/LISTENERS__ETHEREUM__GETLOGSBATCHSIZE/g' .env sed -i -e 's/ETHEREUM_GET_LOGS_BATCH_SIZE/LISTENERS__ETHEREUM__GETLOGSBATCHSIZE/g' docker-compose.yml echo "-------------------" -echo "Start for replacing Bridge Stats config" +echo "Start replacing Bridge Stats config" sed -i -e 's/BRIDGE_STATS_URL/LISTENERS__RONIN__STATS__HOST/g' .env sed -i -e 's/BRIDGE_STATS_NODE_NAME/LISTENERS__RONIN__STATS__NODE/g' .env @@ -98,4 +98,4 @@ sed -i -e 's/BRIDGE_STATS_NODE_NAME/LISTENERS__RONIN__STATS__NODE/g' docker-comp sed -i -e 's/BRIDGE_STATS_SECRET/LISTENERS__RONIN__STATS__SECRET/g' docker-compose.yml echo "-------------------" -echo "Happy for new version v0.2.8, please Double check with the final docs, and start bridge." +echo "Happy for new version v0.2.8, please double check with the final doc, and start bridge." From 4728e67da494dd13c3271e19c447aa6d6ac700bf Mon Sep 17 00:00:00 2001 From: Huy Ngo Date: Wed, 28 Feb 2024 15:26:12 +0700 Subject: [PATCH 4/4] fix: fix up --- scripts/migrate-env-for-v0.2.8.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/migrate-env-for-v0.2.8.sh b/scripts/migrate-env-for-v0.2.8.sh index 22be01b..c684168 100755 --- a/scripts/migrate-env-for-v0.2.8.sh +++ b/scripts/migrate-env-for-v0.2.8.sh @@ -45,8 +45,11 @@ sed -i -e 's/BRIDGE_OPERATOR_PRIVATE_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATO sed -i -e 's/ETHEREUM_ENDPOINT/LISTENERS__ETHEREUM__RPCURL/g' .env sed -i -e 's/RONIN_RPC/LISTENERS__RONIN__RPCURL/g' docker-compose.yml +sed -i -e 's/RPC_ENDPOINT/LISTENERS__RONIN__RPCURL/g' docker-compose.yml sed -i -e 's/RONIN_BRIDGE_OPERATOR_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY/g' docker-compose.yml +sed -i -e 's/BRIDGE_OPERATOR_PRIVATE_KEY/LISTENERS__RONIN__SECRET__BRIDGEOPERATOR__PLAINPRIVATEKEY/g' docker-compose.yml sed -i -e 's/ETHEREUM_RPC/LISTENERS__ETHEREUM__RPCURL/g' docker-compose.yml +sed -i -e 's/ETHEREUM_ENDPOINT/LISTENERS__ETHEREUM__RPCURL/g' docker-compose.yml echo "-------------------"