doc/update/plan_your_upgrade.md
{{< details >}}
{{< /details >}}
Before you upgrade a GitLab instance, you must:
When planning the upgrade:
With all pre-upgrade information gathered, you can move on to performing pre-upgrade steps.
Something might go wrong during an upgrade, so it's critical that you have a rollback plan. A proper rollback plan creates a clear path to bring a GitLab instance back to its last working state and comprises:
You should test the rollback plan before you need it. For an overview of the steps required for rolling back, see roll back to earlier GitLab versions.
To make it possible to roll back GitLab if there's a problem with the upgrade, either:
If you have a test environment that mimics production, test the restoration to ensure that everything works as you expect.
To restore your GitLab backup:
If restoring from a snapshot, you must already know how to do this. This process is out of scope for GitLab Support.
Shortly before you perform the upgrade:
Immediately before and after the upgrade, run upgrade health checks to ensure the major components of GitLab are working:
Check the general configuration:
sudo gitlab-rake gitlab:check
Check the status of all background database migrations. All migrations must finish running before each upgrade. You must spread out upgrades between major and minor releases to allow time for background migrations to finish.
Confirm that encrypted database values can be decrypted:
sudo gitlab-rake gitlab:doctor:secrets
In the GitLab UI, check that:
For GitLab CI/CD, check that:
If using Geo, run the relevant checks on the primary site and each secondary site:
sudo gitlab-rake gitlab:geo:check
If using Elasticsearch, verify that searches are successful.
If something goes wrong, get support.
Depending on how your GitLab instance is configured, you might be required to perform these additional steps before upgrading GitLab:
If using external Gitaly servers, upgrade the Gitaly servers to the newer version before upgrading GitLab itself. This prevents the gRPC client on the application server from sending RPCs that the old Gitaly version does not support.
If you have Kubernetes clusters connected with GitLab, upgrade your GitLab agents for Kubernetes to match your new GitLab version.
If you use advanced search (Elasticsearch), confirm advanced search migrations are complete by checking for pending migrations.
After upgrading GitLab, you might have to upgrade Elasticsearch if the new version breaks compatibility. Updating Elasticsearch is out of scope for GitLab Support.
During upgrades for most types of GitLab instances, you should pause CI/CD pipelines and jobs.
If you upgrade your GitLab instance while GitLab Runner is processing jobs, the trace updates fail. When GitLab is back online, the trace updates should self-heal. If a trace update does not self-heal, depending on the error, GitLab Runner either retries or terminates job handling.
GitLab Runner attempts to upload job artifacts three times, after which the job fails.
To pause CI/CD pipelines and jobs:
Pause the runners.
Block new jobs from starting by adding the following to your /etc/gitlab/gitlab.rb file:
nginx['custom_gitlab_server_config'] = "location = /api/v4/jobs/request {\n deny all;\n return 503;\n}\n"
Reconfigure GitLab:
sudo gitlab-ctl reconfigure
Wait until all jobs are finished.
When you've completed your GitLab upgrade:
/etc/gitlab/gitlab.rb change.If you are working with Support to review your upgrade plan, document and share it with the answers to the following questions:
If something goes wrong during your upgrade:
For support: