git 双重检查 GitLab 安装:gitlab-shell 自检失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19859216/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:19:31  来源:igfitidea点击:

double checking GitLab installation : gitlab-shell self-check failed

gitgitlab

提问by Leandro Garcia

I installed GitLab and everything seems fine. Until I double check application status by running: sudo -u git -H editor /home/git/gitlab-shell/config.yml. This item is in red and seems to have an error:

我安装了 GitLab,一切似乎都很好。直到通过运行我仔细检查应用程序的状态:sudo -u git -H editor /home/git/gitlab-shell/config.yml。这个项目是红色的,似乎有一个错误:

  gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

I try opening config.ymlbut I don't seem to find any unusual there. You think what am I missing?

我尝试打开,config.yml但似乎没有发现任何异常。你觉得我错过了什么?

Also, I have a custom SSH connection. What I don't understand from this explanation:

另外,我有一个自定义的 SSH 连接。从这个解释中我不明白的是:

Custom SSH Connection

If you are running SSH on a non-standard port, you must change the gitlab user's SSH config.

# Add to /home/git/.ssh/config
host localhost          # Give your setup a name (here: override localhost)
    user git            # Your remote git user
    port 2222           # Your port number
    hostname 127.0.0.1; # Your server name or IP
You also need to change the corresponding options (e.g. ssh_user, ssh_host, admin_uri) in the config\gitlab.yml file.

Out of lost, I don't have this /home/git/.ssh/config, should I create one or I am just missing something?

由于丢失,我没有这个/home/git/.ssh/config,我应该创建一个还是我只是缺少一些东西?

My call stack:

我的调用堆栈:

Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.4 ? ... OK (1.7.6)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ... can't check, you have no projects
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `initialize': getaddrinfo: Name or service not known (SocketError)
        from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `open'
        from /usr/local/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
        from /usr/local/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
        from /usr/local/lib/ruby/2.0.0/net/http.rb:877:in `connect'
        from /usr/local/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
        from /usr/local/lib/ruby/2.0.0/net/http.rb:851:in `start'
        from /home/git/gitlab-shell/lib/gitlab_net.rb:62:in `get'
        from /home/git/gitlab-shell/lib/gitlab_net.rb:29:in `check'
        from /home/git/gitlab-shell/bin/check:11:in `<main>'
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u git -H editor /home/git/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
projects have namespace: ... can't check, you have no projects
Projects have satellites? ... can't check, you have no projects
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/local/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.4)

Checking GitLab ... Finished

回答by VonC

It could be similar to the Issue 5437:

它可能类似于问题 5437

I ran into the exact same problem doing a clean install on my debian wheezy 7.2 server.

I made two changes and rebooted the server (no problem since it is only a testserver):

  • make sure that your domain points to 127.0.0.1in /etc/hosts(on my server it pointed to 127.0.1.1)
  • add /home/git/.ssh/configfor the non-standard ssh port as mentioned in the installation procedure

我在我的 debian wheezy 7.2 服务器上进行全新安装时遇到了完全相同的问题。

我做了两个更改并重新启动了服务器(没问题,因为它只是一个测试服务器):

  • 请确保您的域指向127.0.0.1/etc/hosts(我的服务器上它指127.0.1.1
  • 添加/home/git/.ssh/config安装过程中提到的非标准ssh端口

In that case, setting the domain to 127.0.0.1in the /etc/hostswas enough.

在这种情况下,将域设置为127.0.0.1in/etc/hosts就足够了。

Other issue possible: issue 5426: wrong sidekick command

其他可能的问题:问题 5426:错误的助手命令

This way to start sidekiq does not work anymore. You have to use:

这种启动 sidekiq 的方式不再有效。你必须使用:

sudo -u git -H RAILS_ENV=production script/background_jobs start


An http.rb:xxx:ininitialize': getaddrinfo: Name or service not known (SocketError)` error message is seen in:

一个http.rb:xxx:ininitialize': getaddrinfo: Name or service not known (SocketError)` 错误消息显示在:

  • Issue 5151=> solved by this comment:

    sudo -u git -H vim /home/git/gitlab-shell/config.yml
    # and change:
    gitlab_url: http://yourhost to gitlab_url: http://yourhost/
    # Slash at the end is important.
    
  • Issue 42 of gitlab-shell: again, the /etc/hostsis important to get right.

  • 问题 5151=> 通过此评论解决:

    sudo -u git -H vim /home/git/gitlab-shell/config.yml
    # and change:
    gitlab_url: http://yourhost to gitlab_url: http://yourhost/
    # Slash at the end is important.
    
  • gitlab-shell 的第 42 期:同样,/etc/hosts正确处理很重要。



