Skip to content

Commit

Permalink
chore: deploy script support for both amd and arm
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Jan 22, 2024
1 parent d016d6a commit 5dce05d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
1 change: 1 addition & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.2.0/go.mod h1:+6KLcKIVgx
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno=
github.com/CloudyKit/jet/v6 v6.2.0/go.mod h1:d3ypHeIRNo2+XyqnGA8s+aphtcVpjP5hPwP/Lzo7Ro4=
github.com/CosmWasm/wasmvm v1.5.0/go.mod h1:fXB+m2gyh4v9839zlIXdMZGeLAxqUdYdFQqYsTha2hc=
github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4=
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0/go.mod h1:b3g59n2Y+T5xmcxJL+UEG2f8cQploZm1mR/v6BW0mU0=
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
Expand Down
10 changes: 5 additions & 5 deletions scripts/testnet/create_genesis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["slashing"]["params"]
cat $HOME/.seda-chain/config/genesis.json | jq '.consensus["params"]["block"]["max_gas"]="100000000"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json

# TO-DO
# gov: voting_params.voting_period, params.voting_period, params.expedited_voting_period, min_deposit[0].amount, max_deposit_period
# cat $HOME/.seda-chain/config/genesis.json | jq '.consensus["params"]["version"]={}' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json
# cat $HOME/.seda-chain/config/genesis.json | jq --arg IBC_ALLOWED_CLIENTS $IBC_ALLOWED_CLIENTS '.app_state["ibc"]["client_genesis"]["params"]["allowed_clients"]=$IBC_ALLOWED_CLIENTS' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json
cat $HOME/.seda-chain/config/genesis.json | jq --arg DENOM_METADATA $DENOM_METADATA '.app_state["bank"]["denom_metadata"]=$DENOM_METADATA' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json

# - gov (intentionally adjusted for testing): voting_params.voting_period, params.voting_period, params.expedited_voting_period, min_deposit[0].amount, max_deposit_period
# - cat $HOME/.seda-chain/config/genesis.json | jq '.consensus["params"]["version"]={}' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json
# - cat $HOME/.seda-chain/config/genesis.json | jq --arg IBC_ALLOWED_CLIENTS $IBC_ALLOWED_CLIENTS '.app_state["ibc"]["client_genesis"]["params"]["allowed_clients"]=$IBC_ALLOWED_CLIENTS' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json
# - cat $HOME/.seda-chain/config/genesis.json | jq --arg DENOM_METADATA $DENOM_METADATA '.app_state["bank"]["denom_metadata"]=$DENOM_METADATA' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json
# - wasm params

#
# ADD GENESIS ACCOUNTS
Expand Down
40 changes: 21 additions & 19 deletions scripts/testnet/setup_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@ set -e
# and systemctl service.
#
# NOTE: Assumes ami-0a1ab4a3fcf997a9d
WASMVM_VERSION=$1

COSMOVISOR_URL=https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.3.0/cosmovisor-v1.3.0-linux-arm64.tar.gz
COSMOVISOR_TAR_GZ=cosmovisor-v1.3.0-linux-arm64.tar.gz
LIBWASMVM_URL=https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvm.aarch64.so
LIBWASMVM=libwasmvm.aarch64.so
ARCH=$(uname -m)
if [ $ARCH != "aarch64" ]; then
ARCH="x86_64"
fi

COSMOVISOR_URL=https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.3.0/cosmovisor-v1.3.0-linux-amd64.tar.gz
if [ $ARCH = "aarch64" ]; then
COSMOVISOR_URL=https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.3.0/cosmovisor-v1.3.0-linux-arm64.tar.gz
fi
LIBWASMVM_URL=https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$ARCH.so

COSMOS_LDS=$HOME/COSMOS_LDS
SYSFILE=/etc/systemd/system/seda-node.service
Expand All @@ -21,11 +28,9 @@ if ! which cosmovisor >/dev/null; then

curl -LO $COSMOVISOR_URL
mkdir -p tmp
tar -xzvf $COSMOVISOR_TAR_GZ -C ./tmp
mv ./tmp/cosmovisor .
rm -rf ./tmp ./$COSMOVISOR_TAR_GZ

sudo mv $HOME/cosmovisor /usr/local/bin
tar -xzvf $(basename $COSMOVISOR_URL) -C ./tmp
sudo mv ./tmp/cosmovisor /usr/local/bin
rm -rf ./tmp

