puppet: Move postgres_version into postgres_common.

This property is not related to the base zulip install; move it to
zulip::postgres_common, which is already used as a namespace for
various postgres variables.
This commit is contained in:
Alex Vandiver
2020-10-20 00:34:57 -07:00
committed by Tim Abbott
parent 25e995b677
commit 0ea20bd7d8
13 changed files with 38 additions and 37 deletions

View File

@@ -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

View File

@@ -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':

View File

@@ -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'

View File

@@ -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:

View File

@@ -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",

View File

@@ -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

View File

@@ -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 -

View File

@@ -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 -

View File

@@ -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 -

View File

@@ -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)

View File

@@ -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 -

View File

@@ -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 -

View File

@@ -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',