auto update
We strongly recommend that validators use Cosmovisor to run their nodes. This will allow for smoother upgrades with low downtime, since validators don't have to manually upgrade binaries during upgrades. Instead, users can pre-install new binaries and Cosmovisor will automatically update them based on on-chain software upgrade recommendations.
cosmovisor
is a small process manager for Cosmos SDK application binaries, a governance module that monitors incoming chain upgrade proposals.
If it sees a proposal approved, cosmovisor can automatically download the new binary, stop the current binary, switch from the old binary to the new binary, and finally replace the new binary with the new binary. file to restart the node.
prerequisites
1. Configure Cosmovisor
📣 Tip: $install_path
is used to indicate the path where you installed the stcd
binary
Set Cosmovisor environment variables. We recommend setting these in your .profile
so that they are set automatically on each session.
echo "# Setup Cosmovisor" >> ~/.profile
echo "export DAEMON_NAME=stcd" >> ~/.profile
echo "export DAEMON_HOME=$install_path/.stcd" >> ~/.profile
source ~/.profile
After this, you must create the necessary folders for cosmosvisor
in your DAEMON_HOME
directory ($install_path/.stcd`) and copy the current binaries.
mkdir -p $install_path/.stcd/cosmovisor
mkdir -p $install_path/.stcd/cosmovisor/genesis
mkdir -p $install_path/.stcd/cosmovisor/genesis/bin
mkdir -p $install_path/.stcd/cosmovisor/upgrades
cp $GOPATH/bin/stcd $install_path/.stcd/cosmovisor/genesis/bin
To check that you are doing this correctly, make sure your cosmovisor
and stcd
versions are the same:
cosmovisor run version
stcd version
2. Download Daodst version
Manual download
Cosmovisor will constantly poll $DAEMON_HOME/data/upgrade-info.json
for new upgrade instructions.
When upgrading, node operators need to:
- Download (NOT INSTALLED) the binaries for the new version
- Put it under
$DAEMON_HOME/cosmovisor/upgrades/<name>/bin
, where<name>
is the URI-encoded name of the upgrade specified in the software upgrade plan.
Example: For a plan
named v3.0.0
and the following upgrade-info.json
:
{
"binaries": {
"linux/arm64": "https://github.com/daodst/blockchain/releases/download/v3.0.0/daodst_3.0.0_Linux_arm64.tar.gz",
"linux/amd64": "https://github.com/daodst/blockchain/releases/download/v3.0.0/daodst_3.0.0_Linux_amd64.tar.gz",
"windows/x86_64": "https://github.com/daodst/blockchain/releases/download/v3.0.0/daodst_3.0.0_Windows_x86_64.zip"
}
}
Your cosmovisor/
directory should look like this:
cosmovisor/
├── current/ # either genesis or upgrades/<name>
├── genesis
│ └── bin
│ └── stcd
└── upgrades
└── v3.0.0
├── bin
│ └── stcd
└── upgrade-info.json
Automatic download
⚠️ NOTE : Automatic downloads do not verify in advance that binaries are available. If there is any problem downloading the binary, cosmovisor
will stop and not restart the chain (which might cause it to stop).
It is possible to have Cosmovisor auto-download new binaries. Validators can use the automatic download option to prevent unnecessary downtime during upgrades.
This option will automatically restart the chain with the upgrade binary once the chain stops at the recommended upgrade-height.
The main benefit of this option is that validators can prepare upgrade binaries ahead of time and then relax while upgrading.
To set up automatic downloads use set the following environment variables:
echo "export DAEMON_ALLOW_DOWNLOAD_BINARIES=true" >> ~/.profile
3. Start your node
Now everything is set up and ready to go, you can start your node.
cosmovisor run start
You're going to need some way to keep the process running all the time. If you are on linux you can do this by creating a service.
sudo tee /etc/systemd/system/stcd.service > /dev/null <<EOF
[Unit]
Description=Daodst Chain Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) start
Restart=always
RestartSec=3
LimitNOFILE=infinity
Environment="DAEMON_HOME=$HOME/.stcd"
Environment="DAEMON_NAME=stcd"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
[Install]
WantedBy=multi-user.target
EOF
Then update and start the node
sudo -S systemctl daemon-reload
sudo -S systemctl enable stcd
sudo -S systemctl start stcd
You can check the status with:
systemctl status stcd