Story Cosmovisor

- Check go version #requirement go version above v.1.22 if you have Go v.1.22 already. Please skip install Go step.
1. Install go
cd $HOME && \ver="1.22.0" && \wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \sudo rm -rf /usr/local/go && \sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \rm "go$ver.linux-amd64.tar.gz" && \[ ! -f ~/.bash_profile ] && touch ~/.bash_profile && \echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.bash_profile && \source ~/.bash_profile && \go version
2. Install Cosmovisor
#cosmovisor version 1.7source $HOME/.bash_profilego install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest

- Check cosmovisor version:
cosmovisor version

3. Init Cosmovisor
- Set DAEMON_HOME:
export DAEMON_NAME=storyecho "export DAEMON_NAME=story" >> $HOME/.bash_profileexport DAEMON_HOME=$HOME/.story/storyecho "export DAEMON_HOME=$HOME/.story/story" >> $HOME/.bash_profile

- Initialize Cosmovisor with DAEMON_HOME:
cosmovisor init $(whereis -b story | awk '{print $2}')

- Create the backup directory: Now that DAEMON_HOME is defined, you can create the necessary directories.
mkdir -p $DAEMON_HOME/cosmovisor/backupecho "export DAEMON_DATA_BACKUP_DIR=$DAEMON_HOME/cosmovisor/backup" >> $HOME/.bash_profileecho "export DAEMON_ALLOW_DOWNLOAD_BINARIES=false" >> $HOME/.bash_profile
After setting up, reload your environment variables with:
source $HOME/.bash_profile
4. Create upgrades folder
mkdir -p $HOME/.story/story/cosmovisor/genesis/bin
- Stop node
sudo systemctl stop story
- Update service file:
sudo tee /etc/systemd/system/story.service > /dev/null <<EOF[Unit]Description=Story Consensus ClientAfter=network.target
[Service]User=rootEnvironment="DAEMON_NAME=story"Environment="DAEMON_HOME=/root/.story/story"Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"Environment="DAEMON_RESTART_AFTER_UPGRADE=true"Environment="DAEMON_DATA_BACKUP_DIR=/root/.story/story/data"Environment="UNSAFE_SKIP_BACKUP=true"ExecStart=/root/go/bin/cosmovisor run runRestart=alwaysRestartSec=3LimitNOFILE=65535
[Install]WantedBy=multi-user.targetEOF
sudo systemctl daemon-reloadsudo systemctl start story && sudo systemctl status story
