Upgrade gitlab version from 9.0.1 to 13.8

Hi,

I have been following this doc:
https://docs.gitlab.com/ee/update/README.html#checking-for-background-migrations-before-upgrading

Has anyone upgraded from such an old version to the latest version?

Is there an easier way to upgrade? or do I need to install all the minor versions in between the major versions and then the major versions as I move up the version numbers? It seems like to me that this will take a very long time to move to 13.8.

Hi, check here for an idea:

https://docs.gitlab.com/ee/update/#upgrade-paths

and yes, you will have to follow certain versions, because there are important database migrations that need to be ran. If you miss one, then you will break your installation. Therefore:

9.5.10 -> 10.8.7 -> 11.11.8 -> 12.0.12 -> 12.1.17 -> 12.10.14 -> 13.0.14 -> 13.1.11 - > 13.x (latest)

are each of the versions you need to step through. Also please make sure after upgrading that you wait for background migrations to finish. If you start the next upgrade before this has finished, it will also break your installation.

https://docs.gitlab.com/ee/update/#checking-for-background-migrations-before-upgrading

So in summary, upgrade to 9.5.10 and check background migrations. When it shows zero, then you can start the next upgrade to 10.8.7. Repeat background check, and then next upgrade.

Please ensure you take a full backup in case it goes wrong.

1 Like

Thanks Ian, Does that mean I do not need to do the small point upgrades and that I can follow the versions you have listed here.
so from 9.0.1 I can straight go to 9.5.10 and not do 9.2 and 9.3.

Also what is the best way to do a full backup. I did a backup b4 and then installed that on the same version on a different server but the gitlab service just did not start up.

Yes, you can follow that path. I was stuck on 12.9.3 once, and I wasn’t sure of the upgrade path, and went and did absolutely every single point release from 12.9.3 to the latest. Very time-consuming, but at least I was guaranteed to ensure it worked in case something was missed. But in all honesty, I could have followed the upgrade path as per the doc, I just wanted to be 200% sure.

The path on the docs is probably all the versions where certain migrations took place. From 13.x onwards, a lot of the migrations were done in 13.x.0 releases from what I remember reading once. Just have a backup on the safe side by snapshotting your server if under VMware, KVM, or whatever, or whichever backup methods you are utilising so that you can at least revert.

Providing you don’t skip a release, it shouldn’t be a problem. As for backups:

https://docs.gitlab.com/omnibus/settings/backups.html

Hi Ian, Just wondering how you did your upgrade/install. We are using the community edition and we installed our build with an rpm install on centos. To upgrade to the various points do I just have to do a rpm -Uvh packagename or is their something more involved? I know after each upgrade I have to make sure the background migration is finished before next upgrade.

Also before upgrade I did a backup using the command gitlab-rake gitlab:backup:create This created a .tar file and I also backed up gitlab.rb and gitlab-secrets.json. Do I need to make a backup of anything else?

In terms of restore if i just unpackage the tar and below steps are these correct or did i miss something here?

sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop puma
sudo gitlab-ctl stop sidekiq

Verify

sudo gitlab-ctl status
Next, restore the backup, specifying the timestamp of the backup you wish to restore:

# This command will overwrite the contents of your GitLab database!
gitlab-rake gitlab:backup:restore BACKUP=11493107454_2018_04_25_10.6.4-ce.tar

Next, restore /etc/gitlab/gitlab-secrets.json

Reconfigure, restart and check GitLab:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo gitlab-rake gitlab:check SANITIZE=true

Hi, as per the restore, you don’t need to unpack the tar, just put it in /var/opt/gitlab/backups and make sure it is the only one in there. Then following the Gitlab docs:

https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-installation-from-source

Then reconfigure and start everything. Obviously, the backup must be from the same version of gitlab that you are trying to restore.

My upgrades were on Debian/Ubuntu so there are different commands to run to actually do this. Other difficulties you might encounter depends on which version of CentOS you have installed, since if CentOS 6, then you will not be able to go to the latest version since it’s no longer supported. Latest version for EL6 is 13.6.6. So I don’t know which version of CentOS you have installed to provide exact instructions. Debian/Ubuntu allows me to use the repositories and upgrade to a specific version, but from what I see, that command doesn’t exist for RHEL/CentOS, so would mean you downloading manually the appropriate RPM:

if you are not using CE, then change it to gitlab-ee. Just verify this before downloading and starting your upgrade, as downgrading EE to CE can cause other issues - whilst possible, there are extra steps to take.

Easiest way is:

rpm -qa | grep -i gitlab

and you should get a list of which gitlab rpm is installed - it should have ce or ee in the name to differentiate.

But generally yes, to upgrade:

rpm -Uvh package-name.rpm

EDIT:

https://docs.gitlab.com/omnibus/update/#multi-step-upgrade-using-the-official-repositories

you can download particular versions using yum and the repos. Eg:

yum install gitlab-ee-12.0.12-ee.0.el7

of course replacing the version number with the one you need to upgrade to - check/verify this using the packages.gitlab.com link that I sent. Or just download the rpm manually, and use rpm -Uvh.

Thanks Ian

I have just now updated to 13.0.14 but to look at the background migration tasks now show in a different way
if I run

sudo -u git -H bundle exec rails RAILS_ENV=production
sudo: bundle: command not found

If using GitLab 12.9 and newer, run: Which I am now but I do not have /home/git/gitlab

cd /home/git/gitlab
sudo -u git -H bundle exec rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'

Where am i going wrong?

You are confusing source installation with omnibus:

gitlab-rails runner -e production 'puts Gitlab::BackgroundMigration.remaining'

therefore if you have used the gitlab-ce or gitlab-ee rpm packages, then you are not using a build from source and you use the above command.

1 Like

Thanks Iain.
So now I am on install 13.1.11. Do you think I can now go straight to installing version 13.8.2?
By the way I am on centos 7.6.

Don’t worry Ian I did the update to the latest and it all went through smoothly, My test server now has the latest build and I now have correct instructions how to upgrade my gitlab server from 9.0.1 to latest. Thanks alot for all your help.

2 Likes