# HG changeset patch # User Kassio Borges <kborges@gitlab.com> # Date 1649917414 0 # Thu Apr 14 06:23:34 2022 +0000 # Node ID 9208ed301eff0559aab51be639881e657e353166 # Parent 133c42bcc39b4ea6b037b7bf073add8c5567320c Add pages http server timeout options Related to: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/725 Changelog: added diff --git a/files/gitlab-config-template/gitlab.rb.template b/files/gitlab-config-template/gitlab.rb.template --- a/files/gitlab-config-template/gitlab.rb.template +++ b/files/gitlab-config-template/gitlab.rb.template @@ -1741,6 +1741,15 @@ ##! Zip HTTP Client timeout # gitlab_pages['zip_http_client_timeout'] = "30m" +##! ReadTimeout is the maximum duration for reading the entire request, including the body. A zero or negative value means there will be no timeout. +# gitlab_pages['server_read_timeout'] = "5s" +##! ReadHeaderTimeout is the amount of time allowed to read request headers. A zero or negative value means there will be no timeout. +# gitlab_pages['server_read_header_timeout'] = "1s" +##! WriteTimeout is the maximum duration before timing out writes of the response. A zero or negative value means there will be no timeout. +# gitlab_pages['server_write_timeout'] = "5m" +##! KeepAlive specifies the keep-alive period for network connections accepted by this listener. If zero, keep-alives are enabled if supported by the protocol and operating system. If negative, keep-alives are disabled. +# gitlab_pages['server_keep_alive'] = "15s" + ##! Enable serving content from disk instead of Object Storage # gitlab_pages['enable_disk'] = nil diff --git a/files/gitlab-cookbooks/gitlab-pages/attributes/default.rb b/files/gitlab-cookbooks/gitlab-pages/attributes/default.rb --- a/files/gitlab-cookbooks/gitlab-pages/attributes/default.rb +++ b/files/gitlab-cookbooks/gitlab-pages/attributes/default.rb @@ -69,3 +69,8 @@ default['gitlab-pages']['rate_limit_tls_source_ip_burst'] = nil default['gitlab-pages']['rate_limit_tls_domain'] = nil default['gitlab-pages']['rate_limit_tls_domain_burst'] = nil +# HTTP Server timeouts +default['gitlab-pages']['server_read_timeout'] = nil +default['gitlab-pages']['server_read_header_timeout'] = nil +default['gitlab-pages']['server_write_timeout'] = nil +default['gitlab-pages']['server_keep_alive'] = nil diff --git a/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb b/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb --- a/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb +++ b/files/gitlab-cookbooks/gitlab-pages/templates/default/gitlab-pages-config.erb @@ -161,3 +161,15 @@ <%- if @rate_limit_tls_domain_burst -%> rate-limit-tls-domain-burst=<%= @rate_limit_tls_domain_burst %> <%-end -%> +<%- if @server_read_timeout -%> +server-read-timeout=<%= @server_read_timeout %> +<%-end -%> +<%- if @server_read_header_timeout -%> +server-read-header-timeout=<%= @server_read_header_timeout %> +<%-end -%> +<%- if @server_write_timeout -%> +server-write-timeout=<%= @server_write_timeout %> +<%-end -%> +<%- if @server_keep_alive -%> +server-keep-alive=<%= @server_keep_alive %> +<%-end -%> diff --git a/spec/chef/cookbooks/gitlab-pages/recipes/gitlab-pages_spec.rb b/spec/chef/cookbooks/gitlab-pages/recipes/gitlab-pages_spec.rb --- a/spec/chef/cookbooks/gitlab-pages/recipes/gitlab-pages_spec.rb +++ b/spec/chef/cookbooks/gitlab-pages/recipes/gitlab-pages_spec.rb @@ -227,6 +227,10 @@ rate_limit_tls_source_ip_burst: 51, rate_limit_tls_domain: 1001, rate_limit_tls_domain_burst: 10001, + server_read_timeout: "1m", + server_read_header_timeout: "2m", + server_write_timeout: "3m", + server_keep_alive: "4m", enable_disk: true, env: { GITLAB_CONTINUOUS_PROFILING: "stackdriver?service=gitlab-pages", @@ -292,6 +296,10 @@ rate-limit-tls-source-ip-burst=51 rate-limit-tls-domain=1001 rate-limit-tls-domain-burst=10001 + server-read-timeout=1m + server-read-header-timeout=2m + server-write-timeout=3m + server-keep-alive=4m EOS expect(chef_run).to render_file("/var/opt/gitlab/pages/gitlab-pages-config").with_content(expected_content)