mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-28 12:11:44 +00:00
add terraforce deployment method
This commit is contained in:
10
terraforce/scripts/copy_run.sh
Normal file
10
terraforce/scripts/copy_run.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
RUN=$2 # path to run script
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# stop all tendermint
|
||||
terraforce scp --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" $RUN run.sh
|
43
terraforce/scripts/init.sh
Normal file
43
terraforce/scripts/init.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
TESTNET=$2 # path to folder containing testnet info
|
||||
CONFIG=$3 # path to folder containing `bins` and `run.sh` files
|
||||
|
||||
if [[ ! -f $CONFIG/bins ]]; then
|
||||
echo "config folder ($CONFIG) must contain bins file"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $CONFIG/run.sh ]]; then
|
||||
echo "config folder ($CONFIG) must contain run.sh file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
KEY=$HOME/.ssh/id_rsa
|
||||
|
||||
FLAGS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||
|
||||
N_=$((N-1)) # 0-based index
|
||||
|
||||
MACH_ROOT="$TESTNET/mach?"
|
||||
|
||||
|
||||
# mkdir
|
||||
terraforce ssh --user root --ssh-key $KEY --machines "[0-$N_]" mkdir .tendermint
|
||||
|
||||
# copy over genesis/priv_val
|
||||
terraforce scp --user root --ssh-key $KEY --iterative --machines "[0-$N_]" "$MACH_ROOT/priv_validator.json" .tendermint/priv_validator.json
|
||||
terraforce scp --user root --ssh-key $KEY --iterative --machines "[0-$N_]" "$MACH_ROOT/genesis.json" .tendermint/genesis.json
|
||||
|
||||
# copy the run script
|
||||
terraforce scp --user root --ssh-key $KEY --machines "[0-$N_]" $CONFIG/run.sh run.sh
|
||||
|
||||
# copy the binaries
|
||||
while read line; do
|
||||
local_bin=$(eval echo $line)
|
||||
remote_bin=$(basename $local_bin)
|
||||
echo $local_bin
|
||||
terraforce scp --user root --ssh-key $KEY --machines "[0-$N_]" $local_bin $remote_bin
|
||||
terraforce ssh --user root --ssh-key $KEY --machines "[0-$N_]" chmod +x $remote_bin
|
||||
done <$CONFIG/bins
|
11
terraforce/scripts/query.sh
Normal file
11
terraforce/scripts/query.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
QUERY=$2
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# start all tendermint nodes
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" curl -s localhost:46657/$QUERY
|
||||
|
10
terraforce/scripts/reset.sh
Normal file
10
terraforce/scripts/reset.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# stop all tendermint
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" rm -rf .tendermint/data
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" ./tendermint unsafe_reset_priv_validator
|
9
terraforce/scripts/restart.sh
Normal file
9
terraforce/scripts/restart.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# start
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" SEEDS=$(terraform output seeds) bash run.sh
|
10
terraforce/scripts/start.sh
Normal file
10
terraforce/scripts/start.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# start all tendermint nodes
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" SEEDS=$(terraform output seeds) bash run.sh
|
||||
|
9
terraforce/scripts/stop.sh
Normal file
9
terraforce/scripts/stop.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#! /bin/bash
|
||||
set -u
|
||||
|
||||
N=$1 # number of nodes
|
||||
|
||||
N_=$((N-1))
|
||||
|
||||
# stop all tendermint
|
||||
terraforce ssh --user root --ssh-key $HOME/.ssh/id_rsa --machines "[0-$N_]" killall tendermint
|
Reference in New Issue
Block a user