我以前在我的硬件服务器(Ubuntu 14.04)上有一个总是更新的GitLab实例。
然而,我最近决定安装Discourse(或Docker),现在GitLab不再正常启动了。
当我运行该服务时,sidekiq进程启动但不是Unicorn worker:
git@host:~$ bash -x /etc/init.d/gitlab start
+ RAILS_ENV=production
+ app_user=git
+ app_root=/home/git/gitlab
+ pid_path=/home/git/gitlab/tmp/pids
+ socket_path=/home/git/gitlab/tmp/sockets
+ web_server_pid_path=/home/git/gitlab/tmp/pids/unicorn.pid
+ sidekiq_pid_path=/home/git/gitlab/tmp/pids/sidekiq.pid
+ test -f /etc/default/gitlab
+ . /etc/default/gitlab
++ RAILS_ENV=production
++ app_user=git
++ app_root=/home/git/gitlab
++ pid_path=/home/git/gitlab/tmp/pids
++ socket_path=/home/git/gitlab/tmp/sockets
++ web_server_pid_path=/home/git/gitlab/tmp/pids/unicorn.pid
++ sidekiq_pid_path=/home/git/gitlab/tmp/pids/sidekiq.pid
+ '[' git '!=' git ']'
+ cd /home/git/gitlab
+ check_pids
+ mkdir -p /home/git/gitlab/tmp/pids
+ '[' -f /home/git/gitlab/tmp/pids/unicorn.pid ']'
++ cat /home/git/gitlab/tmp/pids/unicorn.pid
+ wpid=8688
+ '[' -f /home/git/gitlab/tmp/pids/sidekiq.pid ']'
++ cat /home/git/gitlab/tmp/pids/sidekiq.pid
+ spid=2923
+ case "$1" in
+ start_gitlab
+ check_stale_pids
+ check_status
+ check_pids
+ mkdir -p /home/git/gitlab/tmp/pids
+ '[' -f /home/git/gitlab/tmp/pids/unicorn.pid ']'
++ cat /home/git/gitlab/tmp/pids/unicorn.pid
+ wpid=8688
+ '[' -f /home/git/gitlab/tmp/pids/sidekiq.pid ']'
++ cat /home/git/gitlab/tmp/pids/sidekiq.pid
+ spid=2923
+ '[' 8688 -ne 0 ']'
+ kill -0 8688
+ web_status=1
+ '[' 2923 -ne 0 ']'
+ kill -0 2923
+ sidekiq_status=0
+ '[' 1 = 0 -a 0 = 0 ']'
+ gitlab_status=3
+ '[' 8688 '!=' 0 -a 1 '!=' 0 ']'
+ echo 'Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran.'
Removing stale Unicorn web server pid. This is most likely caused by the web server crashing the last time it ran.
+ rm /home/git/gitlab/tmp/pids/unicorn.pid
+ '[' 2923 '!=' 0 -a 0 '!=' 0 ']'
+ '[' 1 '!=' 0 -a 0 '!=' 0 ']'
+ '[' 1 '!=' 0 ']'
+ echo -n 'Starting GitLab Unicorn'
Starting GitLab Unicorn+ '[' 1 = 0 ']'
+ rm -f /home/git/gitlab/tmp/sockets/gitlab.socket
+ RAILS_ENV=production
+ bin/web start
master failed to start, check stderr log for details
+ '[' 0 = 0 ']'
+ echo 'The Sidekiq job dispatcher is already running with pid 2923, not restarting'
The Sidekiq job dispatcher is already running with pid 2923, not restarting
+ wait_for_pids
+ i=0
+ '[' '!' -f /home/git/gitlab/tmp/pids/unicorn.pid -o '!' -f /home/git/gitlab/tmp/pids/sidekiq.pid ']'
+ echo
+ print_status
+ check_status
+ check_pids
+ mkdir -p /home/git/gitlab/tmp/pids
+ '[' -f /home/git/gitlab/tmp/pids/unicorn.pid ']'
++ cat /home/git/gitlab/tmp/pids/unicorn.pid
+ wpid=9352
+ '[' -f /home/git/gitlab/tmp/pids/sidekiq.pid ']'
++ cat /home/git/gitlab/tmp/pids/sidekiq.pid
+ spid=2923
+ '[' 9352 -ne 0 ']'
+ kill -0 9352
+ web_status=0
+ '[' 2923 -ne 0 ']'
+ kill -0 2923
+ sidekiq_status=0
+ '[' 0 = 0 -a 0 = 0 ']'
+ gitlab_status=0
+ '[' 0 '!=' 0 -a 0 '!=' 0 ']'
+ '[' 0 = 0 ']'
+ echo 'The GitLab Unicorn web server with pid 9352 is running.'
The GitLab Unicorn web server with pid 9352 is running.
+ '[' 0 = 0 ']'
+ echo 'The GitLab Sidekiq job dispatcher with pid 2923 is running.'
The GitLab Sidekiq job dispatcher with pid 2923 is running.
+ '[' 0 = 0 -a 0 = 0 ']'
+ printf 'GitLab and all its components are \033[32mup and running\033[0m.\n'
GitLab and all its components are up and running.
+ exit
git@host:~$
不,Docker不会尝试绑定GitLab使用的端口:
root@host ~ # netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 3076/redis-server 1
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2940/nginx
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1330/sshd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3055/master
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 2940/nginx
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1391/mysqld
tcp6 0 0 :::2222 :::* LISTEN 30087/docker-proxy
tcp6 0 0 :::8080 :::* LISTEN 30094/docker-proxy
tcp6 0 0 :::80 :::* LISTEN 2940/nginx
tcp6 0 0 :::4949 :::* LISTEN 1168/perl
tcp6 0 0 :::22 :::* LISTEN 1330/sshd
tcp6 0 0 :::25 :::* LISTEN 3055/master
tcp6 0 0 :::1311 :::* LISTEN 2518/dsm_om_connsvc
udp 0 0 0.0.0.0:51367 0.0.0.0:* 1911/openvpn
Nginx正在运行,但只显示:
“502 - GitLab没有回复。”
有人能帮助我吗?
提前致谢。
答案 0 :(得分:1)
我刚发现问题。
我在某种程度上忽略了bash调试输出中的消息:
master failed to start, check stderr log for details
所以我打开了/home/git/gitlab/log/unicorn.stderr.log.1
,我看到了以下内容:
/home/git/gitlab/vendor/bundle/ruby/2.1.0/gems/unicorn-4.6.3/lib/unicorn/socket_helper.rb:147:in `initialize': Address already in use - bind(2) for "127.0.0.1" port 8080 (Errno::EADDRINUSE)
然后它击中了我:话语的Nginx使用与GitLab的独角兽工人相同的端口--8080
我调整了那个端口,然后再一切正常。