Cosmovisor
What's Cosmovisor
cosmovisor
is a 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.
Setup
Installation
Downloading the Binary:
You can download Cosmovisor from the GitHub releases.
Using
go install
To install the latest version of cosmovisor, run the following command:
To install a specific version, you can specify the version:
Setting up environmental variables
cosmovisor
relies on the following environmental variables to work properly:
DAEMON_HOME
is the location where upgrade binaries should be kept (e.g. $HOME/.sided).DAEMON_NAME
is the name of the binary itself (eg. sided).DAEMON_ALLOW_DOWNLOAD_BINARIES
(optional, default = false) if set to true will enable auto-downloading of new binaries (for security reasons, this is intended for full nodes rather than validators).DAEMON_RESTART_AFTER_UPGRADE
(optional, default = true) if set to true it will restart the sub-process with the same command line arguments and flags (but new binary) after a successful upgrade. By default, cosmovisor dies afterwards and allows the supervisor to restart it if needed. Note that this will not auto-restart the child if there was an error.DAEMON_POLL_INTERVAL
(optional, default = 300ms) is the interval length for polling the upgrade plan file. The value can either be a number (in milliseconds) or a duration (e.g. 1s).UNSAFE_SKIP_BACKUP
(optional, default = false), if set to true, upgrades directly without performing a backup. Otherwise (false) backs up the data before trying the upgrade. The default value of false is useful and recommended in case of failures and when a backup needed to rollback. We recommend using the default backup optionUNSAFE_SKIP_BACKUP=false
.
To set these variables correctly, we recommend editing the ~/.profile
file so that they are loaded when you log into your machine. You can use the following command:
We recommend that you configure the following values:
After making the necessary changes, press Ctrl+O
to save the file and then Ctrl+X
to exit the editor. To apply the changes, reload the ~/.profile
file by running:
You can confirm the values that have been set by executing the following command:
If the output of this command is sided
then you're all set to proceed.
Setting up folder structure
Cosmovisor expects a certain folder structure:
You don't need to be concerned about the current
folder as it's merely a symbolic link utilized by Cosmovisor. However, the other directories will require configuration, but this process is straightforward:
Copy sided
to the genesis folder.
sided
to the genesis folder.You can verify this by running the following command (you should see the version of sided
):
Starting your node
Setup Service
First, create the service file:
Insert the following content into the sided.service
file.
Note: We assume you are using the "ubuntu" user. If you prefer to use a different user, please replace "ubuntu" with your desired username.
Secondly, copy cosmovisor
to /usr/local/bin
,
Finally, enable the service and start it.
Last updated