puppet: Pull postgres config directory into postgres_appdb_base.

As the previous commit, this is currently only used in tuning, but is
a property of the whole postgres configuration; move it there, as just
the directory, not the file.

Use this directory consistently in the erb templates.  Since we
produce a `pg_hba.conf`, it makes sense that we point to the path that we
know that we explicitly wrote to, for instance.
This commit is contained in:
Alex Vandiver 2020-06-11 19:52:33 -07:00 committed by Tim Abbott
parent 2a7373b602
commit 16c4cea951
11 changed files with 21 additions and 22 deletions

View File

@ -9,6 +9,7 @@ class zulip::postgres_appdb_base {
include zulip::apt_repository
$postgresql = "postgresql-${zulip::base::postgres_version}"
$postgres_sharedir = "/usr/share/postgresql/${zulip::base::postgres_version}"
$postgres_confdir = "/etc/postgresql/${zulip::base::postgres_version}/main"
$tsearch_datadir = "${postgres_sharedir}/tsearch_data"
$pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql"
$setup_system_deps = 'setup_apt_repo'
@ -18,6 +19,7 @@ class zulip::postgres_appdb_base {
include zulip::yum_repository
$postgresql = "postgresql${zulip::base::postgres_version}"
$postgres_sharedir = "/usr/pgsql-${zulip::base::postgres_version}/share"
$postgres_confdir = "/var/lib/pgsql/${zulip::base::postgres_version}/data"
$tsearch_datadir = "${postgres_sharedir}/tsearch_data/"
$pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql"
$setup_system_deps = 'setup_yum_repo'

View File

@ -3,10 +3,6 @@
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",
}
$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
@ -24,7 +20,8 @@ class zulip::postgres_appdb_tuned {
# Only used in CentOS for now
$pg_datadir = "/var/lib/pgsql/${zulip::base::postgres_version}/data"
file { $postgres_conf:
$postgres_conf_file = "${zulip::postgres_appdb_base::postgres_confdir}/postgresql.conf"
file { $postgres_conf_file:
ensure => file,
require => Package[$zulip::postgres_appdb_base::postgresql],
owner => 'postgres',
@ -36,6 +33,6 @@ class zulip::postgres_appdb_tuned {
exec { $zulip::postgres_appdb_base::postgres_restart:
require => Package[$zulip::postgres_appdb_base::postgresql],
refreshonly => true,
subscribe => [ File[$postgres_conf] ]
subscribe => [ File[$postgres_conf_file] ]
}
}

View File

@ -40,9 +40,9 @@
data_directory = '<%= scope["zulip::postgres_appdb_tuned::pg_datadir"] %>' # use data in another directory
# (change requires restart)
hba_file = '<%= scope["zulip::postgres_appdb_tuned::pg_datadir"] %>/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '<%= scope["zulip::postgres_appdb_tuned::pg_datadir"] %>/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -40,9 +40,9 @@
data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory
# (change requires restart)
hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file
hba_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_ident.conf' # ident configuration file
ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.

View File

@ -2,7 +2,7 @@ class zulip_ops::postgres_appdb {
include zulip_ops::postgres_common
include zulip::postgres_appdb_tuned
file { "/etc/postgresql/${zulip::base::postgres_version}/main/pg_hba.conf":
file { "${zulip::postgres_appdb_base::postgres_confdir}/pg_hba.conf":
ensure => file,
require => Package["postgresql-${zulip::base::postgres_version}"],
owner => 'postgres',

View File

@ -2,7 +2,7 @@ class zulip_ops::postgres_slave {
include zulip_ops::base
include zulip_ops::postgres_appdb
file { "/var/lib/postgresql/${zulip::base::postgres_version}/main/recovery.conf":
file { "${zulip::postgres_appdb_base::postgres_confdir}/recovery.conf":
ensure => file,
require => Package["postgresql-${zulip::base::postgres_version}"],
owner => 'postgres',