Skip to content

Commit

Permalink
Add a postgresql.conf file template
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed May 16, 2024
1 parent 6e2b23a commit 77c98f4
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ansible/roles/postgres/files/postgresql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
data_directory = '/var/lib/postgresql/15/main'
hba_file = '/etc/postgresql/15/main/pg_hba.conf'
ident_file = '/etc/postgresql/15/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/15-main.pid'
listen_addresses = '89.58.26.118,localhost'
port = 5432
unix_socket_directories = '/var/run/postgresql'

ssl = on
ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
ssl_key_file = '/etc/ssl/private/ssl-cert-snakeoil.key'
dynamic_shared_memory_type = posix

log_line_prefix = '%m [%p] %q%u@%d '
log_timezone = 'Etc/UTC'
datestyle = 'iso, mdy'
timezone = 'Etc/UTC'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
default_text_search_config = 'pg_catalog.english'
include_dir = 'conf.d'

cluster_name = 'schweinehund'

# The following is from https://pgtune.leopard.in.ua/
# DB Version: 15
# OS Type: linux
# DB Type: mixed
# Total Memory (RAM): 64 GB
# CPUs num: 10
# Connections num: 100
# Data Storage: ssd
max_connections = 100
shared_buffers = 16GB
effective_cache_size = 48GB
maintenance_work_mem = 2GB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 20971kB
huge_pages = try
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 10
max_parallel_workers_per_gather = 4
max_parallel_workers = 10
max_parallel_maintenance_workers = 4
12 changes: 12 additions & 0 deletions ansible/roles/postgres/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,15 @@
become_user: "{{ postgres_user }}"
tags:
- role::postgres

- name: Import postgresql.conf
copy:
src: postgresql.conf
dest: /etc/postgresql/{{ postgres_version }}/main/postgresql.conf
owner: postgres
group: postgres
mode: "0644"
tags:
- role::postgres
notify:
- Restart the postgres service

0 comments on commit 77c98f4

Please sign in to comment.