interprism's blog

インタープリズム株式会社の開発者ブログです。

Gitlab 8.13 から 9.5 にアップグレードして reconfigure が失敗した時の対処

こにちわ、hiranoです。

社内で運用している Gitlab を 8.13 から 9.5 にアップグレードした際にプチハマりしたので備忘的に記録を残します。

前提

  • CentOS 6系
  • Gitlab 8.13 Omnibus版( yum install gitlab-ce で入れたやつ)

これで終わると思ってた手順

  1. gitlab-ctl stop で停止
  2. yum update gitlab-ce で更新
  3. gitlab-ctl reconfigure で設定を更新
  4. gitlab-ctl start で起動

終わるはずだったのですが、途中でハマりました。

yum update gitlab-ce が失敗

yum update gitlab-ce を実行すると最初にデータのバックアップが行われるのだが、そこでエラーが発生した。 サーバー自体のバックアップを取得していたので以下のコマンドでバックアップをスキップした。

touch /etc/gitlab/skip-auto-migrations

スキップしたところ処理は成功した。

バックアップくらい普通に終わって欲しいよ

gitlab-ctl reconfigure が失敗する

yum update gitlab-ce が完了すると以下のように表示される。

gitlab: Thank you for installing GitLab!
gitlab: To configure and start GitLab, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl reconfigure

gitlab: GitLab should be reachable at http://servername
gitlab: Otherwise configure GitLab for your system by editing /etc/gitlab/gitlab.rb file
gitlab: And running reconfigure again.
gitlab:
gitlab: For a comprehensive list of configuration options please see the Omnibus GitLab readme
gitlab: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
gitlab:

gitlab: WARNING:
gitlab: GitLab now ships with a newer version of PostgreSQL (9.6.3) by default
gitlab: We did not upgrade since /etc/gitlab/skip-automigrations exists
gitlab: To manuall upgrade, RUN THE FOLLOWING COMMAND:

sudo gitlab-ctl pg-upgrade

gitlab: In the future, we will be removing old versions of PostgreSQL from the omnibus package
gitlab: Hosts which have not upgraded to the new version will begin to fail then
gitlab: For more details, please see:
gitlab: https://docs.gitlab.com/omnibus/settings/database.html#upgrade-packaged-postgresql-server
gitlab:
  整理中                  : gitlab-ce-8.13.5-ce.0.el6.x86_64                                                        2/2
Checking PostgreSQL executables: OK
Found /etc/gitlab/skip-auto-migrations, exiting...
  Verifying               : gitlab-ce-9.5.4-ce.0.el6.x86_64                                                         1/2
  Verifying               : gitlab-ce-8.13.5-ce.0.el6.x86_64                                                        2/2

更新:
  gitlab-ce.x86_64 0:9.5.4-ce.0.el6

完了しました!
  • gitlab-ctl reconfigure を実行したところ PostgreSQL 関連でエラーが発生
  • gitlab-ctl pg-upgrade を実行(後からよくよく読んだら We did not upgrade since /etc/gitlab/skip-automigrations exists って書いてあった)
  • 再度 gitlab-ctl reconfigure を実行したところさっきのエラーは出なくなったが、以下のエラーが発生
================================================================================
Error executing action `run` on resource 'bash[migrate gitlab-rails database]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20170913-11760-12m62m5" ----
STDOUT: rake aborted!
StandardError: An error has occurred, all later migrations canceled:

No such file or directory - connect(2) for /var/opt/gitlab/redis/redis.socket
/opt/gitlab/embedded/service/gitlab-rails/db/migrate/20161124141322_migrate_process_commit_worker_jobs.rb:37:in `block in up'


中略

Running handlers:
Running handlers complete
Chef Client failed. 5 resources updated in 29 seconds

どうも Redis に接続しようとしてるが失敗している様子。

色々とググってみたが決定的な解決策が見つからず、

Redis に接続できないなら Redis を起動すればいいじゃない

ということで

$ gitlab-ctl start redis
ok: run: redis: (pid 12521) 0s

とやってから再度 gitlab-ctl reconfigure したら通った。

余談

もともと Gitlab の応答が超遅くなることがあって、とりあえずアップグレードしてみようというところから始まったんだが、アップグレードしても解決しなかった orz

原因はリポジトリに巨大なファイルが含まれてて pack ファイルにアクセスする度に iowait が発生していることだった。

これはまた機会があれば書こうと思う。

PAGE TOP