Update GitHub Enterprise Server

GitHub Enterprise Server is a great product, you have your version controller on premises. Licenses for GitHub Enterprise Server are also included in some of the Visual Studio Subscriptions so you maybe already have a license for GitHub Enterprise Server without knowing it.
In this guide I’ll walk you through how to update GitHub Enterprise Server when your using replication nodes.

Introduction

Prerequisite

  • Admin permissions to your GitHub instances
  • SSH access to your GitHub instances
  • SSH software
    • macOS, you can use Terminal
    • Linux, you can use Terminal
    • Windows, I do recommend you to use PuTTY

Good to know

  • All commands are casesensetive
  • GitHub SSH port number is usually 122, but if you have change it you need to replace 122 to your port number in this guide

Check for updates

  • You can check if it’s any available patches with this command

    ghe-update-check
    

  • If you want to check if it’s any new major releases, execute this command

    ghe-update-check -i
    

  • If your GitHub instance haven’t automatically downloaded the latest release, my recommendation is that you go to GitHub release page and copy the URL. Then download it with wget. This is because in my experience that goes much faster than downloading it with ghe

  • Click on download, then on Upgrade. After that you can select the upgrade that fits your infrastructure

  • SSH into your GitHub node, change location and download the update

    cd /var/lib/ghe-updates
    wget YOURCOPIEDURL
    

Enter maintenance mode

  • SSH into your GitHub master node, when we login we can see if it’s the master node or master node. This is good as sometimes you can mix things up, and this will prevent that

    ssh -p 122 admin@MASTERFQDN
    

  • To set GitHub in maintenance mode execute the following command

    ghe-cluster-maintenance --set
    

  • When your users are trying to access your GitHub trough the browser, they will see this

  • You might want to change the default maintenance message, to do that you can execute the following command

    ghe-cluster-maintenance --message "Down for update, back at 14"
    

  • Now your users will see this message instead of the default maintenance message

  • It can take some time before it has entered maintenance mode depending on many different variables, so it’s a good idea that you always verify that it’s in maintenance mode before continuing

    ghe-cluster-maintenance --query
    

Take snapshot

It’s important that you take a snapshot of your master node and replication node before we continue.

Stop replication

  • SSH into your GitHub replica node, when we login we can see if it’s the replica node or master node. This is good as sometimes you can mix things up, and this will prevent that

    ssh -p 122 admin@REPLICFQDN
    

  • When we are updating GitHub, we want to stop the replication. It’ll take a long time to stop the replication so just wait

    ghe-repl-stop
    

  • You can verify that the replication has stopped by entering the following command

    ghe-repl-status
    

  • Now, SSH in to your master node again

Update

Locate update file

  • GitHub are downloading the updates automatically, just to confirm that the update is downloaded we can navigate to the folder ghe-updates and look
    cd /var/lib/ghe-updates
    ls
    

Update master

  • Always update the master node first

  • It’s time to start the upgrade, this can take some time. Remember to change the name of the file if it’s a newer version then the one that I’m updating to in this guide

    ghe-upgrade  /var/lib/ghe-updates/github-enterprise-3.13.2.hpkg
    

  • When you get the question if you want to proceed enter y and then press enter, now nothing but a sign is showing for a long time. But don’t worry, nothing is wrong it will continue soon

  • Now it’s finished!

  • As you can see, we need to reboot our master node, so let’s do that

    sudo reboot
    

  • SSH into your master node again after 2 minutes or something like that, you see “WARN: Configuration run in progress: true” then you need to wait a little longer before we start to update our replica server

  • When everything is done it should look like this

  • You can verify that your GitHub have been updated to the correct version

    ghe-version
    

  • Now it’s time to update our replica

Update replica

I’ll write each step you need to take for the replica node update process, but I’ll not explain steps that you can find in the Update master section.

  • SSH into your replica node
  • Locate the update file
  • Execute the update command
  • Reboot the replica node if needed
  • Wait until “WARN: Configuration run in progress: true” changes to false

Start replication

  • Now it’s time to start the replication again, on the replica node enter the following command. This can take some time so just wait until it’s finished

    ghe-repl-start
    

  • Let’s verify that our replication is working

    ghe-repl-status
    

Exit maintenance mode

  • SSH in to the master node
  • Write the following command to exit maintenance mode
    ghe-cluster-maintenance --unset
    

Conclusion

In this guide I have showed you how to update GitHub Enterprise Server On-Prem.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.