mirror of https://github.com/zulip/zulip.git
puppet: Inline all sysctl settings, and always check for containers.
This commit is contained in:
parent
fd69f5f8e2
commit
069f262e7b
|
@ -206,8 +206,9 @@ class zulip::app_frontend_base {
|
||||||
notify => Service[$zulip::common::supervisor_service],
|
notify => Service[$zulip::common::supervisor_service],
|
||||||
}
|
}
|
||||||
zulip::sysctl { 'uwsgi':
|
zulip::sysctl { 'uwsgi':
|
||||||
content => template('zulip/sysctl.d/40-uwsgi.conf.erb'),
|
comment => 'Allow larger listen backlog',
|
||||||
skip_docker => true,
|
key => 'net.core.somaxconn',
|
||||||
|
value => $somaxconn,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { [
|
file { [
|
||||||
|
|
|
@ -1,25 +1,31 @@
|
||||||
# @summary Adds a sysctl file, and immediately runs it.
|
# @summary Adds a sysctl file, and immediately runs it.
|
||||||
define zulip::sysctl (
|
define zulip::sysctl (
|
||||||
$source = undef,
|
$key,
|
||||||
$content = undef,
|
$value,
|
||||||
$skip_docker = false,
|
$order = 40,
|
||||||
|
$comment = '',
|
||||||
) {
|
) {
|
||||||
file { "/etc/sysctl.d/40-${name}.conf":
|
if $comment == '' {
|
||||||
|
$content = "${key} = ${value}\n"
|
||||||
|
} else {
|
||||||
|
$content = "# ${comment}\n${key} = ${value}\n"
|
||||||
|
}
|
||||||
|
file { "/etc/sysctl.d/${order}-${name}.conf":
|
||||||
ensure => file,
|
ensure => file,
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => 'root',
|
||||||
mode => '0644',
|
mode => '0644',
|
||||||
source => $source,
|
|
||||||
content => $content,
|
content => $content,
|
||||||
}
|
}
|
||||||
$onlyif = $skip_docker ? {
|
|
||||||
true => 'touch /proc/sys/net/core/somaxconn',
|
# Try to touch the procfile before trying to adjust it -- if we're
|
||||||
default => undef,
|
# in a containerized environment, failure to set this is not a fatal
|
||||||
}
|
# exception.
|
||||||
|
$procpath = regsubst($key, '\.', '/')
|
||||||
exec { "sysctl_p_${name}":
|
exec { "sysctl_p_${name}":
|
||||||
command => "/sbin/sysctl -p /etc/sysctl.d/40-${name}.conf",
|
command => "/sbin/sysctl -p /etc/sysctl.d/${order}-${name}.conf",
|
||||||
subscribe => File["/etc/sysctl.d/40-${name}.conf"],
|
subscribe => File["/etc/sysctl.d/${order}-${name}.conf"],
|
||||||
refreshonly => true,
|
refreshonly => true,
|
||||||
onlyif => $onlyif,
|
onlyif => "touch /proc/sys/${procpath}",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Allow larger listen backlog
|
|
||||||
net.core.somaxconn=<%= [128, @somaxconn].max %>
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Virtual memory settings
|
|
||||||
vm.swappiness = 0
|
|
||||||
vm.overcommit_memory = 2
|
|
|
@ -9,8 +9,13 @@ class zulip_ops::profile::postgresql inherits zulip_ops::profile::base {
|
||||||
|
|
||||||
zulip_ops::firewall_allow{ 'postgresql': }
|
zulip_ops::firewall_allow{ 'postgresql': }
|
||||||
|
|
||||||
zulip::sysctl { 'postgresql':
|
zulip::sysctl { 'postgresql-swappiness':
|
||||||
source => 'puppet:///modules/zulip_ops/postgresql/40-postgresql.conf',
|
key => 'vm.swappiness',
|
||||||
|
value => '0',
|
||||||
|
}
|
||||||
|
zulip::sysctl { 'postgresql-overcommit':
|
||||||
|
key => 'vm.overcommit_memory',
|
||||||
|
value => '2',
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/root/setup_disks.sh':
|
file { '/root/setup_disks.sh':
|
||||||
|
|
|
@ -9,9 +9,10 @@ class zulip_ops::profile::prod_app_frontend inherits zulip_ops::profile::base {
|
||||||
keys => 'internal-limited-write-deploy-key',
|
keys => 'internal-limited-write-deploy-key',
|
||||||
}
|
}
|
||||||
|
|
||||||
$conntrack_max = zulipconf('application_server', 'conntrack_max', 262144)
|
|
||||||
zulip::sysctl { 'conntrack':
|
zulip::sysctl { 'conntrack':
|
||||||
content => template('zulip_ops/sysctl.d/40-conntrack.conf.erb'),
|
comment => 'Increase conntrack kernel table size',
|
||||||
|
key => 'net.nf_conntrack_max',
|
||||||
|
value => zulipconf('application_server', 'conntrack_max', 262144),
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/nginx/sites-available/zulip':
|
file { '/etc/nginx/sites-available/zulip':
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Increase conntrack kernel table size
|
|
||||||
net.nf_conntrack_max=<%= @conntrack_max %>
|
|
Loading…
Reference in New Issue