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: Pull postgres config directory into postgres_appdb_base.

Alex Vandiver16c4cea951ae
diff --git a/puppet/zulip/manifests/postgres_appdb_base.pp b/puppet/zulip/manifests/postgres_appdb_base.pp
index 2eb138c2167..2a0b95d11e6 100644
--- a/puppet/zulip/manifests/postgres_appdb_base.pp
+++ b/puppet/zulip/manifests/postgres_appdb_base.pp
@@ -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'
diff --git a/puppet/zulip/manifests/postgres_appdb_tuned.pp b/puppet/zulip/manifests/postgres_appdb_tuned.pp
index d2cb7216e49..aa50f86434a 100644
--- a/puppet/zulip/manifests/postgres_appdb_tuned.pp
+++ b/puppet/zulip/manifests/postgres_appdb_tuned.pp
@@ -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] ]
}
}
diff --git a/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb b/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb
index c27c584bbf0..cfe5420e54b 100644
--- a/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb
+++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
index c5d4c7b0a89..50775ca7f34 100644
--- a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
index c5d4c7b0a89..50775ca7f34 100644
--- a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
index d9e2ff2e2e3..04708bc7175 100644
--- a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb
index 530d7f84e5b..6d722e22c1d 100644
--- a/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb
index a89ce9db3d6..1765cc22717 100644
--- a/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb
index 20473051ce6..d9be00be43b 100644
--- a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb
@@ -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.
diff --git a/puppet/zulip_ops/manifests/postgres_appdb.pp b/puppet/zulip_ops/manifests/postgres_appdb.pp
index b8fa1dfbee9..7eb28fc42ad 100644
--- a/puppet/zulip_ops/manifests/postgres_appdb.pp
+++ b/puppet/zulip_ops/manifests/postgres_appdb.pp
@@ -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',
diff --git a/puppet/zulip_ops/manifests/postgres_slave.pp b/puppet/zulip_ops/manifests/postgres_slave.pp
index 4f2dbac0ede..fc76e4f253a 100644
--- a/puppet/zulip_ops/manifests/postgres_slave.pp
+++ b/puppet/zulip_ops/manifests/postgres_slave.pp
@@ -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',