diff --git a/chef/cookbooks/crowbar/recipes/default.rb b/chef/cookbooks/crowbar/recipes/default.rb index 2903f1ae0b..467e4a324f 100644 --- a/chef/cookbooks/crowbar/recipes/default.rb +++ b/chef/cookbooks/crowbar/recipes/default.rb @@ -233,6 +233,8 @@ unless node["crowbar"].nil? or node["crowbar"]["users"].nil? or node["crowbar"]["realm"].nil? web_port = node["crowbar"]["web_port"] || 3000 realm = node["crowbar"]["realm"] + workers = node["crowbar"]["workers"] || 2 + threads = node["crowbar"]["threads"] || 16 users = {} node["crowbar"]["users"].each do |k,h| @@ -252,6 +254,8 @@ else web_port = 3000 realm = nil + workers = 2 + threads = 16 end # Remove rainbows configuration, dating from before the switch to puma @@ -267,6 +271,8 @@ variables( web_host: "127.0.0.1", web_port: web_port, + workers: workers, + threads: threads ) end diff --git a/chef/cookbooks/crowbar/templates/default/sysconfig.crowbar.erb b/chef/cookbooks/crowbar/templates/default/sysconfig.crowbar.erb index a87668dfd5..b1fd33fcc8 100644 --- a/chef/cookbooks/crowbar/templates/default/sysconfig.crowbar.erb +++ b/chef/cookbooks/crowbar/templates/default/sysconfig.crowbar.erb @@ -14,7 +14,7 @@ CROWBAR_ENV="production" ## Default: 16 ## ServiceRestart: crowbar # Sets the maximum number of threads used by the web server. -CROWBAR_THREADS="16" +CROWBAR_THREADS="<%= @threads %>" ## Path: Crowbar ## Description: Maximum number of worker processes @@ -23,7 +23,7 @@ CROWBAR_THREADS="16" ## ServiceRestart: crowbar # Sets the maximum number of separate worker processes spawned by the # web server. -CROWBAR_WORKERS="2" +CROWBAR_WORKERS="<%= @workers %>" ## Path: Crowbar ## Description: Listen address @@ -40,4 +40,3 @@ CROWBAR_LISTEN="<%= @web_host %>" ## ServiceRestart: crowbar # Port which Crowbar listens to. CROWBAR_PORT=<%= @web_port %> - diff --git a/chef/data_bags/crowbar/migrate/crowbar/101_crowbar-workers-and-threads.rb b/chef/data_bags/crowbar/migrate/crowbar/101_crowbar-workers-and-threads.rb new file mode 100644 index 0000000000..c405fa681a --- /dev/null +++ b/chef/data_bags/crowbar/migrate/crowbar/101_crowbar-workers-and-threads.rb @@ -0,0 +1,11 @@ +def upgrade(ta, td, a, d) + a["workers"] = ta["workers"] + a["threads"] = ta["threads"] + return a, d +end + +def downgrade(ta, td, a, d) + a.delete("workers") + a.delete("threads") + return a, d +end diff --git a/chef/data_bags/crowbar/template-crowbar.json b/chef/data_bags/crowbar/template-crowbar.json index c4b3a7c5f3..1cfc26c82c 100644 --- a/chef/data_bags/crowbar/template-crowbar.json +++ b/chef/data_bags/crowbar/template-crowbar.json @@ -14,6 +14,8 @@ }, "realm": "Crowbar - By selecting OK you are agreeing to the License Agreement", "web_port": 3000, + "workers": 2, + "threads": 16, "users": { "machine-install": { "password": "machine_password" }, "crowbar": { "password": "crowbar" } @@ -28,7 +30,7 @@ "crowbar": { "crowbar-revision": 0, "crowbar-applied": false, - "schema-revision": 100, + "schema-revision": 101, "element_states": { "crowbar": [ "all" ], "crowbar-upgrade": [ "readying", "ready", "applying", "crowbar_upgrade" ] diff --git a/chef/data_bags/crowbar/template-crowbar.schema b/chef/data_bags/crowbar/template-crowbar.schema index e40015692a..65f55993ca 100644 --- a/chef/data_bags/crowbar/template-crowbar.schema +++ b/chef/data_bags/crowbar/template-crowbar.schema @@ -11,9 +11,11 @@ } }, "web_port": { "type": "int", "required": true }, + "workers": { "type": "int", "required": true }, + "threads": { "type": "int", "required": true }, "realm": { "type": "str", "required": false }, "users": { "type": "map", "required": true, "mapping": { - = : { "type": "map", "required": true, "mapping": { + = : { "type": "map", "required": true, "mapping": { "password": { "type": "str" }, "digest": { "type": "str" }, "disabled": { "type": "bool" } diff --git a/crowbar_framework/spec/fixtures/data_bags/template-crowbar.json b/crowbar_framework/spec/fixtures/data_bags/template-crowbar.json index 6f60f2d67b..9558d498dc 100644 --- a/crowbar_framework/spec/fixtures/data_bags/template-crowbar.json +++ b/crowbar_framework/spec/fixtures/data_bags/template-crowbar.json @@ -16,6 +16,8 @@ }, "realm": "Crowbar - By selecting OK you are agreeing to the License Agreement", "web_port": 3000, + "workers": 2, + "threads": 16, "users": { "machine-install": { "password": "machine_password" }, "crowbar": { "password": "crowbar" } @@ -46,4 +48,3 @@ } } } -