Lazy upgrade GitLab
Upgrading or installing GitLab can be a very simple or very complicated endeavor, depending on how you perform it and what are your requirements.
In my setup, I had GitLab version 12.6.3-ee.0 installed using Omnibus on an Ubuntu 18.04. At the moment, the latest version of GitLab is 13.3, but I chose to upgrade to the latest version of 13.2.x, as I considered it more stable. I will upgrade to 13.3.x when 13.4.x appears. [UPDATE] I have bumped the version to 13.5.4.
These are the raw information I used when choosing the upgrade path:
https://docs.gitlab.com/omnibus/update/gitlab_12_changes.html
https://docs.gitlab.com/omnibus/update/gitlab_13_changes.html
I chose to perform the upgrade in multiple stages, 7 to be more exact: 12.6.3 -> 12.6.8 -> 12.7.9 -> 12.8.10 -> 12.9.10 -> 12.10.14 -> 13.0.14 ->13.2.9 ->13.5.4
I have chosen the path as I wanted to perform upgrades between minor version to minor version. In addition, upgrade 12.6.3 -> 12.6.8 was added for a safer max to max minor version upgrade.
Besides the apt upgrade, two manual interventions were required:
* update unicorn settings when upgrading from 12.6.3-ee.0 to 12.6.8-ee.0 * upgrade postgres version to v11 after installing GitLab version 12.8.10-ee.0
The following script should not be run automatically, as things can go wrong between every upgrade. Perform functional tests between every upgrade to make sure GitLab works as expected.
The commands should be run with administrative privileges (sudo).
#!/bin/bash # perform an apt update apt update # check the installed gitlab version dpkg --list | grep -i gitlab # check the available gitlab versions apt-cache policy gitlab-ee # get gitlab env information gitlab-rake gitlab:env:info # after every upgrade run the reconfigure / restart # to make sure nothing is broken before the next upgrade function check_restart_gitlab { gitlab-ctl reconfigure gitlab-ctl restart } # perform upgrade from 12.6.3-ee.0 to 12.6.8-ee.0 apt install gitlab-ee=12.6.8-ee.0 check_restart_gitlab # manual step # set in gitlab.rc: # # unicorn['worker_memory_limit_min'] = "1024 * 1 << 20" # unicorn['worker_memory_limit_max'] = "1280 * 1 << 20" check_restart_gitlab # perform upgrade from 12.6.8-ee.0 to 12.7.9-ee.0 apt install gitlab-ee=12.7.9-ee.0 check_restart_gitlab apt install gitlab-ee=12.8.10-ee.0 # perform upgrade from 12.7.9-ee.0 to 12.8.10-ee.0 apt install gitlab-ee=12.8.10-ee.0 check_restart_gitlab # upgrade postgres to version 11 # https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server gitlab-ctl pg-upgrade gitlab-ctl pg-upgrade -V 11 check_restart_gitlab # perform upgrade from 12.8.10-ee.0 to 12.9.10-ee.0 apt install gitlab-ee=12.9.10-ee.0 check_restart_gitlab # perform upgrade from 12.9.10-ee.0 to 12.10.14-ee.0 apt install gitlab-ee=12.10.14-ee.0 check_restart_gitlab # perform upgrade from 12.10.14-ee.0 to 13.0.14-ee.0 apt install gitlab-ee=13.0.14-ee.0 check_restart_gitlab # perform upgrade from 13.0.14-ee.0 to 13.2.9-ee.0 apt install gitlab-ee=13.2.9-ee.0 check_restart_gitlab # perform upgrade from 13.2.9-ee.0 to 13.5.4-ee.0 apt install gitlab-ee=13.5.4-ee.0 # manual step if you have an NGINX proxy # change upstream from # /var/opt/gitlab/gitlab-workhorse/socket to /var/opt/gitlab/gitlab-workhorse/sockets/socket. # service nginx restart check_restart_gitlab