Skip to content

Instantly share code, notes, and snippets.

@EdwardPrentice
Created March 14, 2021 17:30
Show Gist options
  • Save EdwardPrentice/ca4870d57ca406465112b58ad477910f to your computer and use it in GitHub Desktop.
Save EdwardPrentice/ca4870d57ca406465112b58ad477910f to your computer and use it in GitHub Desktop.
How I upgrade Teku on my Ethereum Validator
# Warning: This is a human script that needs to be used interatively.
# That said it wouldn't take much to improve it so it could all be done with a single invocation
# Download the new version and do a checksum check. Output check is manual
TEKU_VERSION="teku-21.2.0.tar.gz"; curl -s https://artifacts.consensys.net/public/teku/raw/names/teku.tar.gz/versions/21.2.0/$TEKU_VERSION -o $TEKU_VERSION && shasum -a 256 -c <<< "27aba84f4ac8678ebd7dea7d2e19790cad7d04b5faf9108ce331c2f8a9e2330f *$TEKU_VERSION" || (echo "Checksum failed deleting file" && rm $TEKU_VERSION); tar -xf $TEKU_VERSION -C /opt
# Create a symlink to the newly extracted teku version
ln -s /opt/teku-21.2.0/bin/teku /usr/bin/teku-21.2.0
# Edit the service file to point to the new symlink
vim /etc/systemd/system/teku.service
# Restart everything and watch the validator start
systemctl daemon-reload
systemctl restart teku && journalctl -u teku -f
@theoob
Copy link

theoob commented Mar 12, 2022

Here's my spin on it, not completely tested so be careful:

#!/bin/bash
# Script should be run with this command: sudo bash UpdateTeku.sh
echo Go here: https://github.com/ConsenSys/teku/releases and copy the tar.gz link, then paste it into here
read UpdateFilePath
echo From the same page, copy the sha256 hash for the tar.gz file
read Sha256Hash
UpdateFileName="${UpdateFilePath##*/}"
UpdateVersion=${UpdateFileName::-7}
echo "File name is: $UpdateFileName"
echo "Update version is: $UpdateVersion"
# Remove existing contents of temporary Teku directory (if any, probably not)
sudo rm -rf /var/lib/teku/tmp/*
# Download the new version and do a checksum check. Output check is manual
TEKU_VERSION="$UpdateFileName"; curl -s "$UpdateFilePath" -o "$UpdateFileName" && shasum -a 256 -c <<< "$Sha256Hash *$TEKU_VERSION" || (echo "Checksum failed deleting f>
# Stop the Teku client service
sudo systemctl stop teku
# Remove old Teku files
sudo rm -r /usr/local/bin/teku
# Copy in new files
sudo cp -a "/var/lib/teku/tmp/$UpdateVersion/." /usr/local/bin/teku/
# Start the Teku client service
sudo systemctl start teku
# Remove existing contents of temporary Teku directory (don't really need to do this since it gets done earlier in the script, I just want to keep things clean)
sudo rm -rf /var/lib/teku/tmp/*
# TODO: remove the downloaded .tar.gz file
# Check for errors
sudo systemctl status teku
# Monitor
sudo journalctl -fu teku.service

@theoob
Copy link

theoob commented Mar 16, 2022

Now tested and confirmed working, at least on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment