Inherited 9.3.8 Server Need to Upgrade

You will have quite a lot of work with this. Here is the upgrade path which you have probably seen: Upgrading GitLab | GitLab

Here are all the versions available for Ubuntu Trusty: gitlab/gitlab-ce - Results for 'gitlab-ce' and trusty in gitlab/gitlab-ce (Page 6) which only goes as high as 11.10.8

But you have to go to the intermediate versions between this and your existing version. So your upgrade path looks like:

9.5.10 → 10.0.7 → 10.8.7 → 11.0.6 → 11.10.8

After this, you will need to upgrade from Trusty to the next Ubuntu release so 16.04 Xenial by editing your /etc/apt/sources.list by replacing trusty with xenial. At which point you can continue the upgrade process. Once you have upgraded to Xenial, you can then edit the /etc/apt/sources.list.d/gitlab_ce-gitlab-ce.list file and change from trusty to xenial DO NOT EDIT THIS UNTIL TRUSTY HAS BEEN UPDATED TO XENIAL FIRST ELSE YOU WILL BREAK YOUR GITLAB INSTALL

You can now upgrade Gitlab using the xenial packages.

11.11.8 → 12.0.2 → 12.1.7 → 12.10.14 → 13.0.14 → 13.1.11 → 13.8.8 → 13.12.15

before you can go to Gitlab 14, you have to do your next upgrade to Ubuntu 18.04 Bionic, so again edit the sources.list file from xenial to bionic, upgrade, reboot and then continue the upgrade path.

14.0.12 → 14.3.6 → 14.9.5 → 14.10.5 → 15.0.5 → 15.1.6 → 15.4.6 → 15.10.0

You can at this point stay on Ubuntu 18.04, or you could upgrade to Ubuntu 20.04 focal. Focal also has 15.10.0 package.

Commands for upgrading you need to follow the docs so: Upgrade GitLab by using the GitLab package | GitLab

apt-cache madison gitlab-ce

that command shows what versions can be installed, and then you make the next command based on the output so:

apt install gitlab-ce=<version>

replacing with the version number as shown in the output from the madison command.

As for upgrading Ubuntu, I suggest not to use do-release-upgrade because it has a tendency to remove packages that aren’t in their repositories, so could end up removing your gitlab install. Better is after editing the source files to do:

apt-get clean all
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get autoremove

then after these commands reboot into your new version so after doing this on Trusty, on reboot you will be in Xenial. Then you can continue the gitlab commands, so madison to get the version number, and the second command to upgrade to the next version on the upgrade path. Please ensure that before you go from trusty to xenial, that you are on the latest Gitlab available for trusty, else upgrading to xenial might end up upgrading Gitlab to the latest available without following the upgrade path and this will break your install.

It is very important not to edit the gitlab-ce.list file from trusty to xenial, or xenial to bionic until Ubuntu itself has been upgraded, otherwise Gitlab will attempt to upgrade to the latest version available and break your Gitlab. So in summary:

  1. Edit /etc/apt/sources.list and change trusty to xenial.
  2. Run the apt-get steps I listed above.
  3. Reboot into upgraded Ubuntu.
  4. Edit gitlab-ce.list file and change from trusty to xenial.
  5. Upgrade Gitlab following the upgrade path.

Then repeat those steps for the next Ubuntu release, so bionic and then later focal if you wish. Another alternative, would be on Ubuntu 18.04 and 15.10.0 release to make a backup, and then copy this along with /etc/gitlab/gitlab.rb and /etc/gitlab/gitlab-secrets.json to a new server with Ubuntu 20.04 focal installed, and then restore it as per the Gitlab backup/restore docs. Then it will be a much cleaner Ubuntu, rather than one upgraded from 14.04 to the latest. That said, it is possible to find the older packages and remove them to clean up your upgrade process.

Ensure also after each Gitlab upgrade that background migrations have finished before continuing the next upgrade on the upgrade path - otherwise you can break your Gitlab install see here: Check for background migrations before upgrading | GitLab

Also, before starting your upgrade, make sure you have a full backup of your server just in case something goes wrong. That way you can always revert.

2 Likes