Skip to content

Commit

Permalink
fix: blockchain start from bash
Browse files Browse the repository at this point in the history
  • Loading branch information
nugaon committed Sep 18, 2024
1 parent e1a18db commit 50ab1bb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
1 change: 1 addition & 0 deletions orchestrator/builder/.env
Original file line number Diff line number Diff line change
Expand Up @@ -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'
14 changes: 4 additions & 10 deletions orchestrator/builder/blockchain/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion orchestrator/builder/environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion orchestrator/builder/utils/env-variable-value.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 50ab1bb

Please sign in to comment.