From 2f937d81e2c1332c1f6804c9750336b85f56e0ca Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Mon, 23 Apr 2018 18:30:09 -0700 Subject: [PATCH] puppet: Add Zulip specific postgres configuration for 9.6. Mostly, this involves adding the big block at the bottom and making 9.6 a variable so that it's easier to compare different versions of these. --- .../9.6/postgresql.conf.template.erb | 70 +++++++++++++++++-- 1 file changed, 64 insertions(+), 6 deletions(-) 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 c39e58e716..20fb2ed72b 100644 --- a/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb +++ b/puppet/zulip/templates/postgresql/9.6/postgresql.conf.template.erb @@ -38,15 +38,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/9.6/main' # use data in another directory +data_directory = '/var/lib/postgresql/<%= scope["zulip::base::postgres_version"] %>/main' # use data in another directory # (change requires restart) -hba_file = '/etc/postgresql/9.6/main/pg_hba.conf' # host-based authentication file +hba_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/pg_hba.conf' # host-based authentication file # (change requires restart) -ident_file = '/etc/postgresql/9.6/main/pg_ident.conf' # ident configuration file +ident_file = '/etc/postgresql/<%= scope["zulip::base::postgres_version"] %>/main/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/9.6-main.pid' # write an extra PID file +external_pid_file = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pid' # write an extra PID file # (change requires restart) @@ -462,7 +462,7 @@ log_timezone = 'UTC' # - Process Title - -cluster_name = '9.6/main' # added to process titles if nonempty +cluster_name = '<%= scope["zulip::base::postgres_version"] %>/main' # added to process titles if nonempty # (change requires restart) #update_process_title = on @@ -478,7 +478,7 @@ cluster_name = '9.6/main' # added to process titles if nonempty #track_io_timing = off #track_functions = none # none, pl, all #track_activity_query_size = 1024 # (change requires restart) -stats_temp_directory = '/var/run/postgresql/9.6-main.pg_stat_tmp' +stats_temp_directory = '/var/run/postgresql/<%= scope["zulip::base::postgres_version"] %>-main.pg_stat_tmp' # - Statistics Monitoring - @@ -641,3 +641,61 @@ default_text_search_config = 'pg_catalog.english' #------------------------------------------------------------------------------ # Add settings for extensions here +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 +maintenance_work_mem = <%= scope["zulip::postgres_appdb_tuned::maintenance_work_mem"] %>MB +effective_cache_size = <%= scope["zulip::postgres_appdb_tuned::effective_cache_size"] %>MB +work_mem = <%= scope["zulip::postgres_appdb_tuned::work_mem"] %>MB +shared_buffers = <%= scope["zulip::postgres_appdb_tuned::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 != '' -%> +# Master replication settings (ignored on standby) +wal_level = hot_standby +max_wal_senders = 5 +archive_mode = on +archive_command = '/usr/local/bin/env-wal-e wal-push %p' + +# Standby replication settings (ignored on master) +hot_standby = on +<% 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 -%>