Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
puppet: Add PostgreSQL 15 support.
Alex Vandiverf11350f789ec
diff --git a/docs/production/deployment.md b/docs/production/deployment.mdindex 6fd286379ce..60bc26218ba 100644--- a/docs/production/deployment.md+++ b/docs/production/deployment.md@@ -52,7 +52,8 @@ as well as those mentioned in the[install](install.md#installer-options) documentation:- `--postgresql-version`: Sets the version of PostgreSQL that will be- installed. We currently support PostgreSQL 12, 13, and 14.+ installed. We currently support PostgreSQL 12, 13, 14, and 15, with 15 being+ the default.- `--postgresql-database-name=exampledbname`: With this option, youcan customize the default database name. If you do not set this. Thediff --git a/docs/production/postgresql.md b/docs/production/postgresql.mdindex 48c0e56941d..2e19a630d02 100644--- a/docs/production/postgresql.md+++ b/docs/production/postgresql.md@@ -1,13 +1,13 @@# PostgreSQL database detailsStarting with Zulip 3.0, Zulip supports a range of PostgreSQL-versions. PostgreSQL 14 is the current default for new installations;-PostgreSQL 12, 13, and 14 are all supported.+versions. PostgreSQL 15 is the current default for new installations;+PostgreSQL 12, 13, 14, and 15 are all supported.Previous versions of Zulip used whatever version of PostgreSQL wasincluded with the base operating system (E.g. PostgreSQL 12 on Ubuntu20.04). We recommend that installations currently using older-PostgreSQL releases [upgrade to PostgreSQL 14][upgrade-postgresql], as+PostgreSQL releases [upgrade to PostgreSQL 15][upgrade-postgresql], aswe may drop support for older PostgreSQL in a future release.[upgrade-postgresql]: upgrade.md#upgrading-postgresqldiff --git a/docs/production/upgrade.md b/docs/production/upgrade.mdindex 01a0ee6a33d..b4f22ad543e 100644--- a/docs/production/upgrade.md+++ b/docs/production/upgrade.md@@ -618,9 +618,9 @@ instructions for other supported platforms.## Upgrading PostgreSQLStarting with Zulip 3.0, we use the latest available version of-PostgreSQL at installation time (currently version 14). Upgrades to+PostgreSQL at installation time (currently version 15). Upgrades tothe version of PostgreSQL are no longer linked to upgrades of the-distribution; that is, you may opt to upgrade to PostgreSQL 14 while+distribution; that is, you may opt to upgrade to PostgreSQL 15 whilerunning Ubuntu 20.04.To upgrade the version of PostgreSQL on the Zulip server:diff --git a/puppet/zulip/manifests/profile/postgresql.pp b/puppet/zulip/manifests/profile/postgresql.ppindex ce5bced65e6..23f24b00f3b 100644--- a/puppet/zulip/manifests/profile/postgresql.pp+++ b/puppet/zulip/manifests/profile/postgresql.pp@@ -3,6 +3,7 @@ class zulip::profile::postgresql {include zulip::profile::baseinclude zulip::postgresql_base+ $version = $zulip::postgresql_common::version$work_mem = $zulip::common::total_memory_mb / 512$shared_buffers = $zulip::common::total_memory_mb / 8$effective_cache_size = $zulip::common::total_memory_mb * 10 / 32@@ -29,14 +30,28 @@ class zulip::profile::postgresql {group => 'postgres',}- $postgresql_conf_file = "${zulip::postgresql_base::postgresql_confdir}/postgresql.conf"- file { $postgresql_conf_file:- ensure => file,- require => Package[$zulip::postgresql_base::postgresql],- owner => 'postgres',- group => 'postgres',- mode => '0644',- content => template("zulip/postgresql/${zulip::postgresql_common::version}/postgresql.conf.template.erb"),+ if $version in ['12','13','14'] {+ $postgresql_conf_file = "${zulip::postgresql_base::postgresql_confdir}/postgresql.conf"+ file { $postgresql_conf_file:+ ensure => file,+ require => Package[$zulip::postgresql_base::postgresql],+ owner => 'postgres',+ group => 'postgres',+ mode => '0644',+ content => template("zulip/postgresql/${version}/postgresql.conf.template.erb"),+ }+ } elsif $version in ['15'] {+ $postgresql_conf_file = "${zulip::postgresql_base::postgresql_confdir}/conf.d/zulip.conf"+ file { $postgresql_conf_file:+ ensure => file,+ require => Package[$zulip::postgresql_base::postgresql],+ owner => 'postgres',+ group => 'postgres',+ mode => '0644',+ content => template('zulip/postgresql/zulip.conf.template.erb'),+ }+ } else {+ fail("PostgreSQL ${version} not supported")}if $replication_primary != '' and $replication_user != '' {@@ -47,8 +62,7 @@ class zulip::profile::postgresql {|-EOTwarning($message)}- # PostgreSQL uses the presence of a standby.signal file to trigger- # replication+ # The presence of a standby.signal file triggers replicationfile { "${zulip::postgresql_base::postgresql_datadir}/standby.signal":ensure => file,require => Package[$zulip::postgresql_base::postgresql],@@ -57,11 +71,11 @@ class zulip::profile::postgresql {mode => '0644',content => '',}- }+ }- exec { $zulip::postgresql_base::postgresql_restart:- require => Package[$zulip::postgresql_base::postgresql],- refreshonly => true,- subscribe => [ File[$postgresql_conf_file] ],- }+ exec { $zulip::postgresql_base::postgresql_restart:+ require => Package[$zulip::postgresql_base::postgresql],+ refreshonly => true,+ subscribe => [ File[$postgresql_conf_file] ],+ }}diff --git a/puppet/zulip/templates/postgresql/zulip.conf.template.erb b/puppet/zulip/templates/postgresql/zulip.conf.template.erbnew file mode 100644index 00000000000..bc196c3c55e--- /dev/null+++ b/puppet/zulip/templates/postgresql/zulip.conf.template.erb@@ -0,0 +1,63 @@+<% if @listen_addresses != '' -%>+# Bind to specific address+listen_addresses = <%= @listen_addresses %>+<% end -%>++# This has an improved set of stopwords.+default_text_search_config = 'zulip.english_us_search'++# Provide more comprehensive on-disk logs+logging_collector = on+log_directory = '/var/log/postgresql'+log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'+log_rotation_age = 7d+log_rotation_size = 100MB+log_min_duration_statement = 500+log_line_prefix = '%m [%c]: [%l-1] '+log_checkpoints = on+log_lock_waits = on+log_temp_files = 0+log_autovacuum_min_duration = 100++# Adjust autovacuum for having many mostly-append-only tables+autovacuum_freeze_max_age = 2000000000+vacuum_freeze_min_age = 1000000000+vacuum_freeze_table_age = 1800000000++# Performance settings+max_connections = 1000+maintenance_work_mem = <%= scope["zulip::profile::postgresql::maintenance_work_mem"] %>MB+effective_cache_size = <%= scope["zulip::profile::postgresql::effective_cache_size"] %>MB+work_mem = <%= scope["zulip::profile::postgresql::work_mem"] %>MB+shared_buffers = <%= scope["zulip::profile::postgresql::shared_buffers"] %>MB+wal_buffers = 4MB+checkpoint_completion_target = 0.7+<% if @random_page_cost != '' -%>+random_page_cost = <%= @random_page_cost %>+<% end -%>+<% if @effective_io_concurrency != '' -%>+effective_io_concurrency = <%= @effective_io_concurrency %>+<% end -%>++<% if @s3_backups_bucket != '' -%>+# Streaming backups and replication+archive_mode = on+archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'+restore_command = '/usr/local/bin/env-wal-g wal-fetch "%f" "%p"'+<% if @replication_primary != '' && @replication_user != '' -%>+primary_conninfo = 'host=<%= @replication_primary %> user=<%= @replication_user -%>+<% if @replication_password != '' %> password=<%= @replication_password %><% end -%>+<% if @ssl_mode != '' %> sslmode=<%= @ssl_mode %><% end -%>+'+<% end -%>+<% end -%>++<% if @ssl_cert_file != '' -%>+ssl_cert_file = '<%= @ssl_cert_file %>' # (change requires restart)+<% end -%>+<% if @ssl_key_file != '' -%>+ssl_key_file = '<%= @ssl_key_file %>' # (change requires restart)+<% end -%>+<% if @ssl_ca_file != '' -%>+ssl_ca_file = '<%= @ssl_ca_file %>' # (change requires restart)+<% end -%>diff --git a/scripts/lib/install b/scripts/lib/installindex 4b75a4027fb..2aa4715aeb2 100755--- a/scripts/lib/install+++ b/scripts/lib/install@@ -32,7 +32,7 @@ Options:Sets the PostgreSQL database name.--postgresql-database-user=zulipSets the PostgreSQL database user.- --postgresql-version=14+ --postgresql-version=15Sets the version of PostgreSQL that will be installed.--postgresql-missing-dictionariesSet postgresql.missing_dictionaries, which alters the initial database. Use with@@ -140,7 +140,7 @@ read -r -a ADDITIONAL_PACKAGES <<<"${ADDITIONAL_PACKAGES:-}"# e.g. zulip::profile::app_frontend for a Zulip frontend server.PUPPET_CLASSES="${PUPPET_CLASSES:-zulip::profile::standalone}"VIRTUALENV_NEEDED="${VIRTUALENV_NEEDED:-yes}"-POSTGRESQL_VERSION="${POSTGRESQL_VERSION:-14}"+POSTGRESQL_VERSION="${POSTGRESQL_VERSION:-15}"if [ -n "$SELF_SIGNED_CERT" ] && [ -n "$USE_CERTBOT" ]; thenset +xdiff --git a/scripts/setup/upgrade-postgresql b/scripts/setup/upgrade-postgresqlindex 51a0f897d57..b103f0eb171 100755--- a/scripts/setup/upgrade-postgresql+++ b/scripts/setup/upgrade-postgresql@@ -12,7 +12,7 @@ export LC_ALL=C.UTF-8export LANG=C.UTF-8export LANGUAGE=C.UTF-8-UPGRADE_TO=${1:-14}+UPGRADE_TO=${1:-15}UPGRADE_FROM=$(crudini --get /etc/zulip/zulip.conf postgresql version)ZULIP_PATH="$(dirname "$0")/../.."