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
- Downloading the latest package
- Extract the FIO blockchain binaries
- 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.
Destructive
The following script must be run as root/using sudo. Note that the use of 'sudo' is for Advanced users!
#!/usr/bin/env bash
# Run this script using sudo, i.e. sudo cleanup-fio-install.sh
echo
if [[ "$EUID" -ne 0 ]]; then
echo "ERROR: Script must be run as root! Use sudo command as follows; sudo ./<script name>"
echo
exit 1
fi
# 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
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. Note that this might take 10-20 seconds..."
logrotate -vf /etc/logrotate.d/fio-nodeos >/dev/null 2>&1
sleep 5
pushd /usr/local/bin/
rm -f clio fio-nodeos fio-nodeos-run fio-wallet
ar x /home/ubuntu/downloads/fioprotocol-3.5.1-ubuntu-20.04-amd64.deb data.tar.xz
tar xvf data.tar.xz --transform='s|.*/||' --wildcards './usr/local/bin/*'
rm -f ./data.tar.xz
popd
sleep 5
systemctl start fio-nodeos
Updated 16 days ago