Skip to content

Commit

Permalink
Merge pull request #21 from chtitux/more-extra-options
Browse files Browse the repository at this point in the history
Add ability to configure shared_preload_libraries, max_worker_processes and track_commit_timestamp settings
  • Loading branch information
misdoro committed Feb 1, 2021
2 parents 17a9a7d + b128846 commit 33a4470
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 25 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ postgres_clusters: # Mandatory
extensions: # Optional
- names: [ 'postgis', 'postgis_topology' ]
apt_deps: [ 'postgresql-11-postgis' ]
extra_config: # Optional
max_connections: 100 # Optional
shared_preload_libraries: '' # Optional
max_worker_processes: 8 # Optional
track_commit_timestamp: off # Optional
max_standby_archive_delay: 30s # Optional
max_standby_streaming_delay: 600s # Optional

# Postgres config (Optional)
postgres_log_line_prefix: '%m [%p] database: %d host: %h user: %u '
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.10.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
Expand Down Expand Up @@ -163,7 +163,7 @@ dynamic_shared_memory_type = posix # the default is the first option

#max_files_per_process = 1000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)

# - Cost-Based Vacuum Delay -

Expand All @@ -183,7 +183,7 @@ bgwriter_delay = 2000ms # 10-10000ms between rounds
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8 # (change requires restart)
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }} # (change requires restart)
#max_parallel_workers_per_gather = 2 # taken from max_parallel_workers
#max_parallel_workers = 8 # maximum number of max_worker_processes that
# can be used in parallel queries
Expand Down Expand Up @@ -277,7 +277,7 @@ max_replication_slots = {{ postgres_max_replication_slots }} # max number of rep
#max_replication_slots = 0 # max number of replication slots
{% endif %}
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
track_commit_timestamp = {{ postgres_extra_config.track_commit_timestamp | default('off') }} # collect timestamp of transaction commit
# (change requires restart)

# - Master Server -
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.11.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)
Expand Down Expand Up @@ -182,7 +182,7 @@ bgwriter_delay = 2000ms # 10-10000ms between rounds
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8 # (change requires restart)
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }} # (change requires restart)
#max_parallel_maintenance_workers = 2 # taken from max_parallel_workers
#max_parallel_workers_per_gather = 2 # taken from max_parallel_workers
#parallel_leader_participation = on
Expand Down Expand Up @@ -278,7 +278,7 @@ max_replication_slots = {{ postgres_max_replication_slots }} # max number of rep
#max_replication_slots = 10 # max number of replication slots
{% endif %}
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
track_commit_timestamp = {{ postgres_extra_config.track_commit_timestamp | default('off') }} # collect timestamp of transaction commit
# (change requires restart)

# - Master Server -
Expand Down Expand Up @@ -660,7 +660,7 @@ default_text_search_config = '{{ postgres_text_search_config }}'

# - Shared Library Preloading -

#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)
#local_preload_libraries = ''
#session_preload_libraries = ''
#jit_provider = 'llvmjit' # JIT library to use
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.12.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/var/run/postgresql' # comma-separated list of directories
# (change requires restart)
Expand Down Expand Up @@ -192,7 +192,7 @@ bgwriter_delay = 2000ms # 10-10000ms between rounds
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8 # (change requires restart)
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }} # (change requires restart)
#max_parallel_maintenance_workers = 2 # taken from max_parallel_workers
#max_parallel_workers_per_gather = 2 # taken from max_parallel_workers
#parallel_leader_participation = on
Expand Down Expand Up @@ -338,7 +338,7 @@ max_replication_slots = {{ postgres_max_replication_slots }} # max number of rep
#max_replication_slots = 10 # max number of replication slots
{% endif %}
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
track_commit_timestamp = {{ postgres_extra_config.track_commit_timestamp | default('off') }} # collect timestamp of transaction commit
# (change requires restart)

# - Master Server -
Expand Down Expand Up @@ -744,7 +744,7 @@ default_text_search_config = '{{ postgres_text_search_config }}'

# - Shared Library Preloading -

#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)
#local_preload_libraries = ''
#session_preload_libraries = ''
#jit_provider = 'llvmjit' # JIT library to use
Expand Down
4 changes: 2 additions & 2 deletions templates/postgresql.9.1.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost', '*' = all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
Expand Down Expand Up @@ -128,7 +128,7 @@ maintenance_work_mem = 1024MB

#max_files_per_process = 1000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)

# - Cost-Based Vacuum Delay -

Expand Down
6 changes: 3 additions & 3 deletions templates/postgresql.9.4.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
Expand Down Expand Up @@ -149,7 +149,7 @@ dynamic_shared_memory_type = posix # the default is the first option

#max_files_per_process = 1000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)

# - Cost-Based Vacuum Delay -

Expand All @@ -168,7 +168,7 @@ dynamic_shared_memory_type = posix # the default is the first option
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }}


#------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.9.5.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
Expand Down Expand Up @@ -163,7 +163,7 @@ dynamic_shared_memory_type = posix # the default is the first option

#max_files_per_process = 1000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)

# - Cost-Based Vacuum Delay -

Expand All @@ -182,7 +182,7 @@ bgwriter_delay = 2000ms # 10-10000ms between rounds
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }}


#------------------------------------------------------------------------------
Expand Down Expand Up @@ -267,7 +267,7 @@ max_replication_slots = {{ postgres_max_replication_slots }} # max number of rep
#max_replication_slots = 0 # max number of replication slots
{% endif %}
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
track_commit_timestamp = {{ postgres_extra_config.track_commit_timestamp | default('off') }} # collect timestamp of transaction commit
# (change requires restart)

# - Master Server -
Expand Down
8 changes: 4 additions & 4 deletions templates/postgresql.9.6.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ listen_addresses = '{{ postgres_listen_addresses | reject("none") | join(",") }}
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = {{ postgres_port }} # (change requires restart)
max_connections = 400 # (change requires restart)
max_connections = {{ postgres_extra_config.max_connections | default('100') }} # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction).
#superuser_reserved_connections = 3 # (change requires restart)
Expand Down Expand Up @@ -166,7 +166,7 @@ dynamic_shared_memory_type = posix # the default is the first option

#max_files_per_process = 1000 # min 25
# (change requires restart)
#shared_preload_libraries = '' # (change requires restart)
shared_preload_libraries = '{{ postgres_extra_config.shared_preload_libraries | default('') }}' # (change requires restart)

# - Cost-Based Vacuum Delay -

Expand All @@ -186,7 +186,7 @@ bgwriter_delay = 2000ms # 10-10000ms between rounds
# - Asynchronous Behavior -

#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8 # (change requires restart)
max_worker_processes = {{ postgres_extra_config.max_worker_processes | default('8') }} # (change requires restart)
#max_parallel_workers_per_gather = 0 # taken from max_worker_processes
#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate
# (change requires restart)
Expand Down Expand Up @@ -279,7 +279,7 @@ max_replication_slots = {{ postgres_max_replication_slots }} # max number of rep
#max_replication_slots = 0 # max number of replication slots
{% endif %}
# (change requires restart)
#track_commit_timestamp = off # collect timestamp of transaction commit
track_commit_timestamp = {{ postgres_extra_config.track_commit_timestamp | default('off') }} # collect timestamp of transaction commit
# (change requires restart)

# - Master Server -
Expand Down

0 comments on commit 33a4470

Please sign in to comment.