3
2

GitLab のバージョンアップ

Posted at

はじめに

今回、 16.3.4 から 16.8.2 へアップグレードする機会があったのでその手順について書きたいと思います。

アップグレード作業

今回のアップグレードは一回では行えないため、何度かステップを踏んでの作業となります。

ステップの確認

GitLab のバージョンアップでは、一度にターゲットバージョンまで上げられない場合があることに注意が必要です。
現在のバージョンからターゲットバージョンまで上げる際のステップについては以下の公式サイトで確認できます。

今回は 16.3.4 から 16.8.2 へ アップグレード したいため、以下のように入力し [ GO ] をクリックします。

Current: 16.3.4
Target: 16.8.2
Edition: Enterprise
Distro: CentOS

gitlab-update-02.png

すると以下のように、アップグレードするためのステップが表示されます。
スクリーンショット 2024-02-09 14.12.20のコピー.png
今回はターゲットバージョンまで上げるには 16.3.7 > 16.7.5 > 16.8.2 というステップを踏む必要があるということがわかりました。
また、アップグレードを行うための手順も同時に確認できます。
それでは実際にアップグレードしていこうと思います。

1回目 ( 16.3.4 → 16.7.5 )

もし、現在のバージョンがわからない場合は以下の方法で確認しましょう。

バージョンの確認

コマンドでの確認方法です。GitLabサーバーにログインして以下のコマンドを実行してください。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.0.6p216
Gem Version:	3.4.18
Bundler Version:2.4.18
Rake Version:	13.0.6
Redis Version:	7.0.12
Sidekiq Version:6.5.7
Go Version:	unknown

GitLab information
Version:	16.3.4-ee
Revision:	f8f84c53318
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.11
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.26.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.3.4
- default Git Version: 	2.41.0.gl1

GitLab information の Version に現在のバージョンが表示されます。
16.3.4-ee となっているのが確認できます。

また、管理画面からも確認ができます。
その場合は 左ペイン下部 > ヘルプ > ヘルプ をクリックしてください。
するとメイン部分の GitLabエンタープライズエディション の横に現在のバージョンが表示されます。

gitlab-update-01.png
ここからも現在のバージョンは v16.3.4-ee というのがわかりました。

アップグレード要件の確認

また、各バージョンの数字をクリックするとアップグレードを行うための要件を確認することができます。

gitlab-update-04.jpg
gitlab-update-05.jpg

今回ポイントは赤ラインの部分です。
アップグレードを行うためには空きストレージが 12GB 必要とあります。
もし、容量が足りない場合は事前にストレージの拡張をしておきましょう。

アップグレード

それではアップグレードを行います。先ほど手順があったように yum コマンドで行います。

アップグレード
$ sudo yum install gitlab-ee-16.3.7
gitlab_gitlab-ee                                                                                                                                                    739  B/s | 1.0 kB     00:01    
gitlab_gitlab-ee-source                                                                                                                                             653  B/s | 951  B     00:01    
Dependencies resolved.
====================================================================================================================================================================================================
 Package                                    Architecture                            Version                                                 Repository                                         Size
====================================================================================================================================================================================================
Upgrading:
 gitlab-ee                                  x86_64                                  16.3.7-ee.0.amazon2023                                  gitlab_gitlab-ee                                  1.3 G

Transaction Summary
====================================================================================================================================================================================================
Upgrade  1 Package

Total download size: 1.3 G
Is this ok [y/N]: y

~~~~
Upgraded:
  gitlab-ee-16.3.7-ee.0.amazon2023.x86_64                                 

Complete!

Complete! が確認できたら完了です。

確認

アップグレードが完了したら先ほどのコマンドで確認してみます。
ただ、yumアップグレードが完了した後もしばらく GitLab 側でマイグレーション処理が続く場合があるため、その際はしばらく時間を空けてから再度確認してみてください。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.0.6p216
Gem Version:	3.4.18
Bundler Version:2.4.18
Rake Version:	13.0.6
Redis Version:	7.0.12
Sidekiq Version:6.5.7
Go Version:	unknown

GitLab information
Version:	16.3.7-ee
Revision:	4b39d8fe418
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.11
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.26.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.3.7
- default Git Version: 	2.41.0.gl1

無事にアップグレードができていることが確認できます。

管理画面からも確認してみます。
先ほどと同様に [ 左ペイン下部 ] にある [ ヘルプ ] のリストを開き [ヘルプ] をクリックします。
するとアップグレード前に確認した GitLabエンタープライズエディション のバージョンがv16.3.7-ee になっていることが確認できます。

gitlab-update-06.png

2回目 ( 16.3.7 → 16.7.5 )

同様の方法でアップグレードを行っていきます。

バージョンの確認

先ほどと同様に確認します。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.0.6p216
Gem Version:	3.4.18
Bundler Version:2.4.18
Rake Version:	13.0.6
Redis Version:	7.0.12
Sidekiq Version:6.5.7
Go Version:	unknown

GitLab information
Version:	16.3.7-ee
Revision:	4b39d8fe418
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.11
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.26.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.3.7
- default Git Version: 	2.41.0.gl1

アップグレード要件の確認

