Skip to content
Snippets Groups Projects
Commit 03c7842d authored by Yorick Peterse's avatar Yorick Peterse Committed by Marin Jankovski
Browse files

Added support for configuring DB load balancing

parent fab69bb6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -32,6 +32,7 @@ are not the same (O Schwede) c4e83c5
- Provide default Host header for requests that do not have one 14f77c
- Gitaly service on by default 350dea
- Update Nginx to 1.10.3
- Added support for configuring hosts for database load balancing
 
8.17.3
 
Loading
Loading
Loading
Loading
@@ -1458,3 +1458,9 @@ external_url 'GENERATED_EXTERNAL_URL'
# "process_commit,post_receive",
# "gitlab_shell"
# ]
#
################################################################################
# Additional Database Settings (EE only)
################################################################################
# gitlab_rails['db_load_balancing'] = { 'hosts' => ['secondary1.example.com'] }
Loading
Loading
@@ -237,6 +237,7 @@ default['gitlab']['gitlab-rails']['db_database'] = "gitlabhq_production"
default['gitlab']['gitlab-rails']['db_pool'] = 10
default['gitlab']['gitlab-rails']['db_username'] = "gitlab"
default['gitlab']['gitlab-rails']['db_password'] = nil
default['gitlab']['gitlab-rails']['db_load_balancing'] = { 'hosts' => [] }
# Path to postgresql socket directory
default['gitlab']['gitlab-rails']['db_host'] = "/var/opt/gitlab/postgresql"
default['gitlab']['gitlab-rails']['db_port'] = 5432
Loading
Loading
Loading
Loading
@@ -16,3 +16,4 @@ production:
sslmode: <%= single_quote(@db_sslmode) %>
sslrootcert: <%= single_quote(@db_sslrootcert) || single_quote(@db_sslca) %>
sslca: <%= single_quote(@db_sslca) || single_quote(@db_sslrootcert) %>
load_balancing: <%= @db_load_balancing.to_json %>
Loading
Loading
@@ -294,6 +294,7 @@ describe 'gitlab::gitlab-rails' do
)
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-rails/etc/database.yml').with_content(/host: \'\/var\/opt\/gitlab\/postgresql\'/)
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-rails/etc/database.yml').with_content(/database: gitlabhq_production/)
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-rails/etc/database.yml').with_content(/load_balancing: {"hosts":\[\]}/)
end
 
it 'template triggers notifications' do
Loading
Loading
@@ -362,6 +363,16 @@ describe 'gitlab::gitlab-rails' do
expect(templatesymlink_link).to_not notify('service[nginx]').to(:restart).delayed
end
end
context 'when load balancers are specified' do
before do
stub_gitlab_rb(gitlab_rails: { db_load_balancing: { 'hosts' => ['primary.example.com', 'secondary.example.com']} })
end
it 'uses provided value in database.yml' do
expect(chef_run).to render_file('/var/opt/gitlab/gitlab-rails/etc/database.yml').with_content(/load_balancing: {"hosts":\["primary.example.com","secondary.example.com"\]}/)
end
end
end
end
 
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