linux · tech · tips

How to fix Gitlab timeout

A client asked for a Gitlab server. We’re using Gitlab internally for our small projects, so we already had some expertise on it, but it’s always interesting to see how a solution that is working for you will fare in a different environment.

After the installation, everything was running smoothly except the client had a problem on pages showing a large number of commits. This is a known issue, and there’s a lot of answers spread in the web, so I wanted to provide the solution we adopted, in the hope it would be useful for some fellow admin.

First thing to remember is, if you’ve used the Omnibus package, all your modifications will go in /etc/gitlab/gitlab.rb. We added these lines:

# commit read timeout
gitlab_rails['git_timeout'] = 600

# nginx timeout
nginx['keepalive_timeout'] = 300

# unicorn timeout
unicorn['worker_timeout'] = 300

After modifying that file you’ll need to run:

# gitlab-ctl reconfigure

The command will rebuild the configuration files and restart the services with the new values. This configuration solved the problem for our client.

If you are not using the Omnibus package, you’ll need to modify gitlab-rails/etc/gitlab.yml, gitlab-rails/etc/unicorn.rb and of course nginx config file.