ruby-on-rails - GitLab API 访问 : Failed to connect to internal API

标签 ruby-on-rails ruby nginx gitlab

我在 Arch Linux 上配置 Gitlab 后出现此错误:

sudo -u gitlab bundle exec rake gitlab:check RAILS_ENV=production

Check GitLab API access: FAILED: Failed to connect to internal API
gitlab-shell self-check failed
  Try fixing it:
  Make sure GitLab is running;
  Check the gitlab-shell configuration file:
  sudo -u gitlab -H editor /usr/share/webapps/gitlab-shell/config.yml
  Please fix the error above and rerun the checks.

unicorn .stderr.log:

INFO -- : Refreshing Gem list
INFO -- : listening on addr=/run/gitlab/gitlab.socket fd=12
INFO -- : worker=0 ready
INFO -- : worker=1 ready
INFO -- : master process ready
INFO -- : worker=2 ready

权限:

srwxrwxrwx 1 gitlab gitlab 0 Jul 20 09:20 gitlab.socket
-rw-r--r-- 1 gitlab gitlab 6 Jul 20 09:20 unicorn.pid

gitlab-shell/config.yml

http+unix: "/run/gitlab/gitlab.socket"
gitlab_url: "http://127.0.0.1:8080"

gitlab/ unicorn .rb

listen "/run/gitlab/gitlab.socket", :backlog => 1024
# listen "127.0.0.1:8080", :tcp_nopush => true

gitlab/gitlab.yml

host: localhost
port: 3000
https: false

nginx 服务器 block

server
{
        listen 80;
        server_name code.example.com;

        charset utf-8;

        location /
        {
                proxy_read_timeout 300;
                proxy_connect_timeout 300;
                proxy_redirect off;

                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-Ssl on;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Proto $scheme;

                proxy_pass http://127.0.0.1:3000;
        }

        server_tokens off;
}

我尝试了很多东西,nginx 显示空白页面或 502 Bad Gateway,gitlab 检查命令显示“无法连接到内部 API”或“错误 500”。

最佳答案

我遇到了同样的问题。 最终解决问题的是更改默认值:

增加 unicorn['worker_processes']

unicorn['listen']127.0.0.1 更改为 GitLab 监听的 IP。

关于ruby-on-rails - GitLab API 访问 : Failed to connect to internal API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38475223/

相关文章:

ruby-on-rails - 如何根据日期作为数据库中的列的确切年份过滤用户?

linux - 在 CentOS 中使用 Nginx 作为 Apache 上 wordpress 的反向代理

ruby-on-rails - 有条件地将日期分隔符插入聊天消息数组

jquery - 第二次访问页面时未应用 Rails css/js

ruby-on-rails - 仍然很难使用 RoR MVC 方法

ruby-on-rails - 直接访问SQLite3?

ruby - RVM 首先在 $PATH 中加载

ruby-on-rails - Rails 错误:未初始化常量 Sass::Plugin (NameError)

django - 连接到上游时,Kubernetes构建Django + uwsgi + Nginx显示失败(111:连接被拒绝)

php - 如何避免 PHP 脚本失败时服务器无响应