Cosmovisor is a sophisticated process manager designed to facilitate an effortless alternative to the conventional initiad start command. It is tailored for use both manually and as a system service, providing seamless automatic updates for blockchains that utilize the Cosmos SDK.
Step1: Install Cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
Step 2: Set up Cosmovisor
export DAEMON_HOME=~/.initia
export DAEMON_NAME=initiad
cosmovisor init `<path-to-executable>`
# copy two shared libraries `libmovevm.x86_64.so` and `libcompiler.x86_64.so`
cp `<shared-library-path>` $DAEMON_HOME/cosmovisor/current/
# only if there is planned upgrade
export UPGRADE_NAME=<upgrade-name>
mkdir -p $DAEMON_HOME/cosmovisor/upgrades/$UPGRADE_NAME/bin
cp `<path-to-upgrade-executable>` \
`<path-to-upgrade-shared-library>` \
$DAEMON_HOME/cosmovisor/upgrades/$UPGRADE_NAME/bin
Step 3: Set up System Service File
[Unit]
Description=initiad
[Service]
Type=simple
User=ubuntu
ExecStart=/home/ubuntu/go/bin/cosmovisor run start --home /home/ubuntu/.initia
WorkingDirectory=/home/ubuntu/.initia
Restart=on-abort
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=initiad
LimitNOFILE=infinity
Environment="DAEMON_NAME=initiad"
Environment="DAEMON_HOME=/home/ubuntu/.initia"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true" # recommend to set false and manually build from the source code
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="LD_LIBRARY_PATH=/home/ubuntu/.initia/cosmovisor/current"
[Install]
WantedBy=multi-user.target