diff --git a/postgres/conf.d/.gitkeep b/postgres/conf.d/.gitkeep new file mode 100644 index 0000000..473a0f4 diff --git a/postgres/environment b/postgres/environment new file mode 100644 index 0000000..473a0f4 diff --git a/postgres/pg_ctl.conf b/postgres/pg_ctl.conf new file mode 100644 index 0000000..07e76fa --- /dev/null +++ b/postgres/pg_ctl.conf @@ -0,0 +1 @@ +pg_ctl_options = '' diff --git a/postgres/pg_hba.conf b/postgres/pg_hba.conf new file mode 100644 index 0000000..1eb70ea --- /dev/null +++ b/postgres/pg_hba.conf @@ -0,0 +1,4 @@ +# TYPE DATABASE USER ADDRESS METHOD +# Database administrative login by Unix domain socket, do not disable +local all postgres peer +local all all peer diff --git a/postgres/pg_ident.conf b/postgres/pg_ident.conf new file mode 100644 index 0000000..473a0f4 diff --git a/postgres/postgresql.conf b/postgres/postgresql.conf new file mode 100644 index 0000000..951000b --- /dev/null +++ b/postgres/postgresql.conf @@ -0,0 +1,60 @@ +data_directory = '/var/lib/postgresql/17/events' +hba_file = '/etc/postgresql/17/events/pg_hba.conf' +ident_file = '/etc/postgresql/17/events/pg_ident.conf' +external_pid_file = '/var/run/postgresql/17-events.pid' + +listen_addresses = '' +port = 5433 +max_connections = 100 +unix_socket_directories = '/var/run/postgresql' +unix_socket_permissions = 0777 + +ssl = off + +dynamic_shared_memory_type = posix + +log_rotation_age = 7d +log_rotation_size = 0 +log_line_prefix = '%m [%p] %q%u@%d ' +log_timezone = 'Europe/Berlin' +timezone = 'Europe/Berlin' +cluster_name = '17/events' +datestyle = 'iso' +lc_messages = 'C.UTF-8' +lc_monetary = 'C.UTF-8' +lc_numeric = 'C.UTF-8' +lc_time = 'C.UTF-8' + +default_text_search_config = 'pg_catalog.english' + +include_dir = 'conf.d' + +# ----------------------------------------------------------------------------- +# Tuning config from https://pgtune.leopard.in.ua + +# DB Version: 17 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 2 GB +# CPUs num: 4 +# Connections num: 100 +# Data Storage: ssd + +max_connections = 100 +shared_buffers = 512MB +effective_cache_size = 1536MB +maintenance_work_mem = 128MB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 5041kB +huge_pages = off +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 4 +max_parallel_workers_per_gather = 2 +max_parallel_workers = 4 +max_parallel_maintenance_workers = 2 + diff --git a/postgres/start.conf b/postgres/start.conf new file mode 100644 index 0000000..2e3675a --- /dev/null +++ b/postgres/start.conf @@ -0,0 +1 @@ +auto diff --git a/postgresql.service b/postgresql.service new file mode 100644 index 0000000..1878be3 --- /dev/null +++ b/postgresql.service @@ -0,0 +1,18 @@ +# postgresql.service is the meta unit for managing all PostgreSQL clusters on +# the system at once. Conceptually, this unit is more like a systemd target, +# but we are using a service since targets cannot be reloaded. +# +# The unit actually managing PostgreSQL clusters is postgresql@.service, +# instantiated as postgresql@15-main.service for individual clusters. + +[Unit] +Description=PostgreSQL RDBMS + +[Service] +Type=oneshot +ExecStart=/bin/true +ExecReload=/bin/true +RemainAfterExit=on + +[Install] +WantedBy=multi-user.target