stage | group | info |
---|---|---|
Create |
Source Code |
Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review. |
GitLab Workhorse is a smart reverse proxy for GitLab intended to handle resource-intensive and long-running requests.
It sits in front of Puma and intercepts every HTTP request destined for and emitted from GitLab Rails.
Rails delegates requests to Workhorse and it takes responsibility for resource intensive HTTP requests
such as file downloads and uploads, git
over HTTP push/pull and git
over HTTP archive downloads,
which optimizes resource utilization and improves request handling efficiency.
Workhorse can have other reverse proxy servers in front of it but only NGINX is supported.
It is also possible (although unsupported) to use other reverse proxies such as Apache when installing
GitLab from source.
On many instances of GitLab, such as gitlab.com
, a CDN like CloudFlare sits in front of NGINX.
Every Rails controller and other code that handles HTTP requests and returning HTTP responses is proxied through GitLab Workhorse. Workhorse is unlike other reverse proxies as it is very tightly coupled to GitLab Rails where as most reverse proxies are quite generic. When required, Workhorse makes modifications to HTTP headers which GitLab Rails depends on to offload work efficiently.
Workhorse serves as a proxy to the Rails API, especially in contexts requiring interaction with container registry services. This setup exemplifies Workhorse's ability to handle high-load services by acting as a reverse proxy, thereby minimizing the direct load on Rails.
Workhorse is contained in a subfolder of the Rails monorepo at
gitlab-org/gitlab/workhorse
.
To install GitLab Workhorse you need Go 1.18 or newer and GNU Make.
To install into /usr/local/bin
run make install
.
make install
To install into /foo/bin
set the PREFIX variable.
make install PREFIX=/foo
On some operating systems, such as FreeBSD, you may have to use
gmake
instead of make
.
NOTE: Some features depends on build tags, make sure to check Workhorse configuration to enable them.
Workhorse uses ExifTool for removing EXIF data (which may contain sensitive information) from uploaded images. If you installed GitLab:
Using the Linux package, you're all set.
If you are using CentOS Minimal, you may need to install perl
package: yum install perl
.
From source, make sure exiftool
is installed:
# Debian/Ubuntu
sudo apt-get install libimage-exiftool-perl
# RHEL/CentOS
sudo yum install perl-Image-ExifTool
Run the tests with:
make clean test
Each feature in GitLab Workhorse should have an integration test that verifies that the feature 'kicks in' on the right requests and leaves other requests unaffected. It is better to also have package-level tests for specific behavior but the high-level integration tests should have the first priority during development.
It is OK if a feature is only covered by integration tests.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。