mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
Since we no longer support Ubuntu Trusty, we no longer need this backwards-compatibility cruft (which we only kept around to avoid randomizing configuration for existing systems).
47 lines
1.9 KiB
Puppet
47 lines
1.9 KiB
Puppet
# postgres_appdb_tuned extends postgres_appdb_base by automatically
|
|
# generating tuned database configuration.
|
|
class zulip::postgres_appdb_tuned {
|
|
include zulip::postgres_appdb_base
|
|
|
|
$postgres_conf = $::osfamily ? {
|
|
'debian' => "/etc/postgresql/${zulip::base::postgres_version}/main/postgresql.conf",
|
|
'redhat' => "/var/lib/pgsql/${zulip::base::postgres_version}/data/postgresql.conf",
|
|
}
|
|
$postgres_restart = $::osfamily ? {
|
|
'debian' => "pg_ctlcluster ${zulip::base::postgres_version} main restart",
|
|
'redhat' => "systemctl restart postgresql-${zulip::base::postgres_version}",
|
|
}
|
|
|
|
$half_memory = $zulip::base::total_memory / 2
|
|
$half_memory_pages = $half_memory / 4096
|
|
|
|
$work_mem = $zulip::base::total_memory_mb / 512
|
|
$shared_buffers = $zulip::base::total_memory_mb / 8
|
|
$effective_cache_size = $zulip::base::total_memory_mb * 10 / 32
|
|
$maintenance_work_mem = $zulip::base::total_memory_mb / 32
|
|
|
|
$random_page_cost = zulipconf('postgresql', 'random_page_cost', undef)
|
|
$effective_io_concurrency = zulipconf('postgresql', 'effective_io_concurrency', undef)
|
|
$replication = zulipconf('postgresql', 'replication', undef)
|
|
$listen_addresses = zulipconf('postgresql', 'listen_addresses', undef)
|
|
|
|
$ssl_cert_file = zulipconf('postgresql', 'ssl_cert_file', undef)
|
|
$ssl_key_file = zulipconf('postgresql', 'ssl_key_file', undef)
|
|
$ssl_ca_file = zulipconf('postgresql', 'ssl_ca_file', undef)
|
|
|
|
file { $postgres_conf:
|
|
ensure => file,
|
|
require => Package[$zulip::postgres_appdb_base::postgresql],
|
|
owner => 'postgres',
|
|
group => 'postgres',
|
|
mode => '0644',
|
|
content => template("zulip/postgresql/${zulip::base::postgres_version}/postgresql.conf.template.erb"),
|
|
}
|
|
|
|
exec { $postgres_restart:
|
|
require => Package[$zulip::postgres_appdb_base::postgresql],
|
|
refreshonly => true,
|
|
subscribe => [ File[$postgres_conf] ]
|
|
}
|
|
}
|