Setup Cosmovisor
For mainnet, it's recommended to use Cosmovisor to run your node. If you've not used it before, then run it during a testnet to check you can get it set up correctly.
Setting up Cosmovisor is relatively straightforward. However, it does expect certain environment variables and folder structures to be set.
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 local timezone means that a chain upgrade will fall at a bad time.
Rather than having to do stressful ops tasks late at night, it's always better if you can automate them away, and that's what Cosmovisor tries to do.
Install
First, go and get cosmovisor (recommended approach):
Your installation can be confirmed with:
This will return something like:
Add environment variables to your shell
In the .zshrc
file, usually located at ~/.zshrc
, add:
Then source your profile to have access to these variables:
You can confirm success like so:
It should return berad
.
Set up the folder structure
Cosmovisor expects a certain folder structure:
Don't worry about current
- that is simply a symlink used by Cosmovisor. The other folders will need setting up, but this is easy:
Set up genesis binary
Cosmovisor needs to know which binary to use at genesis. We put this in $DAEMON_HOME/cosmovisor/genesis/bin
.
First, find the location of the binary you want to use:
Then use the path returned to copy it to the directory Cosmovisor expects. Let's assume the previous command returned /home/your-user/go/bin/berad
:
Once you're done, check the folder structure looks correct using a tool like tree
.
Set up service
Commands sent to Cosmovisor are sent to the underlying binary. For example, cosmovisor version
is the same as typing berad version
.
Nevertheless, just as we would manage berad
using a process manager, we would like to make sure Cosmovisor is automatically restarted if something happens, for example, an error or reboot.
First, create the service file:
Change the contents of the below to match your setup - cosmovisor
is likely at ~/go/bin/cosmovisor
regardless of which installation path you took above, but it's worth checking.
Note also that we set buffer size explicitly because of a live bug in Cosmovisor before version v1.0.0
. If you are using v1.0.0
, you may omit that line.
In addition, the same issue can be fixed by reducing the log via env variable. If you are unsure, ask on Discord.
Start Cosmovisor
Finally, enable the service and start it.
Check it is running using:
If you need to monitor the service after launch, you can view the logs using:
Last updated