Cosmovisor
Cosmovisor is a process manager for Cosmos-SDK application binaries that monitors the governance module for incoming chain upgrade proposals.
If cosmovisor
sees a proposal get approved, it can automatically download the new binary, stop the currently running binary, switch from the old binary to the new one, and finally restart the node with the new binary.
Cosmovisor allows you to download binaries ahead of time for chain upgrades, meaning that you can do zero (or close to zero) downtime chain upgrades. It's also useful if your timezone doesn't align well with a chain upgrade.
TIP
It's recommended to use either Cosmovisor or systemd
to run your node.
Rather than having to do stressful DevOps tasks late at night, it's better if you can automate them away, and that's what Cosmovisor tries to do. It's wise to go through the cosmovisor
setup instructions on testnet before running a full-node on mainnet.
Cosmovisor Setup
TIP
If you have not installed nibid
, please install the corresponding version:
curl -s https://get.nibiru.fi/@v1.0.0! | bash
WARNING
When using Cosmovisor, make sure that you do not have auto download of binaries on.
Install Cosmovisor Follow these instructions to install Cosmovisor.
Set up enviroment variables
bashexport DAEMON_NAME=nibid export DAEMON_HOME=$HOME/.nibid
Create required directories
bashmkdir -p $DAEMON_HOME/cosmovisor/genesis/bin mkdir -p $DAEMON_HOME/cosmovisor/upgrades
Add the genesis version of the binary (currently it is
v1.0.0
both fornibiru-testnet-1
andcataclysm-1
networks) to thecosmovisor
directory. You can verify your binary location withwhich nibid
command. For example:bashcp $(which nibid) $DAEMON_HOME/cosmovisor/genesis/bin
Create the service for Cosmovisor
bashsudo tee /etc/systemd/system/cosmovisor-nibiru.service<<EOF [Unit] Description=Cosmovisor for Nibiru Node Requires=network-online.target After=network-online.target [Service] Type=exec User=<your_user> Group=<your_user_group> ExecStart=/home/<your_user>/go/bin/cosmovisor run start --home /home/<your_user>/.nibid Restart=on-failure RestartSec=3 Environment="DAEMON_NAME=nibid" Environment="DAEMON_HOME=/home/<your_user>/.nibid" Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false" Environment="DAEMON_RESTART_AFTER_UPGRADE=true" Environment="DAEMON_LOG_BUFFER_SIZE=512" LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF
Enable the service:
bashsudo systemctl daemon-reload sudo systemctl enable cosmovisor-nibiru
You can inspect the logs using journalctl.
bashjournalctl -fu cosmovisor-nibiru