Harmony Upgrade Script

Validator Toolbox Users this is option #10 & #11 in your menu. If you'd like to do it manually these are our scripts for upgrading harmony.

Scripted Upgrade of Harmony Application

This script is for updating the harmony server you setup with your guide.

⚠️

This is for updating your ~/harmony/harmony application only. For upgrading your operating system see our next page on Ubuntu Updates.

If you didn't follow our full Harmony Validator Companion Guide exactly, you may need to use your Linux administrator skills to modify some of the directories below.

ℹ️

Use these scripts at your own risk.

You can verify the curl command still matches the official harmony validator guide on updating a node using binary before proceeding.

Verified working as of 6/22/2021, current version information:

Harmony \(C\) 2020. harmony, version v7108-v4.1.8-0-g004a5867 \(runner@ 2021-06-21T23:26:31+0000\)

Create an Upgrade Script

Choose one of the 4 tabs below depending on how you setup the folder structure on your system. Copy and paste the contents into your console inside the directory with harmony.

If you've set up your node fully using our guide and have your stuff in ~/harmony you can skip to here to just pull upgrade_harmony.sh onto your node without any further customizations.

If you haven't used our guide and you don't have your harmony stuff in a folder, we cover 4 different possible setups below:

ℹ️

NOTICE: If you use a custom harmony.conf file you will will want to modify these scripts to not restart the service as you will want to edit your harmony.conf file manually before restarting.

For users under 10 BLS keys this file can be left at default settings. If you use 10+ BLS keys you will need to update the file and restart your harmony service so modify the script to remove the service restart.

Using Full Companion Guide Setup - serviceharmony user and ~/harmony folder

cat<<-EOF > ~/harmony/upgrade_harmony.sh
#! /bin/bash
mkdir -p ~/harmony/harmony_backup
cp ~/harmony/harmony ~/harmony/harmony_backup
cd ~/harmony
curl -LO https://harmony.one/binary && mv binary harmony && chmod +x harmony
./harmony -V
./harmony dumpconfig harmony.conf
sudo service harmony restart
sleep 10
./stats.sh
EOF

Using ~/harmony

cat<<-EOF > ~/harmony/upgrade_harmony.sh
#! /bin/bash
mkdir -p ~/harmony/harmony_backup
cp ~/harmony/harmony ~/harmony/harmony_backup
cd ~/harmony
curl -LO https://harmony.one/binary && mv binary harmony && chmod +x harmony
./harmony -V
./harmony dumpconfig harmony.conf
sudo service harmony restart
EOF
chmod +x ~/harmony/upgrade_harmony.sh

Using ~/ with stats.sh

cat<<-EOF > ~/upgrade_harmony.sh
#! /bin/bash
mkdir -p ~/harmony_backup
cp ~/harmony ~/harmony_backup/backup
curl -LO https://harmony.one/binary && mv binary harmony && chmod +x harmony
./harmony -V
./harmony dumpconfig harmony.conf
sudo service harmony restart
sleep 10
./stats.sh
EOF
chmod +x ~/harmony/upgrade_harmony.sh

Using ~/

cat<<-EOF > ~/upgrade_harmony.sh
#! /bin/bash
mkdir -p ~/harmony_backup
cp ~/harmony ~/harmony_backup/backup
curl -LO https://harmony.one/binary && mv binary harmony && chmod +x harmony
./harmony -V
./harmony dumpconfig harmony.conf
sudo service harmony restart
EOF
chmod +x ~/harmony/upgrade_harmony.sh

Here's a breakdown of the commands inside the script we're creating above.

You may need to update file names and paths to adapt it to your needs. We have 4 customized versions already setup for you to utilize.

ℹ️
  • Using Full Companion Guide Setup - Use this if you read our guide and can use this without modification.
  • Using ~/harmony - Use this if you didn't use our guide but store your files in ~/harmony
  • Using ~/ with stats.sh - Use this if you setup our Stats Script and run your files from your user home folder.
  • Using ~/ - Use this if you run your files from your user home folder or if you need a barebones script to edit as you need to configure for your system.

A line by line break down of the main tab script:

  1. Creates a file named ~/harmony/upgrade_harmony.sh Edit location if needed.
  2. lines 2-12 This is the guts of our new script file
  3. Make a backup folder Edit location if needed.
  4. Copy your current harmony file into the backup folder Edit location if needed.
  5. Change to ~/harmony folder Edit location if needed.
  6. Pull in latest binary file and change to harmony with permissions
  7. Show current version
  8. Restart service with new version Edit service name if needed.
  9. Dump a new configuration - A new configuration is required with each upgrade
  10. Wait a 10 seconds for harmony to start up fully
  11. Run our stats script to pull our stats

Modify Permissions

After creating the file you'll need to set it to allow execution with the following command. Pick the tab for your harmony file location.

Using ~/harmony

chmod +x ~/harmony/upgrade_harmony.sh

Using ~/

chmod +x ~/upgrade_harmony.sh

Pull upgrade\harmony.sh script onto your node

If you've followed our guide fully, use the following to download and setup upgrade_harmony.sh automatically:

wget https://raw.githubusercontent.com/easy-node-one/harmony-validator-scripts/main/upgrade/upgrade_harmony.sh && chmod +x upgrade_harmony.sh

Run Upgrade Script

Now you'll be able to run you upgrade script anytime there's a new update released with the following command in the folder with your harmony file.

./upgrade_harmony.sh

Once you have the script created it'll always pull the latest version of harmony from their site so you won't need to update unless there's an error or the link changes in the future.