Upgrade gitlab version from 9.0.1 to 13.8

Hi,

I have been following this doc:

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.

1 Like

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.

2 Likes

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.

1 Like

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

@iwalker Hi, I am also stuck in one such task of upgradation at the moment.
I am dealing with the Gitlab version 9.3.2 and my orgnization wants it to upgrade to the verry latest version no matter step by step.

The problem I am facing here is I am unable to see any matching upgradation path which includes 9.3.2 version. In this case, I wanted to know how to upgrade to further versions by maintaing the database backup. Is it possible to switch to the nearest next version in the path if the current version is not suitable or is there any other way?

Looking forward to hearing from you and other community members.

Much help is appreciated.
Thanks in advance!

See here: Upgrading GitLab | GitLab

as you can see, 9.3.2 is between 8.17.7 and 9.5.10. So upgrade to 9.5.10, then 10.8.7, then 11.11.8 and so on as per the upgrade path.

As a general rule, if your version falls between two versions like this, then that is how you more or less work it out.

Providing you follow the Gitlab upgrade documentation and make sure background migrations are finished before continuing the next upgrade, you shouldn’t have any problems. All the info you need is in the docs.

1 Like

@iwalker Hello, thank you for your kind reply.

I get the method that you are mentioning. However, the blockage here for us is I am not able to find the relevant steps for our current version i.e. 9.3.2. The upgradation docs are having very latest versions of docs only.

So, I am not sure how to upgrade to the nearest version.

Also, in our organization, we use GItlab as a whole platform where terabytes of database is stored like movies, animation models, VFX,etc. And we haven’t done any upgradation from the start. So, how to cope up with such upgradation in which it is providing as PaaS to our organization and not as a software installation.

Also, it would be great if you can throw some more light on “background migrations”. All relevant links would be helpful.

Thank you in advance.

On the link I sent you, there is the information explaining about the background migrations, you only needed to scroll up to find it: Upgrading GitLab | GitLab that is linked to the particular section in question directly. They are also linked already in this post as well (the second post in this thread).

Also the last link I provided also has the information to the documentation explaining how to upgrade. I will also link that directly since you didn’t read the page properly that I sent: Upgrading GitLab | GitLab

if you are using the omnibus version, meaning that you installed the gitlab-ce or gitlab-ee version then click the appropriate link. Assuming the omnibus version, then this link: Upgrade GitLab by using the GitLab package | GitLab specifically point 2 from that link tells you the command to use to upgrade to the next version. You don’t mention which Linux distribution you are using, so you need to choose the appropriate command from that list. Assuming Ubuntu or Debian with gitlab-ce, then here is an example below:

apt-get install gitlab-ce=9.5.10-ce.0

obviously if using gitlab-ee, then change the above command appropriately. To get the format for the number to provide to the above command, you can get from the packages page here:

this one is already filtered for version 9.5.0. So you just repeat the search based on the upgrade path that I provided above in my previous post, and continue doing this for every single version in the upgrade path. The first command is done for you as above, assuming you use Ubuntu/Debian. If not, go to the packages link above, and search for the version for RHEL or whichever rpm distro you are using if not deb one. Then when you click and open the link to the package, on the top right of the screen under the big blue box you will see the apt or yum/dnf/rpm command required to install the package and start the upgrade process for the version you need to do. Below a screenshot to make it easier:

as you can see under the blue box on the right is the apt command that I gave you above for the 9.5.10 upgrade command.

If you are using gitlab-ce, then replace gitlab-ee with gitlab-ce from the instructions.

1 Like