2
0

GitlLabアップグレード 16.10.0-->17.0.2-->17.1.1

Last updated at Posted at 2024-06-21

年に一度のGitLabのメジャーバージョンアップに対応した記録です

テスト環境で同じバージョンからのアップグレードの動作確認を行いましたが、PostgreSQLのバージョンはテスト環境では上がっていたようで、テスト環境がテスト環境の意味を成していませんでした。反省

前提

現在のバージョン:16.10.0
作業実施時の最新:17.0.2
追記)17.0.2には脆弱性があることがわかり、`24/07/08 再度バージョンアップ
   現在は17.1.1になっています

作業手順
  1. GitLabのページで経由するバージョンを確認
    16.10.0-->16.11.4-->17.0.2 のステップを経ることがわかった
  2. アップグレード実施
$ sudo yum install gitlab-ce-16.11.4
$ sudo gitlab-ctl reconfigure
$ sudo yum install gitlab-ce-17.0.2

「16.11.4-->17.0.2」でエラー発生

gitlab preinstall: Upgrade failed. Retry the upgrade after upgrading your PostgreSQL version.
error: %pre(gitlab-ce-17.0.2-ce.0.el7.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-17.0.2-ce.0.el7.x86_64
  検証中                  : gitlab-ce-17.0.2-ce.0.el7.x86_64                1/2 
gitlab-ce-16.11.4-ce.0.el7.x86_64 was supposed to be removed but is not!
  検証中                  : gitlab-ce-16.11.4-ce.0.el7.x86_64               2/2 

失敗:
  gitlab-ce.x86_64 0:16.11.4-ce.0.el7     gitlab-ce.x86_64 0:17.0.2-ce.0.el7    

完了しました!

  1. GitLabにログインしてPostgreSQLのバージョンを確認
ComponentsUpdate available 
GitLabv16.11.4
GitLab Shell14.35.0
GitLab Workhorsev16.11.4
GitLab APIv4
GitLab KAS16.11.4
Ruby3.1.4p223
Rails7.0.8.1
PostgreSQL (main)13.14
PostgreSQL (ci)13.14
Redis6.2.11
  1. PostgreSQLのバージョンアップ
    GitLabの説明を参考にして以下を実行
sudo gitlab-ctl pg-upgrade -V 14
(途中略)
Toggling services: OK
==== Upgrade has completed ====
Please verify everything is working and run the following if so
sudo rm -rf /var/opt/gitlab/postgresql/data.13
sudo rm -f /var/opt/gitlab/postgresql-version.old

GitLabにログインしてPostgreSQLのバージョンを確認

ComponentsUpdate available 
GitLabv16.11.4
GitLab Shell14.35.0
GitLab Workhorsev16.11.4
GitLab APIv4
GitLab KAS16.11.4
Ruby3.1.4p223
Rails7.0.8.1
PostgreSQL (main)14.11
PostgreSQL (ci)14.11
Redis6.2.11
Gitaly Servers

過去のバージョンを削除するように指示が出たが、ディレクトリサイズをduコマンドで確認し、dfコマンドで確認したディスクの空きと比較し、削除は後日とした。

  1. 再度、メジャーバージョンアップ
$ sudo yum install gitlab-ce-17.0.2
$ sudo gitlab-ctl reconfigure
(途中略)
     _______ __  __          __
    / ____(_) /_/ /   ____ _/ /_
   / / __/ / __/ /   / __ `/ __ \
  / /_/ / / /_/ /___/ /_/ / /_/ /
  \____/_/\__/_____/\__,_/_.___/
  

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-ce-17.0.2-ce.0.el7.x86_64                1/2 
  検証中                  : gitlab-ce-16.11.4-ce.0.el7.x86_64               2/2 

更新:
  gitlab-ce.x86_64 0:17.0.2-ce.0.el7                                            

完了しました!

感想

テスト環境でPostgreSQL のバージョンアップはいつ行ったのか記録はありません
以前にも同様のケースがあった記憶があります テスト環境ではPostgreSQLのバージョンアップが自動的に行われているようにも思えます なにか設定が異なってるのでしょうか
お気づきの点があればコメントいただけると助かります

上記の原因がわかりました

設定の違いがありました。具体的には/etc/gitlab/gitlab.rbの「## GitLab PostgreSQL」の部分です。

################################################################
## GitLab PostgreSQL
################################################################

###! Changing any of these settings requires a restart of postgresql.
###! By default, reconfigure reloads postgresql if it is running. If you
###! change any of these settings, be sure to run `gitlab-ctl restart postgresql`
###! after reconfigure in order for the changes to take effect.
# postgresql['enable'] = true
# postgresql['listen_address'] = nil
# postgresql['port'] = 5432
(続く)

テスト環境では

2
0
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
2
0