falkseidl
falkseidl

Reputation: 41

GitLab API Access: Failed to connect to internal API

I'm getting this error after I configured Gitlab on Arch Linux:

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

Permissions:

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 serverblock

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;
}

I tried many things, nginx is showing a blank page or 502 Bad Gateway, and the gitlab check command is saying "Failed to connect to internal API" or "Error 500".

Upvotes: 4

Views: 7767

Answers (2)

Xeno
Xeno

Reputation: 79

Instead of:

http+unix: "/run/gitlab/gitlab.socket"

try:

gitlab_url: "http+unix://%2Frun%2Fgitlab%2Fgitlab.socket"

Upvotes: 0

Qrzy
Qrzy

Reputation: 186

I've had the same problem. What finally solved the issue was changing defaults:

increasing unicorn['worker_processes']

changing unicorn['listen'] from 127.0.0.1 to the IP that GitLab listens on.

Upvotes: 1

Related Questions