ここでは 16.7.6 のところで Ruby 3.1 が要件に入っています。

gitlab-update-07.jpg
スクリーンショット 2024-02-24 16.41.08.png

ただ、よく読むとソースからインストールしている場合は事前にバージョンを挙げておく必要がありそうですが、今回はパッケージインストールしているためアップグレードの処理の中で Ruby のバージョンも上げてくれるみたいです。

Ruby バージョンの確認

一応ですがパッケージインストールしている場合のRubyバージョンの確認方法です。

Rubyバージョン確認
$ /opt/gitlab/embedded/bin/ruby -v
ruby 3.0.6p216 (2023-03-30 revision 23a532679b) [x86_64-linux

3.0.6 というのが確認できました。

アップグレード

それでは続いてアップグレードを行います。

アップグレード
$ sudo yum install gitlab-ee-16.7.5
gitlab_gitlab-ee                                                                                                                                                    741  B/s | 1.0 kB     00:01    
gitlab_gitlab-ee-source                                                                                                                                             652  B/s | 951  B     00:01    
Dependencies resolved.
====================================================================================================================================================================================================
 Package                                    Architecture                            Version                                                 Repository                                         Size
====================================================================================================================================================================================================
Upgrading:
 gitlab-ee                                  x86_64                                  16.7.5-ee.0.amazon2023                                  gitlab_gitlab-ee                                  1.1 G

Transaction Summary
====================================================================================================================================================================================================
Upgrade  1 Package

Total download size: 1.1 G
Is this ok [y/N]: y

~~~
Upgraded:
  gitlab-ee-16.7.5-ee.0.amazon2023.x86_64

Complete!

完了しました。

確認

それでは確認します。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.1.4p223
Gem Version:	3.4.22
Bundler Version:2.4.22
Rake Version:	13.0.6
Redis Version:	7.0.15
Sidekiq Version:6.5.12
Go Version:	unknown

GitLab information
Version:	16.7.5-ee
Revision:	7f8d8e1af0b
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.13
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.32.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.7.5
- default Git Version: 	2.42.0

スクリーンショット 2024-02-13 10.14.19.png

アップグレードの確認ができました。

Ruby バージョンの確認

Rubyのバージョンも確認してみます。

Rubyバージョン確認
$ /opt/gitlab/embedded/bin/ruby -v
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]

こちらもバージョンアップしているのが確認できました。

3回目 (16.7.5 → 16.8.2 )

最後のアップグレード作業です。

バージョンの確認

現在のバージョンを確認します。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.1.4p223
Gem Version:	3.4.22
Bundler Version:2.4.22
Rake Version:	13.0.6
Redis Version:	7.0.15
Sidekiq Version:6.5.12
Go Version:	unknown

GitLab information
Version:	16.7.5-ee
Revision:	7f8d8e1af0b
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.13
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.32.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.7.5
- default Git Version: 	2.42.0

アップグレード要件の確認

今回は特になかったため割愛します。

アップグレード

全ステップと同じくアップグレードを行います。

アップグレード
$ sudo yum install gitlab-ee-16.8.2
gitlab_gitlab-ee                                                                                                                                                    727  B/s | 1.0 kB     00:01    
gitlab_gitlab-ee-source                                                                                                                                             656  B/s | 951  B     00:01    
Dependencies resolved.
====================================================================================================================================================================================================
 Package                                    Architecture                            Version                                                 Repository                                         Size
====================================================================================================================================================================================================
Upgrading:
 gitlab-ee                                  x86_64                                  16.8.2-ee.0.amazon2023                                  gitlab_gitlab-ee                                  1.1 G

Transaction Summary
====================================================================================================================================================================================================
Upgrade  1 Package

Total download size: 1.1 G
Is this ok [y/N]: y

~~~
Upgraded:
  gitlab-ee-16.8.2-ee.0.amazon2023.x86_64

Complete!

完了しました。

確認

確認を行います。

バージョン確認
$ sudo gitlab-rake gitlab:env:info

System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	3.1.4p223
Gem Version:	3.4.22
Bundler Version:2.5.4
Rake Version:	13.0.6
Redis Version:	7.0.15
Sidekiq Version:7.1.6
Go Version:	unknown

GitLab information
Version:	16.8.2-ee
Revision:	e3c23d67e9c
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	13.13
URL:		https://sample.hengjiu.jp
HTTP Clone URL:	https://sample.hengjiu.jp/some-group/some-project.git
SSH Clone URL:	git@sample.hengjiu.jp:some-group/some-project.git
Elasticsearch:	no
Geo:		no
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	14.33.0
Repository storages:
- default: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell

Gitaly
- default Address: 	unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 	16.8.2
- default Git Version: 	2.42.0

スクリーンショット 2024-02-13 10.39.53.png

以上でターゲットバージョンへのアップグレードが無事完了しました。

おわりに

GitLab は頻繁に新バージョンがリリースされます。
一回のアップグレードならそこまで中断も事前確認もかからなそうなので、定期的に行うようにした方が良いなと感じました。

その他の GitLab に関する投稿

GitLab に関する記事は他にも投稿しているのでよければ読んでもらえたら嬉しいです。

参考

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2