Updating GitLab and GitLab CI
Note This guide assumes you are using Ubuntu. If you are using Centos, or another distro, please follow the links at the various stages to the official docs.
Updating GitLab is super easy - so long as you are using one of the Omnibus editions from 7.12 onwards.
If, like me, you are using one of the older versions - 7.10.x in my case - then updating is a touch trickier, but not by much.
Do you need to update?
It's a good question. My advice would be to update a few patch releases after whenever a new minor version has been released.
What does that mean in laymans terms?
Well, GitLab follows what's called Semantic Versioning, or semver.
The official version of this is:
Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.
An easier way to understand it is:
Say we have our GitLab, and it's at version 7.10.2.
- 7 is the MAJOR version.
- 10 is the MINOR version.
- and 2 is the PATCH version.
It can be wise to wait until an updated MAJOR version has hit its first MINOR version, and likewise, wait until the MINOR version has hit its first or second PATCH release before updating.
Well, bugs inevitably slip through - so lets err on the side of caution, and wait for a more stable version to come out, before rushing to become an unexpecting beta tester ;)
> 7.12 Omnibus Edition Update
If you are using a GitLab version greater than 7.12, and you installed using the omnibus installer as advised in this video series, then Good News Everyone, updating is as simple as:
sudo apt-get update sudo apt-get install gitlab-ce
And the cool thing is, by the end of this video, if you are using an older version - that will be how simple an update is in future.
One thing I have noticed - and if you are using a rather anemic spec machine, you may too - is that restarting GitLab can take a long time, in modern computer terms.
There are a lot of services to be restarted:
- The underlying database
- Unicorn workers
If you want to know more about what each of these is actually doing, the GitLab architecture docs are a great starting point.
Updating an Older Version of GitLab
So, you have been using GitLab since the Days of Yore. Me too.
Now, thankfully, updating 7.x is nowhere near as fraught with peril as the 6.x release was.
The first thing you need to do is get your server up to date. We can do that in one command:
sudo apt-get update -y && sudo apt-get upgrade -y
That might take a few minutes, so kick it off and get yourself a brew.
Next up, you need to add the package repository to your server. I have copy and pasted the contents of the docs from GitLab, but honestly, it's best to double check this before blindly copying, as there is an admittedly the very slim chance that something could have changed between then and now:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce
GitLab CI Updates
The cool thing about using the Omnibus installer is that your GitLab CI server instance - should you have it installed - will have also been updated to the same version as your GitLab server.
And that's it. Pretty easy eh?
GitLab impresses me in many ways - from all in one installers and updaters, through to the awesomeness of the usability and collaborative functions. I am continually amazed by the quality of open source software. Long may it continue.