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: Increase backlogged socket count based on uwsgi backlog.

Alex Vandiverceb909dbc575
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index b089a3c349a..29bf0715e80 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -96,6 +96,7 @@ class zulip::app_frontend_base {
$uwsgi_listen_backlog_limit = zulipconf('application_server', 'uwsgi_listen_backlog_limit', 128)
$uwsgi_buffer_size = zulipconf('application_server', 'uwsgi_buffer_size', 8192)
$uwsgi_processes = zulipconf('application_server', 'uwsgi_processes', $uwsgi_default_processes)
+ $somaxconn = 2 * $uwsgi_listen_backlog_limit
file { '/etc/zulip/uwsgi.ini':
ensure => file,
require => Package[supervisor],
@@ -105,6 +106,21 @@ class zulip::app_frontend_base {
content => template('zulip/uwsgi.ini.template.erb'),
notify => Service[$zulip::common::supervisor_service],
}
+ file { '/etc/sysctl.d/40-uwsgi.conf':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ content => template('zulip/sysctl.d/40-uwsgi.conf.erb'),
+ }
+ exec { 'sysctl_p_uwsgi':
+ command => '/sbin/sysctl -p /etc/sysctl.d/40-uwsgi.conf',
+ subscribe => File['/etc/sysctl.d/40-uwsgi.conf'],
+ refreshonly => true,
+ # We have to protect against running in Docker and other
+ # containerization which prevents adjusting these.
+ onlyif => 'touch /proc/sys/net/core/somaxconn',
+ }
file { '/home/zulip/tornado':
ensure => directory,
diff --git a/puppet/zulip/templates/sysctl.d/40-uwsgi.conf.erb b/puppet/zulip/templates/sysctl.d/40-uwsgi.conf.erb
new file mode 100644
index 00000000000..ee729a9b541
--- /dev/null
+++ b/puppet/zulip/templates/sysctl.d/40-uwsgi.conf.erb
@@ -0,0 +1,2 @@
+# Allow larger listen backlog
+net.core.somaxconn=<%= [128, @somaxconn].max %>