Merge branch '2747-new-pages-options' into 'master'

Add Pages -artifacts-server and -artifacts-server-timeout support to Omnibus

Closes #2747

See merge request gitlab-org/omnibus-gitlab!1919
This commit is contained in:
Marin Jankovski 2017-10-04 14:13:41 +00:00
commit 188def96b3
8 changed files with 51 additions and 2 deletions

View File

@ -7,11 +7,13 @@ omnibus-gitlab repository.
- Remove unused Grit configuration settings
- Enable profiler for jemalloc
- Add -artifacts-server and -artifacts-server-timeout support to Omnibus
- Added PostgreSQL support for effective_io_concurrency
- Added PostgreSQL support for max_worker_processes and max_parallel_workers_per_gather
- Added PostgreSQL support for log_lock_waits and deadlock_timeout
- Added PostgreSQL support for track_io_timing
10.0.2
- Fix an issue where enabling a GitLab Geo role would also disable all default services

View File

@ -1023,6 +1023,10 @@ external_url 'GENERATED_EXTERNAL_URL'
# gitlab_pages['dir'] = "/var/opt/gitlab/gitlab-pages"
# gitlab_pages['log_directory'] = "/var/log/gitlab/gitlab-pages"
# gitlab_pages['artifacts_server'] = true
# gitlab_pages['artifacts_server_url'] = nil # Defaults to external_url + '/api/v4'
# gitlab_pages['artifacts_server_timeout'] = 10
##! Prometheus metrics for Pages docs: https://gitlab.com/gitlab-org/gitlab-pages/#enable-prometheus-metrics
# gitlab_pages['metrics_address'] = ":9235"

View File

@ -542,6 +542,9 @@ default['gitlab']['gitlab-pages']['redirect_http'] = false
default['gitlab']['gitlab-pages']['use_http2'] = true
default['gitlab']['gitlab-pages']['dir'] = "/var/opt/gitlab/gitlab-pages"
default['gitlab']['gitlab-pages']['log_directory'] = "/var/log/gitlab/gitlab-pages"
default['gitlab']['gitlab-pages']['artifacts_server'] = true
default['gitlab']['gitlab-pages']['artifacts_server_url'] = nil
default['gitlab']['gitlab-pages']['artifacts_server_timeout'] = 10
####
# Nginx

View File

@ -69,6 +69,7 @@ module GitlabPages
end
Gitlab['gitlab_pages']['pages_root'] ||= (Gitlab['gitlab_rails']['pages_path'] || File.join(Gitlab['gitlab_rails']['shared_path'], 'pages'))
Gitlab['gitlab_pages']['artifacts_server_url'] ||= Gitlab['external_url'].chomp('/') + '/api/v4'
end
end
end

View File

@ -235,6 +235,7 @@ templatesymlink "Create a gitlab.yml and create a symlink to Rails root" do
builds_directory: gitlab_ci_builds_dir,
pages_external_http: node['gitlab']['gitlab-pages']['external_http'],
pages_external_https: node['gitlab']['gitlab-pages']['external_https'],
pages_artifacts_server: node['gitlab']['gitlab-pages']['artifacts_server'],
mattermost_host: mattermost_host,
mattermost_enabled: node['gitlab']['mattermost']['enable'] || !mattermost_host.nil?
)

View File

@ -162,6 +162,7 @@ production: &base
https: <%= @pages_https %>
external_http: <%= @pages_external_http.to_json %>
external_https: <%= @pages_external_https.to_json %>
artifacts_server: <%= @pages_artifacts_server %>
## Gravatar
## For Libravatar see: https://docs.gitlab.com/ce/customization/libravatar.html

View File

@ -36,3 +36,10 @@ exec /opt/gitlab/embedded/bin/gitlab-pages \
\
-redirect-http=<%= node['gitlab']['gitlab-pages']['redirect_http'] %> \
-use-http2=<%= node['gitlab']['gitlab-pages']['use_http2'] %> \
\
<% if node['gitlab']['gitlab-pages']['artifacts_server'] %>
-artifacts-server="<%= node['gitlab']['gitlab-pages']['artifacts_server_url'] %>" \
<% if node['gitlab']['gitlab-pages']['artifacts_server_timeout'] %>
-artifacts-server-timeout=<%= node['gitlab']['gitlab-pages']['artifacts_server_timeout'] %> \
<% end %>
<% end %>

View File

@ -9,7 +9,10 @@ describe 'gitlab::gitlab-pages' do
context 'with defaults' do
before do
stub_gitlab_rb(pages_external_url: 'https://pages.example.com')
stub_gitlab_rb(
external_url: 'https://gitlab.example.com',
pages_external_url: 'https://pages.example.com'
)
end
it 'correctly renders the pages service run file' do
@ -20,6 +23,8 @@ describe 'gitlab::gitlab-pages' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-pages-domain="pages.example.com"})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-redirect-http=false})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-use-http2=true})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server="https://gitlab.example.com/api/v4"})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server-timeout=10})
expect(chef_run).not_to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-listen-http})
expect(chef_run).not_to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-listen-https})
@ -32,13 +37,16 @@ describe 'gitlab::gitlab-pages' do
context 'with user settings' do
before do
stub_gitlab_rb(
external_url: 'https://gitlab.example.com',
pages_external_url: 'https://pages.example.com',
gitlab_pages: {
external_http: ['external_pages.example.com', 'localhost:9000'],
external_https: ['external_pages.example.com', 'localhost:9001'],
metrics_address: 'localhost:1234',
redirect_http: true,
cert: '/etc/gitlab/pages.crt'
cert: '/etc/gitlab/pages.crt',
artifacts_server_url: "https://gitlab.elsewhere.com/api/v5",
artifacts_server_timeout: 60
}
)
end
@ -58,6 +66,28 @@ describe 'gitlab::gitlab-pages' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-listen-https="external_pages.example.com"})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-listen-https="localhost:9001"})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-root-key})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server="https://gitlab.elsewhere.com/api/v5"})
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server-timeout=60})
end
end
context 'with artifacts server disabled' do
before do
stub_gitlab_rb(
external_url: 'https://gitlab.example.com',
pages_external_url: 'https://pages.example.com',
gitlab_pages: {
artifacts_server: false,
artifacts_server_url: 'https://gitlab.elsewhere.com/api/v5',
artifacts_server_timeout: 60
}
)
end
it 'correctly renders the pages service run file' do
expect(chef_run).to render_file("/opt/gitlab/sv/gitlab-pages/run")
expect(chef_run).not_to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server=})
expect(chef_run).not_to render_file("/opt/gitlab/sv/gitlab-pages/run").with_content(%r{-artifacts-server-timeout=})
end
end
end