How to do a Gitlab Major version upgrade
Easy way to upgrade to a newer version.
- Sebastiaan
- 2 min read
Upgrade Path
You can check the upgrade path on the following site: https://gitlab-com.gitlab.io/support/toolbox/upgrade-path/. This website is made by Gitlab, and will give a good overview about changes and new features for the upgrades you selected.
Checks
https://docs.gitlab.com/ee/update/index.html#checking-for-background-migrations-before-upgrading Check pending and failed DB migrations.
gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigration::BatchedMigration.queued.count'
gitlab-rails runner -e production 'puts Gitlab::Database::BackgroundMigration::BatchedMigration.with_status(:failed).count'
OPTIONAL: Check pending elasticsearch migrations
gitlab-rake gitlab:elastic:list_pending_migrations
Update check
gitlab-rake gitlab:check SANITIZE=true
Pre-upgrade
Create a snapshot on the environment you are hosting your gitlab environment.
Set instance in maintenance mode:
gitlab-rails runner '::Gitlab::CurrentSettings.update!(maintenance_mode: true)'
Create a gitlab backup of latest version! https://docs.gitlab.com/ee/administration/backup_restore/ Make sure gitlab has the rights to read and write with the backup.
Disable advanced search before upgrading to a new major version. This is because of the index changes that are possible coming with new version. Checkout my reindex guide on gitlab advanced search to re-enable it.
Before the upgrade is started we need to stop subprocess puma and sidekiq on the gitlab server
gitlab-ctl stop sidekiq && gitlab-ctl stop puma
We can check with following command if the services are really stopped.
gitlab-ctl status
The Upgrade
https://docs.gitlab.com/ee/update/package/index.html Upgrading to a specific version:
gitlab-ee-<gitlab_version>-ee.0.el<distribution_version>
Upgrade to latest version:
yum install gitlab-ee
Reconfigure and restart gitlab instance:
gitlab-ctl reconfigure
gitlab-ctl restart
Turn maintenance mode off:
gitlab-rails runner '::Gitlab::CurrentSettings.update!(maintenance_mode: false)'
Enjoy newer version
Login on UI, to checkout the UI and the new features.