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: Move postgres_version into postgres_common.

Alex Vandiver0ea20bd7d892
diff --git a/puppet/zulip/manifests/app_frontend_base.pp b/puppet/zulip/manifests/app_frontend_base.pp
index 39a219c75f4..cbe7f106796 100644
--- a/puppet/zulip/manifests/app_frontend_base.pp
+++ b/puppet/zulip/manifests/app_frontend_base.pp
@@ -12,7 +12,7 @@ class zulip::app_frontend_base {
# shell. This is not necessary on CentOS because the postgresql
# package already includes the client. This may get us a more
# recent client than the database server is configured to be,
- # ($zulip::base::postgres_version), but they're compatible.
+ # ($zulip::postgres_common::version), but they're compatible.
zulip::safepackage { 'postgresql-client': ensure => 'installed' }
}
# For Slack import
diff --git a/puppet/zulip/manifests/base.pp b/puppet/zulip/manifests/base.pp
index 9fb9d98ff44..5a78f93bf59 100644
--- a/puppet/zulip/manifests/base.pp
+++ b/puppet/zulip/manifests/base.pp
@@ -65,8 +65,6 @@ class zulip::base {
}
package { $base_packages: ensure => 'installed' }
- $postgres_version = zulipconf('postgresql', 'version', undef)
-
$total_memory_mb = Integer($::memorysize_mb);
group { 'zulip':
diff --git a/puppet/zulip/manifests/postgres_appdb_base.pp b/puppet/zulip/manifests/postgres_appdb_base.pp
index 72bd4ac41ca..3fdc85abbb4 100644
--- a/puppet/zulip/manifests/postgres_appdb_base.pp
+++ b/puppet/zulip/manifests/postgres_appdb_base.pp
@@ -5,34 +5,34 @@ class zulip::postgres_appdb_base {
case $::osfamily {
'debian': {
- $postgresql = "postgresql-${zulip::base::postgres_version}"
- $postgres_sharedir = "/usr/share/postgresql/${zulip::base::postgres_version}"
+ $postgresql = "postgresql-${zulip::postgres_common::version}"
+ $postgres_sharedir = "/usr/share/postgresql/${zulip::postgres_common::version}"
$postgres_confdirs = [
- "/etc/postgresql/${zulip::base::postgres_version}",
- "/etc/postgresql/${zulip::base::postgres_version}/main",
+ "/etc/postgresql/${zulip::postgres_common::version}",
+ "/etc/postgresql/${zulip::postgres_common::version}/main",
]
$postgres_confdir = $postgres_confdirs[-1]
- $postgres_datadir = "/var/lib/postgresql/${zulip::base::postgres_version}/main"
+ $postgres_datadir = "/var/lib/postgresql/${zulip::postgres_common::version}/main"
$tsearch_datadir = "${postgres_sharedir}/tsearch_data"
$pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql"
$setup_system_deps = 'setup_apt_repo'
- $postgres_restart = "pg_ctlcluster ${zulip::base::postgres_version} main restart"
+ $postgres_restart = "pg_ctlcluster ${zulip::postgres_common::version} main restart"
$postgres_dict_dict = '/var/cache/postgresql/dicts/en_us.dict'
$postgres_dict_affix = '/var/cache/postgresql/dicts/en_us.affix'
}
'redhat': {
- $postgresql = "postgresql${zulip::base::postgres_version}"
- $postgres_sharedir = "/usr/pgsql-${zulip::base::postgres_version}/share"
+ $postgresql = "postgresql${zulip::postgres_common::version}"
+ $postgres_sharedir = "/usr/pgsql-${zulip::postgres_common::version}/share"
$postgres_confdirs = [
- "/var/lib/pgsql/${zulip::base::postgres_version}",
- "/var/lib/pgsql/${zulip::base::postgres_version}/data",
+ "/var/lib/pgsql/${zulip::postgres_common::version}",
+ "/var/lib/pgsql/${zulip::postgres_common::version}/data",
]
$postgres_confdir = $postgres_confdirs[-1]
- $postgres_datadir = "/var/lib/pgsql/${zulip::base::postgres_version}/data"
+ $postgres_datadir = "/var/lib/pgsql/${zulip::postgres_common::version}/data"
$tsearch_datadir = "${postgres_sharedir}/tsearch_data/"
$pgroonga_setup_sql_path = "${postgres_sharedir}/pgroonga_setup.sql"
$setup_system_deps = 'setup_yum_repo'
- $postgres_restart = "systemctl restart postgresql-${zulip::base::postgres_version}"
+ $postgres_restart = "systemctl restart postgresql-${zulip::postgres_common::version}"
# TODO Since we can't find the postgres dicts directory on CentOS yet, we
# link directly to the hunspell directory.
$postgres_dict_dict = '/usr/share/myspell/en_US.dic'
diff --git a/puppet/zulip/manifests/postgres_appdb_tuned.pp b/puppet/zulip/manifests/postgres_appdb_tuned.pp
index 4fe41f555a9..d1985b26b64 100644
--- a/puppet/zulip/manifests/postgres_appdb_tuned.pp
+++ b/puppet/zulip/manifests/postgres_appdb_tuned.pp
@@ -30,7 +30,7 @@ class zulip::postgres_appdb_tuned {
owner => 'postgres',
group => 'postgres',
mode => '0644',
- content => template("zulip/postgresql/${zulip::base::postgres_version}/postgresql.conf.template.erb"),
+ content => template("zulip/postgresql/${zulip::postgres_common::version}/postgresql.conf.template.erb"),
}
exec { $zulip::postgres_appdb_base::postgres_restart:
diff --git a/puppet/zulip/manifests/postgres_common.pp b/puppet/zulip/manifests/postgres_common.pp
index 374222ad832..6edff99147e 100644
--- a/puppet/zulip/manifests/postgres_common.pp
+++ b/puppet/zulip/manifests/postgres_common.pp
@@ -1,8 +1,11 @@
class zulip::postgres_common {
include zulip::common
+
+ $version = zulipconf('postgresql', 'version', undef)
+
case $::osfamily {
'debian': {
- $postgresql = "postgresql-${zulip::base::postgres_version}"
+ $postgresql = "postgresql-${version}"
$postgres_packages = [
# The database itself
$postgresql,
@@ -23,7 +26,7 @@ class zulip::postgres_common {
]
}
'redhat': {
- $postgresql = "postgresql${zulip::base::postgres_version}"
+ $postgresql = "postgresql${version}"
$postgres_packages = [
$postgresql,
"${postgresql}-server",
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 c47f4f0775d..838be24c855 100644
--- a/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb
+++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.centos.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid'
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid'
# (change requires restart)
@@ -473,7 +473,7 @@ log_line_prefix = '%m [%p] ' # special values:
# - Process Title -
-#cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty
+#cluster_name = '<%= scope["zulip::postgres_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
diff --git a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
index ef45101ea2f..855352180ab 100644
--- a/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/10/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -473,7 +473,7 @@ log_timezone = 'UTC'
# - Process Title -
-cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty
+cluster_name = '<%= scope["zulip::postgres_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
@@ -489,7 +489,7 @@ cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
-stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pg_stat_tmp'
# - Statistics Monitoring -
diff --git a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
index ef45101ea2f..855352180ab 100644
--- a/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/11/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -473,7 +473,7 @@ log_timezone = 'UTC'
# - Process Title -
-cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty
+cluster_name = '<%= scope["zulip::postgres_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
@@ -489,7 +489,7 @@ cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
-stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pg_stat_tmp'
# - Statistics Monitoring -
diff --git a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
index 87a5c0883d1..a78474986ee 100644
--- a/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/12/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -542,7 +542,7 @@ log_timezone = 'UTC'
# PROCESS TITLE
#------------------------------------------------------------------------------
-cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty
+cluster_name = '<%= scope["zulip::postgres_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
@@ -558,7 +558,7 @@ cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
-stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pg_stat_tmp'
# - Monitoring -
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 a1c48be1103..15c3e742c62 100644
--- a/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.3/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
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 aa03f8e7f2b..f331f2ecefc 100644
--- a/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.5/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -462,7 +462,7 @@ log_timezone = 'localtime'
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
-stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pg_stat_tmp'
# - Statistics Monitoring -
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 ed5d56566fb..b94c4f785a6 100644
--- a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb
@@ -46,7 +46,7 @@ ident_file = '<%= scope["zulip::postgres_appdb_base::postgres_confdir"] %>/pg_id
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -461,7 +461,7 @@ log_timezone = 'UTC'
# - Process Title -
-cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty
+cluster_name = '<%= scope["zulip::postgres_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
@@ -477,7 +477,7 @@ cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to
#track_io_timing = off
#track_functions = none # none, pl, all
#track_activity_query_size = 1024 # (change requires restart)
-stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgres_common::version"] %>-main.pg_stat_tmp'
# - Statistics Monitoring -
diff --git a/puppet/zulip_ops/manifests/postgres_appdb.pp b/puppet/zulip_ops/manifests/postgres_appdb.pp
index dbc6ac7361a..03b84c602e2 100644
--- a/puppet/zulip_ops/manifests/postgres_appdb.pp
+++ b/puppet/zulip_ops/manifests/postgres_appdb.pp
@@ -28,13 +28,13 @@ class zulip_ops::postgres_appdb {
}
exec { 'setup_disks':
command => '/root/setup_disks.sh',
- require => Package["postgresql-${zulip::base::postgres_version}", 'xfsprogs'],
+ require => Package["postgresql-${zulip::postgres_common::version}", 'xfsprogs'],
unless => 'test $(readlink /var/lib/postgresql) = "/srv/postgresql/" -a -d /srv/postgresql',
}
file { "${zulip::postgres_appdb_base::postgres_confdir}/pg_hba.conf":
ensure => file,
- require => Package["postgresql-${zulip::base::postgres_version}"],
+ require => Package["postgresql-${zulip::postgres_common::version}"],
owner => 'postgres',
group => 'postgres',
mode => '0640',