The OP Leandro Garciaconfirms in the comments:

OP莱昂德罗·加西亚证实的评论

I forgot to setup the domain I provided on gitlab_url.
Adding that and correcting the DNS on my domain provider solves the issue

我忘记设置我提供的域gitlab_url
添加并更正我的域提供商上的 DNS 解决了问题

回答by Phil Ryan

Something similar for me, I had my Omnibus Gitlab installation all working fine. I was able to run various GIT updates and pushes and pulls.

对我来说类似的东西,我的 Omnibus Gitlab 安装一切正常。我能够运行各种 GIT 更新和推拉。

But then I was changing the host and domain name configurations of the server, and then my gitlab wouldn't responding properly, giving the same sort of errors as above. The actual hostname hadn't changed, but how that hostname was being represented in /etc/hostsand on my LAN. I thought that I could do a side-run around problems like this by just setting, in my local ~/.git/configfile, the location of the gitlab server to be it's IP address, but that wasn't enough. I had to ensure that Gitlab's own NGINX config file's representation of it's local hostname was understood by the machine.

但是后来我正在更改服务器的主机和域名配置,然后我的 gitlab 无法正确响应,给出与上述相同类型的错误。实际的主机名没有改变,但是主机名/etc/hosts在我的 LAN中和在我的 LAN 上是如何表示的。我以为我可以通过在我的本地~/.git/config文件中将 gitlab 服务器的位置设置为它的 IP 地址来绕过这样的问题,但这还不够。我必须确保机器理解 Gitlab 自己的 NGINX 配置文件对其本地主机名的表示。

In a standard Omnibus Gitlab deployment, your nginx config file is found here: /var/opt/gitlab/nginx/etc/gitlab-http.conf, and you are interested in the serverpart:

在标准的 Omnibus Gitlab 部署中,您可以在此处找到您的 nginx 配置文件:/var/opt/gitlab/nginx/etc/gitlab-http.conf,您对以下server部分感兴趣:

server { listen *:80; server_name hostname.on.your.domain;

server { listen *:80; server_name hostname.on.your.domain;

A quick test is: is that hostname as configured in your gitlab-http.conf file pingable?

一个快速测试是:在 gitlab-http.conf 文件中配置的主机名是否可以 ping 通?

ping hostname.on.your.domain

ping hostname.on.your.domain

if not, then double-triple check your /etc/hosts and networking configurations.

如果没有,请仔细检查您的 /etc/hosts 和网络配置。

回答by Yermo Lamers

I just upgraded to 7.2.2 and ran into this issue under Ubuntu 14.04 LTS and have never before looked at Ruby code.

我刚刚升级到 7.2.2 并在 Ubuntu 14.04 LTS 下遇到了这个问题,之前从未看过 Ruby 代码。

Looking in gitlab-shell/lib/gitlab_config.rb around line 54 I find that the definition of redis['bin'] is empty and thus the test in gitlab-shell/bin/check fails.

查看第 54 行附近的 gitlab-shell/lib/gitlab_config.rb,我发现 redis['bin'] 的定义为空,因此 gitlab-shell/bin/check 中的测试失败。

As a quick hack to get it to work I changed:

作为让它工作的快速技巧,我改变了:

# Build redis command to write update event in gitlab queue def redis_command if redis.empty? # Default to old method of connecting to redis # for users that haven't updated their configuration %W(env -i redis-cli) else if redis.has_key?("socket") %W(#{redis['bin']} -s #{redis['socket']}) else %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']}) end end end to # Build redis command to write update event in gitlab queue def redis_command # Default to old method of connecting to redis # for users that haven't updated their configuration %W(env -i redis-cli) end

# Build redis command to write update event in gitlab queue def redis_command if redis.empty? # Default to old method of connecting to redis # for users that haven't updated their configuration %W(env -i redis-cli) else if redis.has_key?("socket") %W(#{redis['bin']} -s #{redis['socket']}) else %W(#{redis['bin']} -h #{redis['host']} -p #{redis['port']}) end end end # Build redis command to write update event in gitlab queue def redis_command # Default to old method of connecting to redis # for users that haven't updated their configuration %W(env -i redis-cli) end

回答by Dariss

Had similar problem. I had wrong address in my gitlab-shell. 127.0.0.1:3000 was wrong, because I had to put the same address as I used via web (nginx proxy) for example gitlab.com.

有类似的问题。我的 gitlab-shell 地址错误。127.0.0.1:3000 是错误的,因为我必须输入与我通过网络(nginx 代理)使用的地址相同的地址,例如 gitlab.com。