From 07c86e2007f93e191efae0bf8c4717929fee0a02 Mon Sep 17 00:00:00 2001 From: Mar Alegre Date: Mon, 12 Dec 2022 16:47:17 -0500 Subject: [PATCH] addd postgresql settings for hopefully better performance --- nextcloud/Containerfile | 11 +++++--- nextcloud/assets/{ => postgresql}/pg_hba.conf | 0 nextcloud/assets/postgresql/postgresql.conf | 27 +++++++++++++++++++ 3 files changed, 35 insertions(+), 3 deletions(-) rename nextcloud/assets/{ => postgresql}/pg_hba.conf (100%) create mode 100644 nextcloud/assets/postgresql/postgresql.conf diff --git a/nextcloud/Containerfile b/nextcloud/Containerfile index 6ceb927..d35e3e5 100644 --- a/nextcloud/Containerfile +++ b/nextcloud/Containerfile @@ -65,9 +65,14 @@ RUN mv php/php.ini /etc/php/${PHPV:?}/fpm/ && \ ### PostgreSQL ### ### -# configure PostgreSQL access -COPY --chown=postgres:postgres assets/pg_hba.conf ./ -RUN mv pg_hba.conf /etc/postgresql/${PSQLV:?}/main/ +# configure PostgreSQL +COPY --chown=postgres:postgres assets/postgresql ./ +# If the posgresql.conf file contains multiple entries for the same parameter, all but the last one is ignored. +# So we can just append our settings to the already-existing postgresql.conf file. +RUN mv postgresql/pg_hba.conf /etc/postgresql/${PSQLV:?}/main/ & \ + cat postgresql/postgresql.conf >> /etc/postgresql/${PSQLV:?}/main/postgresql.conf + + ### ### Apache diff --git a/nextcloud/assets/pg_hba.conf b/nextcloud/assets/postgresql/pg_hba.conf similarity index 100% rename from nextcloud/assets/pg_hba.conf rename to nextcloud/assets/postgresql/pg_hba.conf diff --git a/nextcloud/assets/postgresql/postgresql.conf b/nextcloud/assets/postgresql/postgresql.conf new file mode 100644 index 0000000..a9e97e9 --- /dev/null +++ b/nextcloud/assets/postgresql/postgresql.conf @@ -0,0 +1,27 @@ +# The following configuration parameters were generated using the PGTune tool +# https://pgtune.leopard.in.ua/ +# parameters: + +# DB Version: 13 +# OS Type: linux +# DB Type: web +# Total Memory (RAM): 16 GB +# CPUs num: 6 +# Data Storage: ssd + +max_connections = 200 +shared_buffers = 4GB +effective_cache_size = 12GB +maintenance_work_mem = 1GB +checkpoint_completion_target = 0.9 +wal_buffers = 16MB +default_statistics_target = 100 +random_page_cost = 1.1 +effective_io_concurrency = 200 +work_mem = 6990kB +min_wal_size = 1GB +max_wal_size = 4GB +max_worker_processes = 6 +max_parallel_workers_per_gather = 3 +max_parallel_workers = 6 +max_parallel_maintenance_workers = 3