Gitlab community version upgrade from 11.8.0 to 16.7.0
Note: You can't upgrade gitlab-ce version directly from old to new as there is some database migrations in between the minor releases.
First upgrade the latest minor version of current majot version. i.e. 11.11.0
Please follow the steps below:
1. 11.8.0 -> 11.11.0
Download link:
https://packages.gitlab.com/gitlab/gitlab-ce/packages/debian/bookworm/gitlab-ce_11.11.0-ce.0_amd64.deb
2. 11.11.0 -> 12.0.0
3. 12.0.0 -> 12.10.14
4. 13.0.0 -> 13.12.15
5. 14.0.0 -> 14.1.1 -> 14.5.4 -> 14.9.5 -> 14.10.5
14.0.0 Installation:
If Error:
To skip legacy storage data migration,
gitlab preinstall: Checking for unmigrated data on legacy storage
gitlab preinstall:
gitlab preinstall: Legacy storage is no longer supported. Please migrate your data to hashed storage.
gitlab preinstall: Check https://docs.gitlab.com/ee/administration/raketasks/storage.html#migrate-to-hashed-storage for details.
gitlab preinstall:
gitlab preinstall: If you want to skip this check, run the following command and try again:
gitlab preinstall:
gitlab preinstall: sudo touch /etc/gitlab/skip-unmigrated-data-check
gitlab preinstall:
dpkg: error processing archive gitlab-ce_14.0.0-ce.0_amd64.deb (--install):
Solution:
root@Gitlab-11-8:~# gitlab-rails dbconsole
psql (12.6)
Type "help" for help.
gitlabhq_production=> UPDATE projects SET runners_token = null, runners_token_encrypted = null;
UPDATE 41
gitlabhq_production=> UPDATE namespaces SET runners_token = null, runners_token_encrypted = null;
UPDATE 11
gitlabhq_production=> UPDATE application_settings SET runners_registration_token_encrypted = null;
UPDATE 1
gitlabhq_production=> UPDATE ci_runners SET token = null, token_encrypted = null;
UPDATE 0
gitlabhq_production=> exit
root@Gitlab-11-8:~# gitlab-rake gitlab:storage:migrate_to_hashed
And try to install it again.
Then install 14.1.1, 14.5.4.
If Error while migrating database then try below commands,
$ sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,events,id,'[["id"]\, ["id_convert_to_bigint"]]']
$ sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id,'[["id"]\, ["id_convert_to_bigint"]]']
$ gitlab-ctl reconfigure
Then install 14.9.5, 14.10.5.
If got below error and you stuck up on gitlab-ctl reconfigure then,
rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Command execution failed. STDOUT/STDERR suppressed for sensitive resource
Solution:
sudo gitlab-ctl restart postgresql
Change in below file to skip migration,
nano /etc/gitlab/gitlab.rb
gitlab_rails['auto_migrate'] = false
Run below command,
$ gitlab-ctl reconfigure
Once reverted to old version, revert the changes in gitlab.rb and then resolve the errors and try to upgrade it again.
6. 14.10.5 -> 15.0.5 -> 15.1.6 -> 15.11.13
7. 16.0.8 -> 16.1.5 -> 16.2.8 -> 16.3.6 -> 16.7.0
Done.