Update Your Node

There are several ways to update a FIO node, however, all of them basically come down to just replacing the nodeos binary; the differences being how the nodeos binary is running, i.e. as a daemon (using systemctl). While the instructions below pertain specifically to a FIO node being installed and configured using a pre-built FIO deb package, it will apply to production-level nodes.

FIO Node Installed from Deb Package

For a FIO node installed using a pre-built FIO package, including the full package as well as the tar and minimal packages, the process of updating the nodeos binary is a matter of

  1. Downloading the latest package
  2. Extract the FIO blockchain binaries
  3. Replace the installed binaries with the new ones

The following script assumes that the node was installed using the full FIO package deb based on instructions found at Installation Using Packages, specifically that the nodeos application is running as a daemon and that logging is configured.

#!/usr/bin/env bash

# Utility functions
function pause(){
 read -s -n 1 -p "Press any key to continue..."
 echo ""
}

# Main script functionality
echo
echo FIO Package Update...
echo
echo "Before proceeding it is recommended to download the most recent snapshot and/or blocks.log"
echo "as a safetly precaution as a node shutdown and start up may corrupt the database."
echo
echo "Caution: Do not perform a 'systemctl restart fio-nodeos' as the restart action occurs too"
echo "fast to properly shutdown, capture the current state, and start up a FIO node!"
echo
pause
echo "Download lastest snapshot and/or blocks.log from https://snap.blockpane.com"
echo
pause

echo "Shutting down fio-nodeos..."
#sudo systemctl status fio-nodeos
if (systemctl -q is-active fio-nodeos); then
   sudo systemctl stop fio-nodeos >/dev/null 2>&1
fi
echo "Confirm that nodeos is stopped before proceeding"
echo
pause

# A log rotation is needed; not doing this causes odd logging behavior; while nodeos will
# start up fine either
# - nodeos loses its pointer to the end of the log file
# - nodeos has to re-read the entire log file which may take a long time
echo "Forcing a log rotation..."
sudo logrotate -vf /etc/logrotate.d/fio-nodeos >/dev/null 2>&1
sleep 5

pushd /usr/local/bin/
sudo rm -f clio fio-nodeos fio-nodeos-run fio-wallet
sudo ar x /home/ubuntu/downloads/fioprotocol-3.5.0-rc1-ubuntu-18.04-amd64.deb data.tar.xz
sudo tar xvf data.tar.xz --transform='s|.*/||' --wildcards './usr/local/bin/*'
rm ./data.tar.xz
popd

sleep 5
sudo systemctl start fio-nodeos