LoginSignup
7
9

More than 5 years have passed since last update.

GitLab7系から8系にあげるときのポイントと、Apacheだとソケットをhttpにしないとハマる話

Posted at

今回ソースからゴリゴリとインストールをしたGitLab7.2.1を8.3.2にアップデートしたので、その手順と、推奨されているNginxではなくApacheを使っててハマった部分を書く。

アップデートの概要

大きな変更点として、GitLab8系から、リポジトリ操作をするhttpリクエストはgitlab-workhorse(8.1まではgitlab-git-http-serverという名前)という別のものを利用するようになった。

GitLab 8.0 released with new looks and integrated CI! | GitLab
https://about.gitlab.com/2015/09/22/gitlab-8-0-released/

アップデートの手順はこちらにかいてある。8.0に一度上げてから8.3.2にする必要があるので、以下の2つを主に見る。

doc/update/7.14-to-8.0.md · master · GitLab.org / GitLab Community Edition · GitLab
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/7.14-to-8.0.md

doc/update/8.2-to-8.3.md · master · GitLab.org / GitLab Community Edition · GitLab
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.2-to-8.3.md

ただし、8.1から8.2の段階でgitlab-git-http-serverがgitlab-workhorseと名前が変更されているので、このアップデート手順も必ず確認する必要がある。

doc/update/8.1-to-8.2.md · master · GitLab.org / GitLab Community Edition · GitLab
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.1-to-8.2.md

ハマった

手順に従ってアップデートしたところ、Webインターフェースはほぼほぼ問題ないが、httpでgit pullとかするときに接続を拒否される。

$ git pull origin master
Unable to connect ... connection refused 503(うろ覚え)

正しい状態なら、Apacheがリバースプロキシとして127.0.0.1:8181にフォワーディングし、8181ポート待ち受けているgitlab-workhorseがレスポンスを返すはず。
だがログを見るとどうやらgitlab-workhorseが8181番ポートで待ちけていないようだ。

よく読むべきだったのは以下の部分。

If you are using Apache instead of NGINX please see the updated Apache templates. Also note that because Apache does not support upstreams behind Unix sockets you will need to let gitlab-workhorse listen on a TCP port. You can do this via /etc/default/gitlab.
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/update/8.2-to-8.3.md

Apacheだとunixソケットサポートしてないからtcpで受ける必要あって、/etc/default/gitlabで治す必要あるよーとのこと。

起動スクリプト/etc/init.d/gitlab(手順に従うとただコピーするだけ)のオプションに高書いてある。

...(省略)...
gitlab_workhorse_options="-listenUmask 0 -listenNetwork unix -listenAddr $socket_path/gitlab-workhorse.socket -authBackend http://127.0.0.1:8080 -authSocket $rails_socket -documentRoot $app_root/public"
gitlab_workhorse_log="$app_root/log/gitlab-workhorse.log"
shell_path="/bin/bash"

# Read configuration variable file if it is present
test -f /etc/default/gitlab && . /etc/default/gitlab
...(省略)...

デフォルトだとunixソケットで待ち受けることとそのファイルパスが書いてある。そしてそれを/etc/default/gitlabで上書きしている。

なので該当する部分を以下のようにして、tcpで待ち受けるように書きなおす必要がある。

/etc/default/gitlab
gitlab_workhorse_options="-listenUmask 0 -listenNetwork tcp -listenAddr localhost:8181 -authBackend http://127.0.0.1:8080 -authSocket $socket_path/gitlab.socket -documentRoot $app_root/public"

これで治りました。無事HTTPでも通信が可能に。
アップデート手順にかなりさり気なく書かれていて読み飛ばしてしまっていたのと、具体的な手順が書かれていなかったのでここでかなり時間を時間を使ってしまった・・・。

終わりに

UIが大きく変わったのですこし慣れるのに時間がかかるかもしれないが、いろいろとかゆいところに手が届くようになっていまのところ快適です。不具合等が今後出なければいいな。

8系からCIが統合されたりアプリケーション連携が容易になっているようなので、楽しみ。

7
9
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
7
9