From 50ab1bba889f7d6ded8974d1a3a9484afa418ed3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Levente=20T=C3=B3th?= Date: Wed, 18 Sep 2024 19:03:05 +0200 Subject: [PATCH] fix: blockchain start from bash --- orchestrator/builder/.env | 1 + orchestrator/builder/blockchain/start.sh | 14 ++++---------- orchestrator/builder/environment.sh | 3 ++- orchestrator/builder/utils/env-variable-value.sh | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/orchestrator/builder/.env b/orchestrator/builder/.env index ad506e7..180c92d 100755 --- a/orchestrator/builder/.env +++ b/orchestrator/builder/.env @@ -4,3 +4,4 @@ BEE_ENV_PREFIX="fdp-play" BEE_IMAGE_PREFIX="fairdatasociety" COMMIT_VERSION_TAG="false" STATE_COMMIT="true" +BLOCKCHAIN_RUN_ARGS='--allow-insecure-unlock --unlock=0xCEeE442a149784faa65C35e328CCd64d874F9a02 --password /root/password --mine --miner.etherbase=0xCEeE442a149784faa65C35e328CCd64d874F9a02 --http --http.api="debug,web3,eth,txpool,net,personal" --http.corsdomain=* --http.port=9545 --http.addr=0.0.0.0 --http.vhosts=* --ws --ws.api="debug,web3,eth,txpool,net,personal" --ws.origins=* --ws.port=9546 --maxpeers=0 --networkid=4020 --authrpc.vhosts=* --authrpc.addr=0.0.0.0' \ No newline at end of file diff --git a/orchestrator/builder/blockchain/start.sh b/orchestrator/builder/blockchain/start.sh index cce96b7..9073dd1 100755 --- a/orchestrator/builder/blockchain/start.sh +++ b/orchestrator/builder/blockchain/start.sh @@ -6,20 +6,14 @@ MY_PATH=$(dirname "$0") MY_PATH=$( cd "$MY_PATH" && pwd ) # Check used system variable set BEE_ENV_PREFIX=$("$MY_PATH/../utils/env-variable-value.sh" BEE_ENV_PREFIX) -BEE_IMAGE_PREFIX=$("$MY_PATH/../utils/env-variable-value.sh" BEE_IMAGE_PREFIX) -BLOCKCHAIN_VERSION=$("$MY_PATH/../utils/env-variable-value.sh" BLOCKCHAIN_VERSION) +BLOCKCHAIN_RUN_ARGS=$("$MY_PATH/../utils/env-variable-value.sh" BLOCKCHAIN_RUN_ARGS) NETWORK="$BEE_ENV_PREFIX-network" NAME="$BEE_ENV_PREFIX-blockchain" CONTAINER_IN_DOCKER=$(docker container ls -qaf name=$NAME) if [ -z "$CONTAINER_IN_DOCKER" ]; then - docker run -p 9545:9545 --network $NETWORK --name $NAME -v "$MY_PATH:/root" -d \ - ethereum/client-go:release-1.13 --allow-insecure-unlock \ - --unlock 0xCEeE442a149784faa65C35e328CCd64d874F9a02 --password /root/password \ - --mine --miner.etherbase=0xCEeE442a149784faa65C35e328CCd64d874F9a02 \ - --http --http.api="debug,web3,eth,txpool,net,personal" --http.corsdomain=* --http.port=9545 --http.addr=0.0.0.0 --http.vhosts=* \ - --ws --ws.api="debug,web3,eth,txpool,net,personal" --ws.origins=* --ws.port=9546 --http.addr=0.0.0.0 \ - --maxpeers=0 --networkid=4020 --authrpc.vhosts=* --authrpc.addr=0.0.0.0 + exec docker run -p 127.0.0.1:9545:9545 --network $NETWORK --name $NAME -v "$MY_PATH:/root" -d \ + ethereum/client-go:release-1.13 $BLOCKCHAIN_RUN_ARGS else - docker start $NAME + docker start $NAME fi diff --git a/orchestrator/builder/environment.sh b/orchestrator/builder/environment.sh index 26a458e..b7034b9 100755 --- a/orchestrator/builder/environment.sh +++ b/orchestrator/builder/environment.sh @@ -42,6 +42,7 @@ MY_PATH=$( cd "$MY_PATH" && pwd ) # absolutized and normalized BEE_ENV_PREFIX=$("$MY_PATH/utils/env-variable-value.sh" BEE_ENV_PREFIX) BEE_IMAGE_PREFIX=$("$MY_PATH/utils/env-variable-value.sh" BEE_IMAGE_PREFIX) BLOCKCHAIN_VERSION=$("$MY_PATH/utils/env-variable-value.sh" BLOCKCHAIN_VERSION) +BLOCKCHAIN_RUN_ARGS=$("$MY_PATH//utils/env-variable-value.sh" BLOCKCHAIN_RUN_ARGS) # Init variables EPHEMERAL=false @@ -121,7 +122,7 @@ if [ -z "$BLOCKCHAIN_CONTAINER" ] ; then if $EPHEMERAL ; then BLOCKCHAIN_ARGUMENTS="$BLOCKCHAIN_ARGUMENTS --rm" fi - docker run $BLOCKCHAIN_ARGUMENTS $BEE_IMAGE_PREFIX/$SWARM_BLOCKCHAIN_NAME:$BLOCKCHAIN_VERSION + docker run $BLOCKCHAIN_ARGUMENTS $BEE_IMAGE_PREFIX/$SWARM_BLOCKCHAIN_NAME:$BLOCKCHAIN_VERSION $BLOCKCHAIN_RUN_ARGS else docker start $BLOCKCHAIN_CONTAINER fi diff --git a/orchestrator/builder/utils/env-variable-value.sh b/orchestrator/builder/utils/env-variable-value.sh index 0900eb0..f81f628 100755 --- a/orchestrator/builder/utils/env-variable-value.sh +++ b/orchestrator/builder/utils/env-variable-value.sh @@ -7,7 +7,7 @@ echo_env_variable_value() { if [ -z "$REF" ] ; then MY_PATH=$(dirname "$0") ENV_PATH=$( cd "$MY_PATH/.." && pwd ) - VALUE=$(grep "^$1=" "$ENV_PATH/.env" | cut -d= -f2) + VALUE=$(grep "^$1=" "$ENV_PATH/.env" | cut -d= -f2-) VALUE=${VALUE//\"/} VALUE=${VALUE//\'/} echo "$VALUE"