我在 CentOS 7 上运行最新的 GitLab-CE ( gitlab-ce-12.0.3-ce.0.el7.x86_64
)。它是综合安装,直到昨天都运行良好。在更新一些操作系统软件包*并重启系统后,GitLab 无法工作。
* 更新软件包列表:
- 7:设备映射器-1.02.149-10.el7_6.8.x86_64
- 7:设备映射器事件-1.02.149-10.el7_6.8.x86_64
- 7:设备映射器事件库-1.02.149-10.el7_6.8.x86_64
- 7:设备映射器库-1.02.149-10.el7_6.8.x86_64
- 7:lvm2-2.02.180-10.el7_6.8.x86_64
- 7:lvm2-libs-2.02.180-10.el7_6.8.x86_64
- gitlab-runner-12.0.2-1.x86_64
- glibc-2.17-260.el7_6.6.x86_64
- glibc-通用-2.17-260.el7_6.6.x86_64
- glibc-devel-2.17-260.el7_6.6.x86_64
- glibc-标头-2.17-260.el7_6.6.x86_64
- libteam-1.27-6.el7_6.1.x86_64
- systemd-219-62.el7_6.7.x86_64
- systemd-libs-219-62.el7_6.7.x86_64
- systemd-sysv-219-62.el7_6.7.x86_64
- teamd-1.27-6.el7_6.1.x86_64
- tzdata-2019b-1.el7.noarch
症状:
502 哎呀,GitLab 响应时间太长了。(访问 Web 界面时)
GitLab:无法授权您的 Git 请求:内部 API 无法访问(尝试 git pull 时)
gitlab-ctl reconfigure
并且gitlab-ctl restart
没有帮助。
我/var/log/gitlab/unicorn/unicorn_stderr.log
发现:
I, [2019-07-17T10:23:20.831800 #23128] INFO -- : Refreshing Gem list
I, [2019-07-17T10:24:04.558224 #23128] INFO -- : listening on addr=127.0.0.1:8080 fd=19
I, [2019-07-17T10:24:04.558414 #23128] INFO -- : unlinking existing socket=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
I, [2019-07-17T10:24:04.558640 #23128] INFO -- : listening on addr=/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket fd=20
E, [2019-07-17T10:24:04.559419 #23128] ERROR -- : Operation not permitted (Errno::EPERM)
/var/opt/gitlab/gitlab-rails/etc/unicorn.rb:47:in `kill'
/var/opt/gitlab/gitlab-rails/etc/unicorn.rb:47:in `block in reload'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:543:in `spawn_missing_workers'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/lib/unicorn/http_server.rb:142:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/unicorn-5.4.1/bin/unicorn:126:in `<top (required)>'
/opt/gitlab/embedded/bin/unicorn:23:in `load'
/opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
我的独角兽出了什么问题?如何修复它?
我发现 rubby 正在以git
用户身份运行:
$ sudo ps -ef | grep ruby
git 22951 22928 0 10:23 ? 00:00:06 ruby /opt/gitlab/embedded/service/gitaly-ruby/bin/gitaly-ruby 22928 /tmp/gitaly-ruby531460471/socket.0
git 22952 22928 0 10:23 ? 00:00:06 ruby /opt/gitlab/embedded/service/gitaly-ruby/bin/gitaly-ruby 22928 /tmp/gitaly-ruby531460471/socket.1
并且套接字也归git
用户所有:
$ ls -l /tmp/gitaly-ruby531460471/socket.{0,1} /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
srwxr-xr-x. 1 git git 0 Jul 17 10:23 /tmp/gitaly-ruby531460471/socket.0
srwxr-xr-x. 1 git git 0 Jul 17 10:23 /tmp/gitaly-ruby531460471/socket.1
srwxrwxrwx. 1 git git 0 Jul 17 11:32 /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket
端口 8080 未被使用:
$ sudo ss -t -u -n | grep -e Netid -e 8080
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
$
答案1
我试过很多修复 Gitlab 的方法,我将其与新的、在虚拟机上全新安装进行了比较,删除了缓存,重新安装了代码(yum reinstall gitlab-ce
)......但没有成功。
最后,我决定卸载 Gitlab,然后删除了大多数文件,包括存储库(我保留了/etc/gitlab/gitlab.rb
秘密和账户),进行了新安装并从备份中恢复了数据。
Gitlab 现在已可以再次工作。
这个问题已经不再相关了。