Setting custom environment variables
If necessary you can set custom environment variables to be used by Unicorn,
Sidekiq, Rails and Rake via /etc/gitlab/gitlab.rb
. This can be useful in
situations where you need to use a proxy to access the internet and need to
clone externally hosted repositories directly into GitLab. In
/etc/gitlab/gitlab.rb
supply a gitlab_rails['env']
with a hash value. For
example:
gitlab_rails['env'] = {
"http_proxy" => "http://USERNAME:PASSWORD@example.com:8080",
"https_proxy" => "http://USERNAME:PASSWORD@example.com:8080"
# "no_proxy" => ".yourdomain.com" # Wildcard syntax if you need your internal domain to bypass proxy
}
You can also override environment variables from other GitLab components which might be required if you are behind a proxy:
# Needed for proxying Git clones
gitaly['env'] = {
"http_proxy" => "http://USERNAME:PASSWORD@example.com:8080",
"https_proxy" => "http://USERNAME:PASSWORD@example.com:8080",
"no_proxy" => "unix" # Workaround for https://gitlab.com/gitlab-org/gitaly/issues/1447
}
gitlab_workhorse['env'] = {
"http_proxy" => "http://USERNAME:PASSWORD@example.com:8080",
"https_proxy" => "http://USERNAME:PASSWORD@example.com:8080"
}
# If you use the docker registry
registry['env'] = {
"http_proxy" => "http://USERNAME:PASSWORD@example.com:8080",
"https_proxy" => "http://USERNAME:PASSWORD@example.com:8080"
}
no_proxy
entry for Gitaly is needed in GitLab 11.6
and newer if a proxy is defined and Gitaly is listening on a UNIX
socket, which it is by default. It appears to be a limitation in the
gRPC client library. See the Gitaly
issue for more
details..
syntax for globing.http://
only, unless
your proxy has its own SSL certificate and SSL enabled. This means, even for
the https_proxy
value, you should usually specify a value as
http://USERNAME:PASSWORD@example.com:8080
.Applying the changes
Any change made to the environment variables requires a hard restart after reconfigure for it to take effect.
For configurations where Unicorn is enabled, after editing the gitlab.rb
file run
the following commands:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
For configurations where Puma is enabled, only a reconfigure is necessary since reconfigure will issue a full restart:
sudo gitlab-ctl reconfigure
Help and feedback
If there's something you don't like about this feature
To propose functionality that GitLab does not yet offer
To further help GitLab in shaping new features
If you didn't find what you were looking for
If you want help with something very specific to your use case, and can use some community support
POST ON GITLAB FORUM
If you have problems setting up or using this feature (depending on your GitLab subscription)
REQUEST SUPPORT
To view all GitLab tiers and features or to upgrade
If you want to try all features available in GitLab.com
If you want to try all features available in GitLab self-managed
If you spot an error or a need for improvement and would like to fix it yourself in a merge request
EDIT THIS PAGE
If you would like to suggest an improvement to this doc