This is a quick a dirty guide for setting up Cosmovisor for the Evmos testnet.
Cosmovisor is a small process manager for Cosmos SDK application binaries that monitors the governance module for incoming chain upgrade proposals. If it sees a proposal that gets approved, cosmovisor can automatically download the new binary, stop the current binary, switch from the old binary to the new one, and finally restart the node with the new binary.
Download and install go. If you are already running Evmos testnet, you probably already have this installed so feel free to skip this section. It is here for completeness.
# Remove any existing go installation
sudo rm -rf /usr/local/go# Install the latest version of Go with this helpful script
curl https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash# Update environment variables to include go
cat <<'EOF' >>$HOME/.profile
Check the go version to make sure that it installed correctly. You may need to open a new shell for this to work. Go is a bit fickle on the install.
Download and install the evmosd binary. Again, you have probably already done this so feel free to skip ahead.
git clone https://github.com/tharsis/evmos.git
Download and install Cosmos-SDK. At the time of this publication v0.44.2 is the newest stable version. For all of you future people that may be reading this, head on over to the GitHub page and look for the newest version and update the code below to match.
git clone https://github.com/cosmos/cosmos-sdk
git checkout v0.44.2
cp cosmovisor/cosmovisor $GOPATH/bin/cosmovisor
Build out the directory structure for Cosmovisor
mkdir -p ~/.evmosd
mkdir -p ~/.evmosd/cosmovisor
mkdir -p ~/.evmosd/cosmovisor/genesis
mkdir -p ~/.evmosd/cosmovisor/genesis/bin
mkdir -p ~/.evmosd/cosmovisor/upgrades
A little housekeeping
echo "# Setup Cosmovisor" >> ~/.profile
echo "export DAEMON_NAME=evmosd" >> ~/.profile
echo "export DAEMON_HOME=$HOME/.evmosd" >> ~/.profile
Copy the evmosd binary into the Cosmovisor directory
cp $GOPATH/bin/evmosd ~/.evmosd/cosmovisor/genesis/bin
Set up a Systemd service for Cosmovisor. Make sure you change
<yourUserName>to whatever username you want to run this under.
sudo tee /etc/systemd/system/evmosd.service > /dev/null <<EOF
ExecStart=$(which cosmovisor) start
Fire up the Cosmovisor service
sudo -S systemctl daemon-reload
sudo -S systemctl enable evmosd
sudo -S systemctl start evmosd
sudo -S systemctl status evmosd
This guide will be updated to explain how to configure Cosmovisor to automatically deploy an upgraded evmosd binary for you as soon as Cosmovisor detects the upgrade governance block. Until then, this section will be left incomplete.
Enjoy the moment! 🥩🥩🥩