echo 'export DAEMON_NAME=seda-chaind' >> $HOME/.bashrc
echo 'export DAEMON_HOME=$HOME/.seda-chain' >> $HOME/.bashrc
Expand All @@ -39,19 +44,16 @@ if ! which cosmovisor >/dev/null; then
echo 'export DAEMON_PREUPGRADE_MAX_RETRIES=0' >> $HOME/.bashrc
echo 'export PATH=$PATH:$HOME/.seda-chain/cosmovisor/current/bin' >> $HOME/.bashrc

# set up shared libraries if necessary
if [ ! -d $COSMOS_LDS ]; then
printf "\n\n\nSETTING UP SHARED LIBRARY\n\n\n\n"

mkdir -p $COSMOS_LDS
curl -LO $LIBWASMVM_URL
mv $LIBWASMVM $COSMOS_LDS
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/COSMOS_LDS' >> $HOME/.bashrc
fi

source $HOME/.bashrc
fi

# set up shared libraries (overwrite if already exists to ensure desired version)
printf "\n\n\nSETTING UP SHARED LIBRARY\n\n\n\n"
mkdir -p $COSMOS_LDS
curl -LO $LIBWASMVM_URL
mv $(basename $LIBWASMVM_URL) $COSMOS_LDS
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/COSMOS_LDS' >> $HOME/.bashrc

# create systemctl service file if necessary
if [ ! -f $SYSFILE ]; then
printf "\n\n\nSETTING UP SYSTEMCTL\n\n\n\n"
Expand Down
12 changes: 6 additions & 6 deletions scripts/testnet/upload_and_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fi
# upload setup script and run it
for i in ${!IPS[@]}; do
scp -i $SSH_KEY -o StrictHostKeyChecking=no -r ./setup_node.sh ec2-user@${IPS[$i]}:/home/ec2-user
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} '/home/ec2-user/setup_node.sh'
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} "/home/ec2-user/setup_node.sh $WASMVM_VERSION"
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} 'rm /home/ec2-user/setup_node.sh'
done

Expand All @@ -49,7 +49,7 @@ done

SEEDS=()
for i in ${!IPS[@]}; do
SEED=$($BIN tendermint show-node-id --home ./$NODE_DIR/node$i)
SEED=$($BIN tendermint show-node-id --home $NODE_DIR/node$i)
SEEDS+=("$SEED@${IPS[$i]}:26656")
done

Expand All @@ -61,10 +61,10 @@ for i in ${!IPS[@]}; do
cp $NODE_DIR/genesis.json $NODE_DIR/node$i/config/genesis.json

if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/seeds = \"\"/seeds = \"${SEEDS_LIST}\"/g" ./$NODE_DIR/node$i/config/config.toml
sed -i '' "s/seeds = \"\"/seeds = \"${SEEDS_LIST}\"/g" $NODE_DIR/node$i/config/config.toml
else
sed "s/seeds = \"\"/seeds = \"${SEEDS_LIST}\"/g" ./$NODE_DIR/node$i/config/config.toml > tmp
cat tmp > ./$NODE_DIR/node$i/config/config.toml
sed "s/seeds = \"\"/seeds = \"${SEEDS_LIST}\"/g" $NODE_DIR/node$i/config/config.toml > tmp
cat tmp > $NODE_DIR/node$i/config/config.toml
rm tmp
fi

Expand All @@ -76,7 +76,7 @@ for i in ${!IPS[@]}; do
ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} 'sudo rm -rf /home/ec2-user/.seda-chain'

# upload
scp -i $SSH_KEY -r ./$NODE_DIR/node$i ec2-user@${IPS[$i]}:/home/ec2-user/.seda-chain
scp -i $SSH_KEY -r $NODE_DIR/node$i ec2-user@${IPS[$i]}:/home/ec2-user/.seda-chain

ssh -i $SSH_KEY -t ec2-user@${IPS[$i]} 'mkdir -p /home/ec2-user/.seda-chain/cosmovisor/genesis/bin'
scp -i $SSH_KEY $LINUX_BIN ec2-user@${IPS[$i]}:/home/ec2-user/.seda-chain/cosmovisor/genesis/bin/seda-chaind
Expand Down

0 comments on commit 5dce05d

Please sign in to comment.