2021-09-03 14:10:36 -04:00
---
2022-05-29 20:08:35 -04:00
stage: Systems
2021-09-03 14:10:36 -04:00
group: Distribution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
2021-10-10 23:11:46 -04:00
# Create a GitLab upgrade plan **(FREE SELF)**
2021-09-03 14:10:36 -04:00
This document serves as a guide to create a strong plan to upgrade a self-managed
GitLab instance.
General notes:
- If possible, we recommend you test out the upgrade in a test environment before
updating your production instance. Ideally, your test environment should mimic
your production environment as closely as possible.
2022-08-09 20:09:11 -04:00
- If [working with Support ](https://about.gitlab.com/support/scheduling-upgrade-assistance/ )
2021-09-03 14:10:36 -04:00
to create your plan, share details of your architecture, including:
- How is GitLab installed?
- What is the operating system of the node?
2021-11-18 10:10:19 -05:00
(check [OS versions that are no longer supported ](../administration/package_information/supported_os.md#os-versions-that-are-no-longer-supported ) to confirm that later updates are available).
2021-09-03 14:10:36 -04:00
- Is it a single-node or a multi-node setup? If multi-node, share any architectural details about each node with us.
- Are you using [GitLab Geo ](../administration/geo/index.md )? If so, share any architectural details about each secondary node.
- What else might be unique or interesting in your setup that might be important for us to understand?
- Are you running into any known issues with your current version of GitLab?
## Pre-upgrade and post-upgrade checks
Immediately before and after the upgrade, perform the pre-upgrade and post-upgrade checks
to ensure the major components of GitLab are working:
1. [Check the general configuration ](../administration/raketasks/maintenance.md#check-gitlab-configuration ):
```shell
sudo gitlab-rake gitlab:check
```
2022-01-05 07:16:26 -05:00
1. Confirm that encrypted database values [can be decrypted ](../administration/raketasks/check.md#verify-database-values-can-be-decrypted-using-the-current-secrets ):
2021-09-03 14:10:36 -04:00
```shell
sudo gitlab-rake gitlab:doctor:secrets
```
1. In GitLab UI, check that:
- Users can log in.
- The project list is visible.
- Project issues and merge requests are accessible.
- Users can clone repositories from GitLab.
- Users can push commits to GitLab.
1. For GitLab CI/CD, check that:
- Runners pick up jobs.
- Docker images can be pushed and pulled from the registry.
1. If using Geo, run the relevant checks on the primary and each secondary:
```shell
sudo gitlab-rake gitlab:geo:check
```
1. If using Elasticsearch, verify that searches are successful.
2022-01-05 10:13:51 -05:00
1. If you are using [Reply by Email ](../administration/reply_by_email.md ) or [Service Desk ](../user/project/service_desk.md ),
manually install the latest version of `gitlab-mail_room` :
```shell
gem install gitlab-mail_room
```
NOTE: This step is necessary to avoid thread deadlocks and to support the latest MailRoom features. See
[this explanation ](../development/emails.md#mailroom-gem-updates ) for more details.
2021-09-03 14:10:36 -04:00
If in any case something goes wrong, see [how to troubleshoot ](#troubleshooting ).
## Rollback plan
It's possible that something may go wrong during an upgrade, so it's critical
that a rollback plan be present for that scenario. A proper rollback plan
creates a clear path to bring the instance back to its last working state. It is
comprised of a way to back up the instance and a way to restore it.
### Back up GitLab
2021-12-06 13:14:09 -05:00
Create a backup of GitLab and all its data (database, repositories, uploads, builds,
2021-09-03 14:10:36 -04:00
artifacts, LFS objects, registry, pages). This is vital for making it possible
to roll back GitLab to a working state if there's a problem with the upgrade:
2021-09-28 14:11:27 -04:00
- Create a [GitLab backup ](../raketasks/backup_restore.md ).
2021-09-03 14:10:36 -04:00
Make sure to follow the instructions based on your installation method.
2022-07-01 11:08:30 -04:00
Don't forget to back up the [secrets and configuration files ](../raketasks/backup_gitlab.md#storing-configuration-files ).
2021-09-03 14:10:36 -04:00
- Alternatively, create a snapshot of your instance. If this is a multi-node
installation, you must snapshot every node.
**This process is out of scope for GitLab Support.**
### Restore GitLab
2022-03-15 08:07:44 -04:00
If you have a test environment that mimics your production one, we recommend testing the restoration to ensure that everything works as you expect.
2021-09-03 14:10:36 -04:00
To restore your GitLab backup:
- Before restoring, make sure to read about the
[prerequisites ](../raketasks/backup_restore.md#restore-gitlab ), most importantly,
2021-09-16 08:09:35 -04:00
the versions of the backed up and the new GitLab instance must be the same.
2021-09-03 14:10:36 -04:00
- [Restore GitLab ](../raketasks/backup_restore.md#restore-gitlab ).
Make sure to follow the instructions based on your installation method.
2022-07-01 11:08:30 -04:00
Confirm that the [secrets and configuration files ](../raketasks/backup_gitlab.md#storing-configuration-files ) are also restored.
2021-09-03 14:10:36 -04:00
- If restoring from a snapshot, know the steps to do this.
**This process is out of scope for GitLab Support.**
## Upgrade plan
For the upgrade plan, start by creating an outline of a plan that best applies
to your instance and then upgrade it for any relevant features you're using.
- Generate an upgrade plan by reading and understanding the relevant documentation:
- upgrade based on the installation method:
- [Linux package (Omnibus) ](index.md#linux-packages-omnibus-gitlab )
- [Compiled from source ](index.md#installation-from-source )
- [Docker ](index.md#installation-using-docker )
- [Helm Charts ](index.md#installation-using-helm )
2021-09-15 14:11:29 -04:00
- [Zero-downtime upgrades ](zero_downtime.md ) (if possible and desired)
- [Convert from GitLab Community Edition to Enterprise Edition ](package/convert_to_ee.md )
2021-09-03 14:10:36 -04:00
- What version should you upgrade to:
- [Determine what upgrade path ](index.md#upgrade-paths ) to follow.
- Account for any [version-specific update instructions ](index.md#version-specific-upgrading-instructions ).
2021-09-15 14:11:29 -04:00
- Account for any [version-specific changes ](package/index.md#version-specific-changes ).
2021-11-18 10:10:19 -05:00
- Check the [OS compatibility with the target GitLab version ](../administration/package_information/supported_os.md ).
2022-08-06 14:09:12 -04:00
- Due to background migrations, plan to pause before any further upgrades.
2021-09-03 14:10:36 -04:00
[All migrations must finish running ](index.md#checking-for-background-migrations-before-upgrading )
before the next upgrade.
- If available in your starting version, consider
[turning on maintenance mode ](../administration/maintenance_mode/ ) during the
upgrade.
- About PostgreSQL:
- On the top bar, select **Menu > Admin** , and look for the version of
PostgreSQL you are using.
2021-09-17 05:09:24 -04:00
If [a PostgreSQL upgrade is needed ](../administration/package_information/postgresql_versions.md ),
2021-09-03 14:10:36 -04:00
account for the relevant
[packaged ](https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server )
or [non-packaged ](https://docs.gitlab.com/omnibus/settings/database.html#upgrade-a-non-packaged-postgresql-database ) steps.
### Additional features
Apart from all the generic information above, you may have enabled some features
that require special planning.
Feel free to ignore sections about features that are inapplicable to your setup,
such as Geo, external Gitaly, or Elasticsearch.
#### External Gitaly
2021-09-15 14:11:29 -04:00
If you're using an external Gitaly server, it must be upgraded to the newer
version prior to upgrading the application server.
2021-09-03 14:10:36 -04:00
#### Geo
If you're using Geo:
2022-05-23 11:08:42 -04:00
- Review [Geo upgrade documentation ](../administration/geo/replication/upgrading_the_geo_sites.md ).
- Read about the [Geo version-specific update instructions ](../administration/geo/replication/version_specific_upgrades.md ).
- Review Geo-specific steps when [upgrading the database ](https://docs.gitlab.com/omnibus/settings/database.html#upgrading-a-geo-instance ).
- Create an upgrade and rollback plan for _each_ Geo site (primary and each secondary).
2021-09-03 14:10:36 -04:00
#### Runners
After updating GitLab, upgrade your runners to match
[your new GitLab version ](https://docs.gitlab.com/runner/#gitlab-runner-versions ).
2022-07-21 20:10:57 -04:00
#### GitLab agent for Kubernetes
If you have Kubernetes clusters connected with GitLab, [upgrade your GitLab agents for Kubernetes ](../user/clusters/agent/install/index.md#update-the-agent-version ) to match your new GitLab version.
2021-09-03 14:10:36 -04:00
#### Elasticsearch
After updating GitLab, you may have to upgrade
2022-06-14 14:09:25 -04:00
[Elasticsearch if the new version breaks compatibility ](../integration/advanced_search/elasticsearch.md#version-requirements ).
2021-09-03 14:10:36 -04:00
Updating Elasticsearch is **out of scope for GitLab Support** .
## Troubleshooting
If anything doesn't go as planned:
- If time is of the essence, copy any errors and gather any logs to later analyze,
and then [roll back to the last working version ](#rollback-plan ). You can use
the following tools to help you gather data:
- [`gitlabsos` ](https://gitlab.com/gitlab-com/support/toolbox/gitlabsos ) if
you installed GitLab using the Linux package or Docker.
- [`kubesos` ](https://gitlab.com/gitlab-com/support/toolbox/kubesos/ ) if
you installed GitLab using the Helm Charts.
- For support:
2022-08-08 17:09:31 -04:00
- [Contact GitLab Support ](https://support.gitlab.com ) and,
2021-09-03 14:10:36 -04:00
if you have one, your Technical Account Manager.
- If [the situation qualifies ](https://about.gitlab.com/support/#definitions-of-support-impact )
and [your plan includes emergency support ](https://about.gitlab.com/support/#priority-support ),
create an emergency ticket.