diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ab2c42..7fdbcf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- [#64] make max_connections to postgresql configurable ## [v14.18-2] - 2025-08-25 ### Fixed diff --git a/dogu.json b/dogu.json index a97a4ec..c089965 100644 --- a/dogu.json +++ b/dogu.json @@ -118,6 +118,12 @@ "Type": "BINARY_MEASUREMENT" } }, + { + "Name": "database_config/max_connections", + "Description": "Maximum amount of allowed database connections. Allowing to many connections can increase hardware requirements.", + "Optional": true, + "Default": "100" + }, { "Name": "logging/root", "Description": "Set the root log level to one of ERROR, WARN, INFO, DEBUG.", diff --git a/resources/startup.sh b/resources/startup.sh index 8e764a7..9c9106b 100755 --- a/resources/startup.sh +++ b/resources/startup.sh @@ -131,6 +131,12 @@ function setDoguLogLevel() { echo "log_min_messages = ${POSTGRESQL_LOGLEVEL}" >>/var/lib/postgresql/postgresql.conf } +function setMaxConnections() { + # replace default max connection count with configured max connection count + cons=$(doguctl config 'database_config/max_connections') + sed -i "/max_connections/c\max_connections = ${cons}" /var/lib/postgresql/postgresql.conf +} + function runMain() { # check whether post-upgrade script is still running while [[ "$(doguctl config "local_state" -d "empty")" == "upgrading" ]]; do @@ -147,6 +153,7 @@ function runMain() { write_pg_hba_conf setDoguLogLevel + setMaxConnections # set stage for health check doguctl state ready