Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new config attribute for Puma #378

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jobs/cloud_controller_ng/spec
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,9 @@ properties:
description: "Maximum number of threads per Puma webserver worker."
default: 2

cc.puma.max_db_connections_per_process:
description: "Maximum database connections for Puma per process (main + Puma workers), if not set the ccng value is used (default)"

cc.update_metric_tags_on_rename:
description: "Enable sending a Desired LRP update when an app is renamed"
default: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ webserver: <%= p("cc.experimental.use_puma_webserver") ? 'puma' : 'thin' %>
puma:
workers: <%= p("cc.puma.workers") %>
max_threads: <%= p("cc.puma.max_threads") %>
<% if_p("cc.puma.max_db_connections_per_process") do |max_db_conn_per_process| %>
max_db_connections_per_process: <%= max_db_conn_per_process %>
<% end %>
pid_filename: /var/vcap/data/cloud_controller_ng/cloud_controller_ng.pid
newrelic_enabled: <%= !!properties.cc.newrelic.license_key || p("cc.development_mode") %>
development_mode: <%= p("cc.development_mode") %>
Expand Down
20 changes: 20 additions & 0 deletions spec/cloud_controller_ng/cloud_controller_ng_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,26 @@ module Test
end
end
end

describe 'max_db_connections_per_process' do
context "when 'cc.puma.max_db_connections_per_process' is set" do
before do
merged_manifest_properties['cc']['puma'] = { 'max_db_connections_per_process' => 10 }
end

it 'renders the correct value into the ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['puma']['max_db_connections_per_process']).to be(10)
end
end

context 'when cc.puma.max_db_connections_per_process is not set' do
it 'does not render max_db_connections_per_process into the ccng config' do
template_hash = YAML.safe_load(template.render(merged_manifest_properties, consumes: links))
expect(template_hash['puma']).not_to have_key(:max_db_connections_per_process)
end
end
end
end
end
end
Expand Down