以下のサイトの説明通りにGitLabをインストールしてみた。
環境
項目 | 内容 |
---|---|
OS | Ubuntu 14.04.3 LTS (64bit) |
インストール
依存パッケージをインストールする。
$ sudo apt-get install curl openssh-server ca-certificates postfix
postfixのインストール時に画面が出たので以下の通り設定した。他のパッケージは以前にインストール済みのためインストールされず。
aptリポジトリを追加する。
$ curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
gitlabパッケージをインストールする。
$ sudo apt-get install gitlab-ce
gitlabの初期設定を行う。
$ sudo gitlab-ctl reconfigure
設定変更
コマンドでステータスを確認したところ、以下の通りであった。動いているサービス多い・・・。
$ sudo gitlab-ctl status
run: gitlab-git-http-server: (pid 32077) 53s; run: log: (pid 21099) 5145s
run: logrotate: (pid 32082) 53s; run: log: (pid 21115) 5142s
run: nginx: (pid 32277) 0s; run: log: (pid 21106) 5144s
run: postgresql: (pid 32090) 52s; run: log: (pid 20986) 5158s
run: redis: (pid 32098) 52s; run: log: (pid 20898) 5164s
run: sidekiq: (pid 32102) 51s; run: log: (pid 21084) 5146s
run: unicorn: (pid 32106) 51s; run: log: (pid 21052) 5147s
ポートが衝突して動いていないはずなので、ログを確認してみる。
$ ps -ef | grep 21106
root 21106 21105 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/nginx
$ sudo ls -l /var/log/gitlab/nginx
-rw-r--r-- 1 root root 30 11月 21 12:47 config
-rw-r--r-- 1 root root 499066 11月 21 14:19 current
-rw-r--r-- 1 root root 0 11月 21 12:47 error.log
-rw-r--r-- 1 root root 0 11月 21 12:47 gitlab_access.log
-rw-r--r-- 1 root root 0 11月 21 12:47 gitlab_error.log
-rw------- 1 root root 0 11月 21 12:47 lock
$ sudo tail -f /var/log/gitlab/nginx/current
2015-11-21_05:20:58.21290 2015/11/21 14:20:58 [emerg] 579#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015-11-21_05:20:58.71315 2015/11/21 14:20:58 [emerg] 579#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015-11-21_05:20:59.21339 2015/11/21 14:20:58 [emerg] 579#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015-11-21_05:20:59.71362 2015/11/21 14:20:58 [emerg] 579#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015-11-21_05:21:00.21386 2015/11/21 14:20:58 [emerg] 579#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2015-11-21_05:21:00.71405 2015/11/21 14:20:58 [emerg] 579#0: still could not bind()
やはりポートが衝突していた。設定を変更するため設定ファイルの場所を確認する。
$ ps -ef | grep nginx
root 885 21105 0 14:23 ? 00:00:00 /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
root 21105 20875 0 12:47 ? 00:00:01 runsv nginx
root 21106 21105 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/nginx
/var/log/gitlab/nginx/current
/opt/gitlab/embedded
と/var/opt/gitlab/nginx
の下を検索してみる。
$ sudo find /opt/gitlab/embedded -name *.conf -exec grep listen {} \; -print
listen 80;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# listen 8000;
# listen somename:8080;
# listen 443 ssl;
/opt/gitlab/embedded/conf/nginx.conf
# Squid normally listens to port 3128
/opt/gitlab/embedded/lib/node_modules/npm/node_modules/request/tests/squid.conf
# Squid normally listens to port 3128
/opt/gitlab/embedded/lib/node_modules/npm/node_modules/node-gyp/node_modules/request/tests/squid.conf
# listen 80 default deferred; # for Linux
# listen 80 default accept_filter=httpready; # for FreeBSD
# If you have IPv6, you'll likely want to have two separate listeners.
# of a single dual-stack listener. A dual-stack listener will make
# listen [::]:80 ipv6only=on; # deferred or accept_filter recommended
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.8.3/examples/nginx.conf
# listen 80 default deferred; # for Linux
# listen 80 default accept_filter=httpready; # for FreeBSD
# If you have IPv6, you'll likely want to have two separate listeners.
# of a single dual-stack listener. A dual-stack listener will make
# listen [::]:80 ipv6only=on; # deferred or accept_filter recommended
/opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/unicorn-4.8.2/examples/nginx.conf
$ sudo find /var/opt/gitlab/nginx -name *.conf -exec grep listen {} \; -print
listen *:80;
/var/opt/gitlab/nginx/conf/gitlab-http.conf
/opt/gitlab/embedded/conf/nginx.conf
と/var/opt/gitlab/nginx/conf/gitlab-http.conf
の二つのファイルが見つかったので、片方づつ以下のように設定を変更して、サービスの起動を確認した。
/var/opt/gitlab/nginx/conf/gitlab-http.conf
のほうが実行に使用している設定ファイルだった。
server {
listen *:80;
↓
listen *:10080;
nginxサービスの再起動は以下のコマンドを使用した。
※ポート衝突を検出してnginxサービスが自動で再起動を繰り返していたので、コマンド実行する必要は無かった。
$ sudo gitlab-ctl restart nginx
ok: run: nginx: (pid 3886) 0s```
動作確認
以下のURLにアクセスして、GitLabが表示されることを確認した。
デフォルトのユーザ名/パスワードでログインした。
項目 | 内容 |
---|---|
Username | root |
Password | 5iveL!fe |
補足
gitlab関連で動作しているプロセスを確認してみた。ほんと多すぎ・・・。
$ ps -efH
UID PID PPID C STIME TTY TIME CMD
≪省略≫
root 20875 1 0 12:46 ? 00:00:00 runsvdir -P /opt/gitlab/service log: ...........................................................................................................................................................................................................................................................................................................................................................................................................
root 20897 20875 0 12:46 ? 00:00:00 runsv redis
root 20898 20897 0 12:46 ? 00:00:00 svlogd -tt /var/log/gitlab/redis
gitlab-+ 3682 20897 0 14:49 ? 00:00:01 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
root 20985 20875 0 12:46 ? 00:00:00 runsv postgresql
root 20986 20985 0 12:46 ? 00:00:00 svlogd -tt /var/log/gitlab/postgresql
gitlab-+ 3674 20985 0 14:49 ? 00:00:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
gitlab-+ 3676 3674 0 14:49 ? 00:00:00 postgres: checkpointer process
gitlab-+ 3677 3674 0 14:49 ? 00:00:00 postgres: writer process
gitlab-+ 3678 3674 0 14:49 ? 00:00:00 postgres: wal writer process
gitlab-+ 3679 3674 0 14:49 ? 00:00:00 postgres: autovacuum launcher process
gitlab-+ 3680 3674 0 14:49 ? 00:00:00 postgres: stats collector process
gitlab-+ 3740 3674 0 14:49 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 3741 3674 0 14:49 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 3969 3674 0 14:52 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 4101 3674 0 14:54 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 4103 3674 0 14:54 ? 00:00:00 postgres: gitlab gitlabhq_production [local] idle
root 21051 20875 0 12:47 ? 00:00:00 runsv unicorn
root 21052 21051 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/unicorn
git 3714 21051 0 14:49 ? 00:00:00 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper
git 4763 3714 0 15:04 ? 00:00:00 sleep 1
root 21083 20875 0 12:47 ? 00:00:00 runsv sidekiq
root 21084 21083 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/sidekiq
git 3689 21083 1 14:49 ? 00:00:09 sidekiq 3.3.0 gitlab-rails [0 of 25 busy]
root 21098 20875 0 12:47 ? 00:00:00 runsv gitlab-git-http-server
root 21099 21098 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/gitlab-git-http-server
git 3652 21098 0 14:49 ? 00:00:00 /opt/gitlab/embedded/bin/gitlab-git-http-server -listenNetwork unix -listenUmask 0 -listenAddr /var/opt/gitlab/gitlab-git-http-server/socket -authBackend http://127.0.0.1:8080 -pprofListenAddr
root 21105 20875 0 12:47 ? 00:00:02 runsv nginx
root 21106 21105 0 12:47 ? 00:00:01 svlogd -tt /var/log/gitlab/nginx
root 3886 21105 0 14:51 ? 00:00:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+ 3887 3886 0 14:51 ? 00:00:00 nginx: worker process
gitlab-+ 3888 3886 0 14:51 ? 00:00:00 nginx: worker process
gitlab-+ 3889 3886 0 14:51 ? 00:00:00 nginx: worker process
gitlab-+ 3890 3886 0 14:51 ? 00:00:00 nginx: worker process
root 21114 20875 0 12:47 ? 00:00:00 runsv logrotate
root 21115 21114 0 12:47 ? 00:00:00 svlogd -tt /var/log/gitlab/logrotate
root 3659 21114 0 14:49 ? 00:00:00 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper
root 4478 3659 0 14:59 ? 00:00:00 sleep 3000
root 31327 1 0 14:04 ? 00:00:00 /usr/lib/postfix/master
postfix 31328 31327 0 14:04 ? 00:00:00 pickup -l -t unix -u -c
postfix 31329 31327 0 14:04 ? 00:00:00 qmgr -l -t unix -u
git 3730 1 0 14:49 ? 00:00:06 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 3773 3730 0 14:49 ? 00:00:00 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 3776 3730 0 14:49 ? 00:00:00 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 3779 3730 0 14:49 ? 00:00:00 unicorn worker[2] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 3782 3730 0 14:49 ? 00:00:00 unicorn worker[3] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
git 3785 3730 0 14:49 ? 00:00:00 unicorn worker[4] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru