Skip to content
Snippets Groups Projects
Commit bc9b6438 authored by Vladimir Shushlin's avatar Vladimir Shushlin
Browse files

Add object storage settings for GitLab Pages

parent 8079384d
No related branches found
No related tags found
No related merge requests found
---
title: Add pages object storage settings
merge_request: 4623
author:
type: added
Loading
Loading
@@ -289,6 +289,7 @@ gitlab_rails['object_store']['objects']['uploads']['bucket'] = nil
gitlab_rails['object_store']['objects']['packages']['bucket'] = nil
gitlab_rails['object_store']['objects']['dependency_proxy']['bucket'] = nil
gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = nil
gitlab_rails['object_store']['objects']['pages']['bucket'] = nil
 
### Job Artifacts
# gitlab_rails['artifacts_enabled'] = true
Loading
Loading
@@ -1516,6 +1517,21 @@ gitlab_rails['object_store']['objects']['terraform_state']['bucket'] = nil
# 'SSL_CERT_DIR' => "#{node['package']['install-dir']}/embedded/ssl/certs/"
# }
 
##! Object storage settings
# gitlab_pages['object_store_enabled'] = false
# gitlab_pages['object_store_remote_directory'] = "pages"
# gitlab_pages['object_store_connection'] = {
# 'provider' => 'AWS',
# 'region' => 'eu-west-1',
# 'aws_access_key_id' => 'AWS_ACCESS_KEY_ID',
# 'aws_secret_access_key' => 'AWS_SECRET_ACCESS_KEY',
# # # The below options configure an S3 compatible host instead of AWS
# # 'host' => 's3.amazonaws.com',
# # 'aws_signature_version' => 4, # For creation of signed URLs. Set to 2 if provider does not support v4.
# # 'endpoint' => 'https://s3.amazonaws.com', # default: nil - Useful for S3 compliant services such as DigitalOcean Spaces
# # 'path_style' => false # Use 'host/bucket_name/object' instead of 'bucket_name.host/object'
# }
################################################################################
## GitLab Pages NGINX
################################################################################
Loading
Loading
Loading
Loading
@@ -187,6 +187,8 @@ default['gitlab']['gitlab-rails']['object_store']['objects']['dependency_proxy']
default['gitlab']['gitlab-rails']['object_store']['objects']['dependency_proxy']['bucket'] = nil
default['gitlab']['gitlab-rails']['object_store']['objects']['terraform_state'] = {}
default['gitlab']['gitlab-rails']['object_store']['objects']['terraform_state']['bucket'] = nil
default['gitlab']['gitlab-rails']['object_store']['objects']['pages'] = {}
default['gitlab']['gitlab-rails']['object_store']['objects']['pages']['bucket'] = nil
 
default['gitlab']['gitlab-rails']['artifacts_enabled'] = true
default['gitlab']['gitlab-rails']['artifacts_path'] = nil
Loading
Loading
@@ -684,6 +686,9 @@ default['gitlab']['gitlab-pages']['gitlab_client_http_timeout'] = nil
default['gitlab']['gitlab-pages']['gitlab_client_jwt_expiry'] = nil
default['gitlab']['gitlab-pages']['domain_config_source'] = nil
default['gitlab']['gitlab-pages']['env_directory'] = '/opt/gitlab/etc/gitlab-pages/env'
default['gitlab']['gitlab-pages']['object_store_enabled'] = false
default['gitlab']['gitlab-pages']['object_store_remote_directory'] = 'pages'
default['gitlab']['gitlab-pages']['object_store_connection'] = {}
 
####
# Nginx
Loading
Loading
Loading
Loading
@@ -298,6 +298,9 @@ templatesymlink "Create a gitlab.yml and create a symlink to Rails root" do
pages_external_https: node['gitlab']['gitlab-pages']['external_https'],
pages_artifacts_server: node['gitlab']['gitlab-pages']['artifacts_server'],
pages_access_control: node['gitlab']['gitlab-pages']['access_control'],
pages_object_store_enabled: node['gitlab']['gitlab-pages']['object_store_enabled'],
pages_object_store_remote_directory: node['gitlab']['gitlab-pages']['object_store_remote_directory'],
pages_object_store_connection: node['gitlab']['gitlab-pages']['object_store_connection'],
mattermost_host: mattermost_host,
mattermost_enabled: node['mattermost']['enable'] || !mattermost_host.nil?,
sidekiq: node['gitlab']['sidekiq'],
Loading
Loading
Loading
Loading
@@ -336,6 +336,10 @@ production: &base
external_http: <%= @pages_external_http.to_json %>
external_https: <%= @pages_external_https.to_json %>
artifacts_server: <%= @pages_artifacts_server %>
object_store:
enabled: <%= @pages_object_store_enabled %>
remote_directory: <%= quote(@pages_object_store_remote_directory) %>
connection: <%= @pages_object_store_connection.to_json %>
 
## Gravatar
## For Libravatar see: https://docs.gitlab.com/ee/customization/libravatar.html
Loading
Loading
Loading
Loading
@@ -734,6 +734,37 @@ RSpec.describe 'gitlab::gitlab-rails' do
end
end
 
context 'for settings regarding object storage for pages' do
it 'allows not setting any values' do
expect(chef_run).to create_templatesymlink('Create a gitlab.yml and create a symlink to Rails root').with_variables(
hash_including(
pages_object_store_enabled: false,
pages_object_store_remote_directory: 'pages'
)
)
end
context 'with values' do
before do
stub_gitlab_rb(gitlab_pages: {
object_store_enabled: true,
object_store_remote_directory: 'pagescustomdir',
object_store_connection: aws_connection_hash
})
end
it "sets the object storage values" do
expect(chef_run).to create_templatesymlink('Create a gitlab.yml and create a symlink to Rails root').with_variables(
hash_including(
pages_object_store_enabled: true,
pages_object_store_remote_directory: 'pagescustomdir',
pages_object_store_connection: aws_connection_hash
)
)
end
end
end
describe 'pseudonymizer settings' do
it 'allows not setting any values' do
expect(chef_run).to create_templatesymlink('Create a gitlab.yml and create a symlink to Rails root').with_variables(
Loading
Loading
Loading
Loading
@@ -10,7 +10,8 @@ RSpec.shared_context 'object storage config' do
external_diffs: { bucket: 'external_diffs' },
packages: { bucket: 'packages' },
terraform_state: { enabled: false, bucket: 'terraform' },
uploads: { bucket: 'uploads' }
uploads: { bucket: 'uploads' },
pages: { bucket: 'pages' }
}
end
let(:aws_connection_hash) do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment