Cosmovisor Integration - Binaries
cosmovisor
is a small 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.
Installing cosmovisor:
go install cosmossdk.io/tools/cosmovisor/cmd/[email protected]
Set up the Cosmovisor environment variables. We recommend setting these in your
.profile
so it is automatically set in every session.echo "# Setup Cosmovisor" >> ~/.profile
echo "export DAEMON_NAME=fxcored" >> ~/.profile
echo "export DAEMON_HOME=$HOME/.fxcore" >> ~/.profile
source ~/.profile
After this, you must make the necessary folders for
cosmosvisor
in your DAEMON_HOME
directory (~/.fxcore
) and copy over the current binary.mkdir -p ~/.fxcore/cosmovisor
mkdir -p ~/.fxcore/cosmovisor/genesis/bin
mkdir -p ~/.fxcore/cosmovisor/upgrades/fxv3
Manually download the binary and extract it to folder:
Build from source
Ubuntu
Mac
Windows
git clone https://github.com/functionx/fx-core.git
git checkout release/v2.4.x
make build
cp ./build/bin/fxcored ~/.fxcore/cosmovisor/genesis/bin/
git checkout release/v3.1.x
make build
cp ./build/bin/fxcored ~/.fxcore/cosmovisor/upgrades/fxv3/bin/
wget https://github.com/FunctionX/fx-core/releases/download/v2.4.2/fx-core_2.4.2_Linux_x86_64.tar.gz && tar -xvf fx-core_2.4.2_Linux_x86_64.tar.gz -C ~/.fxcore/cosmovisor/genesis/
wget https://github.com/FunctionX/fx-core/releases/download/v3.1.0/fx-core_3.1.0_Linux_x86_64.tar.gz && tar -xvf fx-core_3.1.0_Linux_x86_64.tar.gz -C ~/.fxcore/cosmovisor/upgrades/fxv3/
wget https://github.com/FunctionX/fx-core/releases/download/v2.4.2/fx-core_2.4.2_Darwin_x86_64.tar.gz && tar -xvf fx-core_2.4.2_Darwin_x86_64.tar.gz -C ~/.fxcore/cosmovisor/genesis/
wget https://github.com/FunctionX/fx-core/releases/download/v3.1.0/fx-core_3.1.0_Darwin_x86_64.tar.gz && tar -xvf fx-core_3.1.0_Darwin_x86_64.tar.gz -C ~/.fxcore/cosmovisor/upgrades/fxv3/
wget https://github.com/FunctionX/fx-core/releases/download/v2.4.2/fx-core_2.4.2_Windows_x86_64.zip && tar -xvf fx-core_2.4.2_Windows_x86_64.zip -C ~/.fxcore/cosmovisor/genesis/
wget https://github.com/FunctionX/fx-core/releases/download/v3.1.0/fx-core_3.1.0_Windows_x86_64.zip && tar -xvf fx-core_3.1.0_Windows_x86_64.zip -C ~/.fxcore/cosmovisor/upgrades/fxv3/
Copying the json upgrade info, you do not need to perform this step if there is no
upgrade-info.json
file in the ~/.fxcore/data/
foldercp ~/.fxcore/data/upgrade-info.json ~/.fxcore/cosmovisor/genesis/
To check that you did this correctly, ensure your versions of
cosmovisor
are the same:cosmovisor version
cosmovisor version: devel-4846b9b49cbaac9da2c5df74391b9d30bfc4242e
app version: HEAD-cbba9a3bd29cfff6b9b1a7b8154922e8bc9027e8
The directory structure after correctly configuring cosmovisor should be like this
/root/.fxcore:$ tree cosmovisor
cosmovisor
├── current -> /root/.fxcore/cosmovisor/genesis
├── genesis
│ ├── bin
│ │ └── fxcored
│ └── upgrade-info.json
└── upgrades
└── fxv3
└── bin
└── fxcored
6 directories, 3 files
To keep the process always running. If you're on linux, you can do this by creating a service.
sudo tee /etc/systemd/system/fxcored.service > /dev/null <<EOF
[Unit]
Description=Fxcore Daemon
After=network-online.target
[Service]
User=root
ExecStart=/root/go/bin/cosmovisor run start --home=/root/.fxcore
Restart=always
RestartSec=3
LimitNOFILE=infinity
Environment="DAEMON_HOME=/root/.fxcore"
Environment="DAEMON_NAME=fxcored"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="UNSAFE_SKIP_BACKUP=true"
[Install]
WantedBy=multi-user.target
EOF
Reload, enable and restart the node with daemon service file
sudo -S systemctl daemon-reload
sudo -S systemctl enable fxcored
sudo -S systemctl restart fxcored
Accessing logs
Entire Log
journalctl -u fxcored