Commit 1b6c85d4 authored by Marin Jankovski's avatar Marin Jankovski

Merge branch 'workhorse-api-limits' into 'master'

Add support for configuring workhorse's api limiting

Fixes: #1613

MR in workhorse for the setting went in here: gitlab-workhorse!65

cc\ @ayufan

See merge request !1020
parents 6cfea95d 21faa3e0
......@@ -6,6 +6,7 @@ omnibus-gitlab repository.
8.13.0
- Add support for registry debug addr configuration
- Add support for configuring workhorse's api limiting
- Support specifying a post reconfigure script to run in the docker container
- Updated cacerts.pem to 2016-09-14 version
......
......@@ -396,6 +396,9 @@ external_url 'GENERATED_EXTERNAL_URL'
# gitlab_workhorse['dir'] = "/var/opt/gitlab/gitlab-workhorse"
# gitlab_workhorse['log_directory'] = "/var/log/gitlab/gitlab-workhorse"
# gitlab_workhorse['proxy_headers_timeout'] = "1m0s"
# gitlab_workhorse['api_limit'] = 0 # limit number of concurrent API requests, defaults to 0 which is unlimited
# gitlab_workhorse['api_queue_limit'] = 0 # limit number of API requests allowed to be queued, defaults to 0 which disables queuing
# gitlab_workhorse['api_queue_duration'] = "30s" # duration after which we timeout requests if they sit too long in the queue
# gitlab_workhorse['env'] = {
# 'PATH' => "/opt/gitlab/bin:/opt/gitlab/embedded/bin:/bin:/usr/bin"
# }
......
......@@ -456,6 +456,9 @@ default['gitlab']['gitlab-workhorse']['pprof_listen_addr'] = "''" # put an empty
default['gitlab']['gitlab-workhorse']['dir'] = "/var/opt/gitlab/gitlab-workhorse"
default['gitlab']['gitlab-workhorse']['log_directory'] = "/var/log/gitlab/gitlab-workhorse"
default['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] = nil
default['gitlab']['gitlab-workhorse']['api_limit'] = nil
default['gitlab']['gitlab-workhorse']['api_queue_duration'] = nil
default['gitlab']['gitlab-workhorse']['api_queue_limit'] = nil
default['gitlab']['gitlab-workhorse']['env'] = {
'PATH' => "#{node['package']['install-dir']}/bin:#{node['package']['install-dir']}/embedded/bin:/bin:/usr/bin",
'HOME' => node['gitlab']['user']['home']
......
......@@ -22,6 +22,15 @@ exec chpst -e /opt/gitlab/etc/gitlab-workhorse/env -P \
<% if node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %>
-proxyHeadersTimeout <%= node['gitlab']['gitlab-workhorse']['proxy_headers_timeout'] %> \
<% end %>
<% if node['gitlab']['gitlab-workhorse']['api_limit'] %>
-apiLimit <%= node['gitlab']['gitlab-workhorse']['api_limit'] %> \
<% end %>
<% if node['gitlab']['gitlab-workhorse']['api_queue_duration'] %>
-apiQueueDuration <%= node['gitlab']['gitlab-workhorse']['api_queue_duration'] %> \
<% end %>
<% if node['gitlab']['gitlab-workhorse']['api_queue_limit'] %>
-apiQueueLimit <%= node['gitlab']['gitlab-workhorse']['api_queue_limit'] %> \
<% end %>
-secretPath /opt/gitlab/embedded/service/gitlab-rails/.gitlab_workhorse_secret \
# Do not remove this line; it prevents trouble with the trailing backslashes above.
......@@ -25,4 +25,24 @@ describe 'gitlab::gitlab-workhorse' do
end
end
end
context 'without api rate limiting' do
it 'correctly renders out the workhorse service file' do
expect(chef_run).to_not render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiLimit/)
expect(chef_run).to_not render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiQueueDuration/)
expect(chef_run).to_not render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiQueueLimit/)
end
end
context 'with api rate limiting' do
before do
stub_gitlab_rb(gitlab_workhorse: { api_limit: 3, api_queue_limit: 6, api_queue_duration: '1m' })
end
it 'correctly renders out the workhorse service file' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiLimit 3 \\/)
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiQueueDuration 1m \\/)
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-workhorse/run").with_content(/\-apiQueueLimit 6 \\/)
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment