antoniovassell
antoniovassell

Reputation: 1032

Check GitLab API access: FAILED. code: 500 and all pages giving 500 error

I am getting 500 error code when viewing pages and doing:

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

Outputs Check GitLab API access: FAILED. code: 500

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.

Upvotes: 2

Views: 3069

Answers (2)

Zuse2k
Zuse2k

Reputation: 1

For me a port change in /etc/redis.conf from 0 to the standard port 6379 in combination with renaming the rescue.yml ind rescue.yml_old to disable it and setting the servername in apache2 hardcoded sovled the issue.

I've to look more inside tomorrow, but I'm quite sure the main problem was the FQDM of the apache server.

If you get a info message like this, when you restart apache2 :

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using xxxxxxx. Set the 'ServerName' directive globally to suppress this message

You might put ServerName blablabla.com e.g. in /etc/apache2/ports.conf . Restart Apache2 or restart the whole server ( redis etc. ) and try again.

Upvotes: 0

antoniovassell
antoniovassell

Reputation: 1032

Checking the logs for production located at /home/git/gitlab/log/production.log

tail -n 100 /home/git/gitlab/log/production.log

I see the last few errors are related to:

Errno::EACCES (Permission denied - connect(2) for /var/run/redis/redis.sock):

config/initializers/rack_attack_git_basic_auth.rb:5:inblock in `'

So from the command line:

cd /var/run/redis/
ls -l

Output

-rw-r--r-- 1 redis redis 5 Mar 29 16:39 redis-server.pid
srwxrwxr-x 1 root root 0 Mar 29 16:39 redis.sock

Here I think the file itself redis.sock has the wrong permissions or owned by the wrong user (root), lets changed that to redis:

chown redis:redis redis.sock
ls -l

Output

-rw-r--r-- 1 redis redis 5 Mar 29 16:39 redis-server.pid
srwxrwxr-x 1 redis redis 0 Mar 29 16:39 redis.sock

Doing this now everything works, I can now push/pull to gitlab from terminal, and also view pages without getting a 500 error.

There maybe different causes for a 500 error (though most times its permission errors like these) so its important to check the logs.

Upvotes: 2

Related Questions