linux - 自从安装了 Docker/Discourse 之后,GitLab 就不再工作了

标签 linux ubuntu gitlab discourse

我曾经在我的硬件服务器 (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 不会尝试绑定(bind) 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 没有响应。”

有人可以帮帮我吗?

提前致谢。

最佳答案

我刚发现问题。

我以某种方式忽略了 bash 调试输出中的消息:

master 启动失败,查看 stderr 日志获取详细信息

所以我打开了/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)

然后我突然想到:Discourse 的 Nginx 使用与 GitLab 的 unicorn workers - 8080 相同的端口

我调整了那个端口,瞧,一切都恢复正常了。

关于linux - 自从安装了 Docker/Discourse 之后,GitLab 就不再工作了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25805030/

相关文章:

linux - linux 上需要 docker-machine 吗?

c - 数据链路套接字读取传出数据包?

mongodb - 使用 apt-get 在 ubuntu 上安装 mongodb 失败

linux - Android 模拟器在 Ubuntu Maverick 上不断重启

go - 带有 Golang 的 gitlab-ci 不会创建正确的文件夹结构

ansible - 如何通过gitlab CI检查Ansible?

bash - ./deploy.sh 不适用于 gitlab ci

linux - 配置: error: Can't find libvorbis while installing recordmydesktop-0. 3.8.1

linux - Bash 在文件存在时返回一个没有这样的文件

ubuntu - SLURM 不遵循请求的资源