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: Adjust for templated paths and settings, set C.UTF-8 locale.

Alex Vandiver8a1bb43b239a
diff --git a/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb b/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
index 843870ad53b..9df238e2f5f 100644
--- a/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
+++ b/puppet/zulip/templates/postgresql/14/postgresql.conf.template.erb
@@ -39,15 +39,15 @@
# The default values of these variables are driven from the -D command-line
# option or PGDATA environment variable, represented here as ConfigDir.
-data_directory = '/var/lib/postgresql/14/main' # use data in another directory
+data_directory = '<%= scope["zulip::postgresql_base::postgresql_datadir"] %>' # use data in another directory
# (change requires restart)
-hba_file = '/etc/postgresql/14/main/pg_hba.conf' # host-based authentication file
+hba_file = '<%= scope["zulip::postgresql_base::postgresql_confdir"] %>/pg_hba.conf' # host-based authentication file
# (change requires restart)
-ident_file = '/etc/postgresql/14/main/pg_ident.conf' # ident configuration file
+ident_file = '<%= scope["zulip::postgresql_base::postgresql_confdir"] %>/pg_ident.conf' # ident configuration file
# (change requires restart)
# If external_pid_file is not explicitly set, no extra PID file is written.
-external_pid_file = '/var/run/postgresql/14-main.pid' # write an extra PID file
+external_pid_file = '/var/run/postgresql/<%= scope["zulip::postgresql_common::version"] %>-main.pid' # write an extra PID file
# (change requires restart)
@@ -584,7 +584,7 @@ log_timezone = 'Etc/UTC'
# PROCESS TITLE
#------------------------------------------------------------------------------
-cluster_name = '14/main' # added to process titles if nonempty
+cluster_name = '<%= scope["zulip::postgresql_common::version"] %>/main' # added to process titles if nonempty
# (change requires restart)
#update_process_title = on
@@ -601,7 +601,7 @@ cluster_name = '14/main' # added to process titles if nonempty
#track_io_timing = off
#track_wal_io_timing = off
#track_functions = none # none, pl, all
-stats_temp_directory = '/var/run/postgresql/14-main.pg_stat_tmp'
+stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::postgresql_common::version"] %>-main.pg_stat_tmp'
# - Monitoring -
@@ -795,4 +795,63 @@ include_dir = 'conf.d' # include files ending in '.conf' from
# CUSTOMIZED OPTIONS
#------------------------------------------------------------------------------
-# Add settings for extensions here
+lc_messages = 'C.UTF-8' # locale for system error message strings
+lc_monetary = 'C.UTF-8' # locale for monetary formatting
+lc_numeric = 'C.UTF-8' # locale for number formatting
+lc_time = 'C.UTF-8' # locale for time formatting
+
+timezone = 'UTC'
+default_text_search_config = 'zulip.english_us_search'
+
+log_destination = 'stderr'
+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
+
+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 @listen_addresses != '' -%>
+listen_addresses = <%= @listen_addresses %>
+<% end -%>
+
+<% if @replication != '' -%>
+# Primary replication settings (ignored on replica)
+max_wal_senders = 5
+archive_mode = on
+archive_command = '/usr/bin/timeout 10m /usr/local/bin/env-wal-g wal-push %p'
+<% 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 -%>