Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

puppet: Make nginx worker_processes a config setting.

Alex Vandiver172c52f66f13
diff --git a/docs/production/system-configuration.md b/docs/production/system-configuration.md
index c1f95a24e9a..a250d6033ad 100644
--- a/docs/production/system-configuration.md
+++ b/docs/production/system-configuration.md
@@ -104,13 +104,21 @@ SSL/TLS termination.
Set to the port number if you [prefer to listen on a port other than
443](deployment.md#using-an-alternate-port).
+#### `nginx_worker_processes`
+
+Adjusts the [`worker_processes`][nginx_worker_processes] setting in
+the nginx server. This defaults to `auto`, which nginx treats as the
+number of available CPU cores.
+
+[nginx_worker_processes]: https://nginx.org/en/docs/ngx_core_module.html#worker_processes
+
#### `nginx_worker_connections`
Adjust the [`worker_connections`][nginx_worker_connections] setting in
the nginx server. This defaults to 10000; increasing it allows more
-concurrent connections per CPU core, at the cost of more memory
-consumed by NGINX. This number, times the number of CPU cores, should
-be more than twice the concurrent number of users.
+concurrent connections per worker process, at the cost of more memory
+consumed by nginx. This number, times the number of worker processes
+(above), should be more than twice the concurrent number of users.
[nginx_worker_connections]: http://nginx.org/en/docs/ngx_core_module.html#worker_connections
diff --git a/puppet/zulip/manifests/nginx.pp b/puppet/zulip/manifests/nginx.pp
index 148395cda96..c507010f3ef 100644
--- a/puppet/zulip/manifests/nginx.pp
+++ b/puppet/zulip/manifests/nginx.pp
@@ -45,6 +45,7 @@ class zulip::nginx {
} else {
$ca_crt = '/etc/pki/tls/certs/ca-bundle.crt'
}
+ $worker_processes = zulipconf('application_server', 'nginx_worker_processes', 'auto')
$worker_connections = zulipconf('application_server', 'nginx_worker_connections', 10000)
file { '/etc/nginx/nginx.conf':
ensure => file,
diff --git a/puppet/zulip/templates/nginx.conf.template.erb b/puppet/zulip/templates/nginx.conf.template.erb
index 2e4c0650f73..e126170726a 100644
--- a/puppet/zulip/templates/nginx.conf.template.erb
+++ b/puppet/zulip/templates/nginx.conf.template.erb
@@ -1,6 +1,6 @@
user zulip;
-worker_processes auto;
+worker_processes <%= @worker_processes %>;
pid /var/run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;