GitLab のアップデートに失敗する(CentOS)


yum update で gitlab を更新したらエラーが出て更新できませんでした。

gitlab preinstall: Automatically backing up only the GitLab SQL database (excluding everything else!)
Dumping database ...
Dumping PostgreSQL database gitlabhq_production ... pg_dump: [archiver (db)] connection to database "gitlabhq_production" failed: could not connect to server: そのようなファイ ルやディレクトリはありません
 Is the server running locally and accepting
 connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.15432"?
Backup failed
[FAILED]
gitlab preinstall:
gitlab preinstall: Backup failed! If you want to skip this backup, run the following command and
gitlab preinstall: try again:
gitlab preinstall:
gitlab preinstall: sudo touch /etc/gitlab/skip-auto-migrations
gitlab preinstall:
エラー: %pre(gitlab-ce-8.16.3-ce.0.el6.x86_64) scriptlet failed, exit status 1
Error in PREIN scriptlet in rpm package gitlab-ce-8.16.3-ce.0.el6.x86_64
エラー: install: スクリプト %pre の実行に失敗しました (2)。gitlab-ce-8.16.3-ce.0.el6 をスキップします。
 Verifying : gitlab-ce-8.16.3-ce.0.el6.x86_64 1/2
gitlab-ce-8.14.3-ce.0.el6.x86_64 was supposed to be removed but is not!
 Verifying : gitlab-ce-8.14.3-ce.0.el6.x86_64 2/2

失敗:
 gitlab-ce.x86_64 0:8.14.3-ce.0.el6 gitlab-ce.x86_64 0:8.16.3-ce.0.el6

完了しました!

詳細は調べられていませんが、データ壊れても問題ないかなという場所だったので、以下の方法で解決させました。

DB のアップデートでこけているようです。/etc/gitlab/skip-auto-migrations ファイルを置いておけば、その処理がスキップされるようです。

sudo touch /etc/gitlab/skip-auto-migrations
sudo gitlab-ctl stop
sudo yum update
sudo rm /etc/gitlab/skip-auto-migrations
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start

アップデート後、502 になったので、 reconfigure も実行したらうまくいきました。その後は問題なく動いています。

追記

8.17.7 から 9.5.10 にあげる際、再び同様のエラーになったので試したところ 500 エラーが発生しました。以下の記事と同じ状況でしたので、同じようにコマンドを叩いたところ、無事表示されました。
Undefined method `unique_ips_limit_enabled’ after update to 9.0

gitlab-rake db:migrate

追記2

バージョン12以降は、現在のメジャーバージョンの最新に上げてから次のメジャーバージョンの 12.0.x をいれ、さらにメジャーバージョンの最新 12.10.x を入れてから 13.0.x を入れ・・・という作業が必要になりました。