Cosmovisor

Setting Up A Node Using Cosmovisor

Cosmovisor is a new process manager for cosmos blockchains. It can make low-downtime upgrades smoother, as validators don't have to manually upgrade binaries during the upgrade, and instead can pre-install new binaries, and Cosmovisor will automatically update them based on on-chain SoftwareUpgrade proposals.

You should review the docs for Cosmovisor located here: https://docs.cosmos.network/master/run-node/cosmovisor.html

Install Cosmovisor

# Get the Cosmovisor binary
wget -O - "https://github.com/cosmos/cosmos-sdk/releases/download/cosmovisor%2Fv1.1.0/cosmovisor-v1.1.0-linux-amd64.tar.gz" | sudo tar -xz -C /bin cosmovisor
sudo chmod +x /bin/cosmovisor

# Make the necessary directory structure for secretd v1.2
mkdir -p ~/.secretd/cosmovisor/genesis/bin

# Setup environment variables for every future bash session
# This will make sure to setup cosmovisor on you shell in
# in case you'll want to run the cosmovisor command manually
echo "# Setup Secret & Cosmovisor
export SCRT_ENCLAVE_DIR="${HOME}/.secretd/cosmovisor/current/bin"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${HOME}/.secretd/cosmovisor/current/bin"
export PATH="${PATH}:${HOME}/.secretd/cosmovisor/current/bin"
export DAEMON_NAME=secretd
export DAEMON_HOME="${HOME}/.secretd"
export DAEMON_ALLOW_DOWNLOAD_BINARIES=false
export DAEMON_LOG_BUFFER_SIZE=512
export DAEMON_RESTART_AFTER_UPGRADE=true
export DAEMON_DATA_BACKUP_DIR="${HOME}"
export UNSAFE_SKIP_BACKUP=true" >> ~/.profile
source ~/.profile

# Setup a systemd service
echo "[Unit]
Description=Cosmovisor Secret Network Node
After=network.target

[Service]
Type=simple
WorkingDirectory=${HOME}
ExecStart=/bin/cosmovisor run start
User=${USER}
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200
Environment=SCRT_ENCLAVE_DIR=${HOME}/.secretd/cosmovisor/current/bin
Environment=LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HOME}/.secretd/cosmovisor/current/bin
Environment=DAEMON_NAME=secretd
Environment=DAEMON_HOME=${HOME}/.secretd
Environment=DAEMON_ALLOW_DOWNLOAD_BINARIES=false
Environment=DAEMON_LOG_BUFFER_SIZE=512
Environment=DAEMON_RESTART_AFTER_UPGRADE=true
Environment=DAEMON_DATA_BACKUP_DIR=${HOME}
Environment=UNSAFE_SKIP_BACKUP=true

[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/cosmovisor.service > /dev/null

sudo systemctl daemon-reload
sudo systemctl enable cosmovisor

Set Up A New v1.2 Node

Now the Cosmovisor directory structure should look like this:

Now you might want to checkout the How To Join Secret Network as a Full Node guide for syncing a node from height 0 or Sync with State-Sync for syncing a node from a more recent block height.

After making the proper configurations to your new node, launch it using sudo systemctl start cosmovisor. You should now see blocks executing in the logs (journalctl -fu cosmovisor).

Migrate A Running v1.2 Node

Now the Cosmovisor directory structure should look like this:

To relaunch your node, use sudo systemctl start cosmovisor. You should now see blocks executing in the logs (journalctl -fu cosmovisor).

Prepare A v1.3 Node Upgrade (Shockwave Alpha)

The "Shockwave Alpha" upgrade is anticipated to be on Wednesday April 27th, 2022 at 2:00PM UTC. Below are instructions to prepare Cosmovisor for automatically upgrading your node to v1.3.

Now the Cosmovisor directory structure should look like this:

If set up properly, when the time comes Cosmovisor will perform an automatic v1.2 to v1.3 upgrade.

Last updated

Was this helpful?