Menu

메모용 개발 블로그

전체보기 > GitLab >

Gitlab 14에서 15로 업데이트

2022-07-27 01:58:14

1. 서론

깃랩을 한동안 업데이트 안하다가 보니 어느새 14에서 15로 버전이 올라가있었다.

예전에도 오래안하다가 업데이트하다가 이런저런 이슈에 시달렸는데.

다시 그러한 상황이 닥치게되었다.

글을 작성하면서 발생한 오류 사항에 대해서는 글 하단에 별도 포스트에 링크를 걸어놓았습니다.

2. 환경

Gitlab 버전 : Gitlab CE 14.8.2 (Omnibus)

OS : Ubuntu 18.04.5 LTS

이 글에서는 여러가지 Gitlab 설치방법 중 Omnibus 방식으로 사용하는 버전을 다룹니다.

3. 순차 업그레이드

깃랩은 특정 버전대별로 업데이트를 순차적으로 거쳐가야한다. 단번에 13->15로 업데이트 할 수는 없고 중간중간에 거쳐야하는 버전들을 반드시 거쳐야하는 문제가 있다.

https://docs.gitlab.com/ee/update/index.html#upgrade-paths

위 링크를 들어가게 되면 거쳐야하는 버전을 확인할 수 있다.

이 글에서는 현재 버전이 14.8.2이므로 다음 순서대로 업데이트를 진행하여야 한다.

14.9.5 -> 14.10.Z -> 15.0.Z -> 최신버전

업데이트 방법

https://docs.gitlab.com/ee/update/package/

위 글에가면 업데이트 방법에 대해서 나와있다. 현재 환경이 우분투이므로 apt 패키지 매니저를 통한 업데이트 항목을 참고하여 진행합니다.

# apt update	

이 후 업데이트 가능한 패키지를 확인합니다.

# apt list --upgradable gitlab-ce -a

아래는 실행 결과의 일부입니다.

Listing... Done
gitlab-ce/bionic 15.2.0-ce.0 amd64 [upgradable from: 14.8.2-ce.0]
gitlab-ce/bionic 15.1.3-ce.0 amd64
gitlab-ce/bionic 15.1.2-ce.0 amd64
gitlab-ce/bionic 15.1.1-ce.0 amd64
gitlab-ce/bionic 15.1.0-ce.0 amd64
gitlab-ce/bionic 15.0.4-ce.0 amd64
gitlab-ce/bionic 15.0.3-ce.0 amd64
gitlab-ce/bionic 15.0.2-ce.0 amd64
gitlab-ce/bionic 15.0.1-ce.0 amd64
gitlab-ce/bionic 15.0.0-ce.0 amd64
gitlab-ce/bionic 14.10.5-ce.0 amd64
gitlab-ce/bionic 14.10.4-ce.0 amd64
gitlab-ce/bionic 14.10.3-ce.0 amd64
gitlab-ce/bionic 14.10.2-ce.0 amd64
gitlab-ce/bionic 14.10.1-ce.0 amd64
gitlab-ce/bionic 14.10.0-ce.0 amd64
gitlab-ce/bionic 14.9.5-ce.0 amd64
gitlab-ce/bionic 14.9.4-ce.0 amd64
gitlab-ce/bionic 14.9.3-ce.0 amd64
gitlab-ce/bionic 14.9.2-ce.0 amd64
gitlab-ce/bionic 14.9.1-ce.0 amd64
gitlab-ce/bionic 14.9.0-ce.0 amd64
gitlab-ce/bionic 14.8.6-ce.0 amd64
gitlab-ce/bionic 14.8.5-ce.0 amd64
gitlab-ce/bionic 14.8.4-ce.0 amd64
gitlab-ce/bionic 14.8.3-ce.0 amd64
gitlab-ce/bionic,now 14.8.2-ce.0 amd64 [installed,upgradable to: 15.2.0-ce.0]
gitlab-ce/bionic 14.8.1-ce.0 amd64
gitlab-ce/bionic 14.8.0-ce.0 amd64
gitlab-ce/bionic 14.7.7-ce.0 amd64
gitlab-ce/bionic 14.7.6-ce.0 amd64
gitlab-ce/bionic 14.7.5-ce.0 amd64
gitlab-ce/bionic 14.7.4-ce.0 amd64
gitlab-ce/bionic 14.7.3-ce.0 amd64
gitlab-ce/bionic 14.7.2-ce.0 amd64
gitlab-ce/bionic 14.7.1-ce.0 amd64
gitlab-ce/bionic 14.7.0-ce.0 amd64
gitlab-ce/bionic 14.6.7-ce.0 amd64
...

현재 설치된 버전은 14.8.2-ce.0인 것으로 나와있으며 15.2.0-ce.0 까지 업데이트 가능하다고 나와있으나 앞서 언급한대로 순차적으로 업그레이드를 진행하여야 합니다.

주의하세요

어떤 업데이트 작업을 수행하던 간에 백업은 필수사항이며, gitlab은 업데이트 과정 중에 기존 버전을 백업하는 과정을 수행합니다. 혹여나 해당 과정을 스킵하도록 설정(/etc/gitlab 하단의 스킵 파일을 생성)하지 않았는지 확인 후 진행하시기 바랍니다.

현재 1차 목표 버전은 14.9.5이므로 다음과 같은 명령어로 업데이트를 실행합니다.

# apt install gitlab-ce=14.9.5-ce.0

에러없이 실행되었다면 다음과 같은 출력으로 마칩니다.

     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/


Upgrade complete! If your GitLab server is misbehaving try running
  sudo gitlab-ctl restart
before anything else.
If you need to roll back to the previous version you can use the database
backup made during the upgrade (scroll up for the filename).

다음 명령어로 gitlab을 재시작하여 정상 동작하는지 확인합니다.

# gitlab-ctl restart 
➜  backup sudo gitlab-ctl restart
ok: run: alertmanager: (pid 23788) 0s
ok: run: gitaly: (pid 23799) 0s
ok: run: gitlab-exporter: (pid 23814) 0s
ok: run: gitlab-kas: (pid 23816) 1s
ok: run: gitlab-workhorse: (pid 23828) 0s
ok: run: grafana: (pid 23837) 1s
ok: run: logrotate: (pid 23851) 0s
ok: run: node-exporter: (pid 23857) 0s
ok: run: postgres-exporter: (pid 23865) 1s
ok: run: postgresql: (pid 23874) 0s
ok: run: prometheus: (pid 23876) 1s
ok: run: puma: (pid 23895) 0s
ok: run: redis: (pid 23900) 1s
ok: run: redis-exporter: (pid 23906) 0s
ok: run: registry: (pid 23915) 0s
ok: run: sidekiq: (pid 23926) 0s

재시작 이후 다음 화면으로 502가 뜨는 경우 일정시간 기다려야 할 수도 있습니다.

image-20220727004100819

버전을 확인합니다.

image-20220727004350895

잘 설치되었습니다.

이후로는 이 행동을 거쳐가야하는 버전만큼 반복합니다(...)

sudo apt install gitlab-ce=14.9.5-ce.0
sudo gitlab-ctl restart
sudo apt install gitlab-ce=14.10.5-ce.0
sudo gitlab-ctl restart
sudo apt install gitlab-ce=15.0.0-ce.0
sudo gitlab-ctl restart
sudo apt install gitlab-ce
sudo gitlab-ctl restart

...

그러면 비로소 업데이트가 끝납니다.

image-20220727013056993

발생한 에러와 해결