mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Update priv validator format in stack.sh to support tm v0.28.0+
Signed-off-by: David Dashyan <mail@davie.li>
This commit is contained in:
@@ -16,6 +16,7 @@ stack_repo=${STACK_REPO:="bigchaindb/bigchaindb"}
|
||||
stack_size=${STACK_SIZE:=4}
|
||||
stack_type=${STACK_TYPE:="docker"}
|
||||
stack_type_provider=${STACK_TYPE_PROVIDER:=""}
|
||||
# NOTE versions prior v0.28.0 have different priv_validator format!
|
||||
tm_version=${TM_VERSION:="v0.31.5"}
|
||||
mongo_version=${MONGO_VERSION:="3.6"}
|
||||
stack_vm_memory=${STACK_VM_MEMORY:=2048}
|
||||
|
||||
39
pkg/scripts/tm_config_gen
Normal file
39
pkg/scripts/tm_config_gen
Normal file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Comment: This script is was carved out of start.yml task command. It's
|
||||
# purpose is to generated tendermint configuration files for each node in
|
||||
# `stack', and compile genesis.json file. These files are further used in
|
||||
# tm_start script.
|
||||
|
||||
# NOTE following environment have to be set!
|
||||
# $STACK_SIZE -- self explanatory
|
||||
# $TM_DOCKER_NAME -- used to identify tendermint containers in the network
|
||||
|
||||
tendermint init
|
||||
cat /tendermint/config/genesis.json \
|
||||
| jq ".validators=[]" > /tendermint/config/genesis.tmp
|
||||
|
||||
mv /tendermint/config/genesis.tmp /tendermint/config/genesis.json
|
||||
rm /tendermint/config/node_key.json
|
||||
|
||||
for i in $(seq $STACK_SIZE); do
|
||||
|
||||
tendermint gen_validator > /tendermint/config/priv_validator$i.json;
|
||||
tendermint gen_node_key > /tendermint/config/node_id$i;
|
||||
cat tendermint/config/priv_validator$i.json \
|
||||
| jq ".Key.pub_key" \
|
||||
| jq ". as \$k | {pub_key: \$k, \
|
||||
power: \"10\", \
|
||||
name: \"$TM_DOCKER_NAME$i\"}" \
|
||||
> pub_validator$i.json;
|
||||
|
||||
# added
|
||||
cat tendermint/config/priv_validator$i.json \
|
||||
| jq ".Key" > tendermint/config/priv_validator_key$1.json
|
||||
|
||||
cat /tendermint/config/genesis.json \
|
||||
| jq ".validators |= .+ [$(cat pub_validator$i.json)]" \
|
||||
> tmpgenesis;
|
||||
|
||||
mv tmpgenesis /tendermint/config/genesis.json;
|
||||
done
|
||||
36
pkg/scripts/tm_start
Normal file
36
pkg/scripts/tm_start
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
# Comment: This script is was carved out of start.yml task command. It's
|
||||
# purpose is to copy generated in tm_config_gen configuration files from mounted
|
||||
# volume, compile `--p2p.persistent_peers' cmd argument and start tendermint
|
||||
# node.
|
||||
|
||||
# NOTE following environment have to be set!
|
||||
# $_ITEM -- stack size position identifier
|
||||
# $STACK_SIZE -- self explanatory
|
||||
# $TM_DOCKER_NAME -- used to identify tendermint containers in the network
|
||||
# $BIGCHAINDB_DOCKER_NAME -- self explanatory
|
||||
# $TM_P2P_PORT -- self explanatory
|
||||
|
||||
# Copy confguration files from mounted config volume
|
||||
cp /tendermint_config/genesis.json \
|
||||
/tendermint/config/genesis.json
|
||||
cp /tendermint_config/priv_validator_key$_ITEM.json \
|
||||
/tendermint/config/priv_validator_key.json
|
||||
cp /tendermint_config/node_key$_ITEM.json \
|
||||
/tendermint/config/node_key.json
|
||||
|
||||
# Create peers array (to be passed to `tendermint node' command
|
||||
peers=()
|
||||
for i in $(seq $STACK_SIZE); do
|
||||
peers+=($(cat /tendermint_config/node_id$i)@"$TM_DOCKER_NAME$i:$TM_P2P_PORT");
|
||||
done
|
||||
peers=$(IFS=","; echo "${peers[*]}")
|
||||
|
||||
echo "starting node with persistent peers set to:"
|
||||
echo $peers
|
||||
tendermint node \
|
||||
--p2p.persistent_peers="$peers" \
|
||||
--p2p.laddr "tcp://"$TM_DOCKER_NAME$_ITEM":26656" \
|
||||
--proxy_app="tcp://"$BIGCHAINDB_DOCKER_NAME$_ITEM":26658" \
|
||||
--consensus.create_empty_blocks=false \
|
||||
--p2p.pex=false
|
||||
Reference in New Issue
Block a user