docker-postgis/scripts/setup-conf.sh

126 wiersze
4.4 KiB
Bash
Czysty Zwykły widok Historia

#!/usr/bin/env bash
source /scripts/env-data.sh
create_dir "${EXTRA_CONF_DIR}"
create_dir "${CONF_LOCKFILE_DIR}"
create_dir "${SCRIPTS_LOCKFILE_DIR}"
SETUP_LOCKFILE="${CONF_LOCKFILE_DIR}/.postgresql.conf.lock"
if [ -f "${SETUP_LOCKFILE}" ]; then
return 0
fi
# Refresh configuration in case environment settings changed.
cat "${CONF}".template > "${CONF}"
2021-01-05 17:09:48 +00:00
# Reflect DATA DIR location
# Delete any data_dir declarations
sed -i '/data_directory/d' "${CONF}"
# Create a config to optimise postgis
cat > "${ROOT_CONF}"/postgis.conf <<EOF
2021-01-05 17:09:48 +00:00
data_directory = '${DATADIR}'
2021-01-03 11:18:32 +00:00
port = 5432
Align Develop to PostgreSQL 11 (#121) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases.
2019-02-20 10:28:14 +00:00
superuser_reserved_connections= 10
listen_addresses = '${IP_LIST}'
shared_buffers = ${SHARED_BUFFERS}
work_mem = ${WORK_MEM}
maintenance_work_mem = ${MAINTENANCE_WORK_MEM}
wal_buffers = ${WAL_BUFFERS}
random_page_cost = 2.0
xmloption = 'document'
max_parallel_maintenance_workers = ${MAINTENANCE_WORKERS}
Optimisations (#143) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Added env variables for postgresql.conf and new settings available in PG 11 * Ad option to initialize WAL segment
2019-08-23 13:43:58 +00:00
max_parallel_workers = ${MAX_WORKERS}
shared_preload_libraries = '${SHARED_PRELOAD_LIBRARIES}'
Add pg_cron by default and configure it's usage in postgresql.conf (#192) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Fix spacing in readme * Add replication user and enable postgis rasters drivers * Replicate from restricted IP address * use replication user for streaming changes * update README to higlight new changes * change permisions of default schema to enable replication * add missing env variables * Add logic to cater for destroy database on restart. It can be True or False on start and the logic will handle it * fix for version 12 upgrade * add postgis raster extension * Small fixes for postgresql 12 * Modified docker-compose to run against pg 12 * remove duplicated env * Build point cloud and other custome extension, add plpython and pgcron * Disable building community extensions * fix reference to port in docker compose * Cleanup readme * Remove building extensions as this can be done by entrypoint scripts * Add pg cron by default in the DB and configure first DB to listen to it Co-authored-by: Tim Sutton <tim@kartoza.com> Co-authored-by: Rizky Maulana Nugraha <lana.pcfre@gmail.com>
2020-01-25 15:06:05 +00:00
cron.database_name = '${SINGLE_DB}'
password_encryption= '${PASSWORD_AUTHENTICATION}'
timezone='${TIMEZONE}'
2020-11-04 19:25:18 +00:00
cron.use_background_workers = on
EOF
echo "include 'postgis.conf'" >> "${CONF}"
# Create a config for logical replication
if [[ "${REPLICATION}" =~ [Tt][Rr][Uu][Ee] && "$WAL_LEVEL" == 'logical' ]]; then
2021-03-01 06:42:38 +00:00
cat > "${ROOT_CONF}"/logical_replication.conf <<EOF
wal_level = ${WAL_LEVEL}
max_wal_senders = ${PG_MAX_WAL_SENDERS}
wal_keep_size = ${PG_WAL_KEEP_SIZE}
min_wal_size = ${MIN_WAL_SIZE}
max_wal_size = ${WAL_SIZE}
max_logical_replication_workers = ${MAX_LOGICAL_REPLICATION_WORKERS}
max_sync_workers_per_subscription = ${MAX_SYNC_WORKERS_PER_SUBSCRIPTION}
EOF
echo "include 'logical_replication.conf'" >> "${CONF}"
fi
Align develop with 12.0 branch (#159) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Fix spacing in readme * Add replication user and enable postgis rasters drivers * Replicate from restricted IP address * use replication user for streaming changes * update README to higlight new changes * change permisions of default schema to enable replication * add missing env variables * Add logic to cater for destroy database on restart. It can be True or False on start and the logic will handle it * fix for version 12 upgrade * add postgis raster extension * Small fixes for postgresql 12 * Modified docker-compose to run against pg 12
2019-11-25 12:47:29 +00:00
# Create a config for streaming replication
if [[ "${REPLICATION}" =~ [Tt][Rr][Uu][Ee] && "$WAL_LEVEL" == 'replica' ]]; then
postgres_ssl_setup
cat > "${ROOT_CONF}"/streaming_replication.conf <<EOF
wal_level = ${WAL_LEVEL}
max_wal_senders = ${PG_MAX_WAL_SENDERS}
wal_keep_size = ${PG_WAL_KEEP_SIZE}
min_wal_size = ${MIN_WAL_SIZE}
max_wal_size = ${WAL_SIZE}
hot_standby = on
checkpoint_timeout = ${CHECK_POINT_TIMEOUT}
primary_conninfo = 'host=${REPLICATE_FROM} port=${REPLICATE_PORT} user=${REPLICATION_USER} password=${REPLICATION_PASS} ${PARAMS}'
recovery_target_timeline=${TARGET_TIMELINE}
recovery_target_action=${TARGET_ACTION}
EOF
if [[ ${ARCHIVE_MODE} =~ [Oo][Nn] ]];then
cat >> "${ROOT_CONF}"/streaming_replication.conf <<EOF
archive_mode = ${ARCHIVE_MODE}
archive_command = '${ARCHIVE_COMMAND}'
archive_cleanup_command = '${ARCHIVE_CLEANUP_COMMAND}'
EOF
fi
echo "include 'streaming_replication.conf'" >> "${CONF}"
fi
Align develop with 12.0 branch (#159) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Merge develop to master to align with PostgreSQL 11 (#117) * Added note about version number * README update * Revert to using pg 9.3 in latest build - prevent breaking downstream apps for now * Revert to pg 9.3 * Fix references to 9.4 to make them 9.3 rather * Fix incorrect version in 9.4 branch * Fix TOPOLOGY conditional typo * Update run-postgis-docker.sh * Update run-postgis-docker.sh added IPADDRESS * Updates from Marco * Allow connections from 192.168 private network too * start temporary server in local-only mode, poll instead of blind wait, preserve pid 1 * Enable PostGIS Out DB raster support http://postgis.net/2015/05/02/tip_enable_raster_drivers/ http://postgis.net/docs/postgis_installation.html#install_short_version * Remove hardcoded reference to container name "docker" * upgrade postgres to 9.5 and postgis to 2.2 * Added flexible IP range as arg on docker run * Added better description to docker env vars * Updated references to pg and postgis versions in readme * Followup 0745c488, fix references to 9.4 * problem version postgresql version is 9.4, instead of 9.5 * Added note about allowing external ports. * Update README.md * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * 9.5 2.2 (#49) * Allow connections from 192.168 private network too * Updated references to pg and postgis versions in readme * Cleanups to 9.5 branch - remove old supervisor files * Fix for README * Dont add supervisor stuff which is deprecated * Fix 9.4 reference * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#58) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Merge improvements from 9.5 branch (#60) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * 9.5 2.2 (#59) * Allow changing the default database name (#50) * Commented out legacy scripts since it seems they are removed in 2.2 * Improve start (#57) * Make initial dir optional * Improve termination of background initial process #56 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * 9.5 2.2 (#61) * Allow changing the default database name (#50) * Allow changing the default database name (#50) * Allow changing the default database name (#50) (#52) * Commented out legacy scripts since it seems they are removed in 2.2 * Added more options to convenience run script * Added missing l from getopts * Added missing l from getopts * Tweak convenience scripts (#62) * Added missing l from getopts * allow connection when using docker compose (#65) see https://github.com/docker/compose/issues/4336 and https://github.com/kartoza/docker-postgis/issues/40 * Install gnupg for fetching keys first * Fix key fetching * Updated to 9.6 and postgis 2.4 * Ditch apt-cacher stuff * Upgraded to PG 10 * change version from postgresql-10.0 to 10 and fix typo in run-postgis… (#76) * change version from postgresql-10.0 to 10 and fix typo in run-postgis file * edit setup.sh to version 10 * Change from version 10.0 to 10 in Dockerfile (#75) I checked that postgresql-10.0 is an invalid name. It should be just postgresql-10 * Fixes for pg 10 to start nicely * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Fix #90 and replace references to slave with replicant (Slave is a pejorative term) * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Merge branch 10 into develop (#113) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Port changes for Postgres version 11 (#114) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Port changes to 11 branch (#115) * Fix typo in helper script * Port work in develop to 10 branch (#90) * Port 9.6 to develop (#89) * Part one of porting work from 9.6 to 10 * Backported more scripts from 9.6 branch * Added missing apt update in dockerfile * Updates to entrypoint to reference image and update docker-compose to reference 10 pg * Added sample and docs from 9.6 branch * Removed my diagram as Rizky had already added one * Fix env paths for pg 10 * Fixes for backporting work from 9.6 to 10 - dbb now spins up and accepts connections properly * Update README.md * Backport from branch: 9.6-2.4 Fix default datadir - Change into default datadir - Add small unittest * Optimise PostgreSQL performance and align with the changes done in 9.6 version * Fix version numbers * Minor change to correct env file * Merged 10 branch into develop * Remove reduntant conf file from dockerfile * Remove reduntant conf file directive from setup script * Remove reduntant conf file directive from script * Migrate settings to be compatible with PostgreSQL version 11 * fix ssl setup * Align changes to postgresql version 11 * Set destroy database to false * Commented out code for destroy database * Fix version number for build * Implement conf lock file check (#116) It will make sure that the conf file will only be generated once for a given container. * Added new configuration in recovery.conf and postgres optimisations for master-slave replication * Added new configuration in recovery.conf and postgres optimisations for master-slave replication (#118) * Remove template logic and use plain create extension (#119) * Remove template logic and added option to create multiple databases and extensions * Fix travis error * More optimisations for replication * Fix logic for checking if database exists since we now can create multiple databases. * Added Licence file * add option to mount certificates * fix comments in PR about mounting SSL * Align to develop upstream * Add OGR FDW to the installation and activate it in the docker-compose * Fix spacing in readme * Add replication user and enable postgis rasters drivers * Replicate from restricted IP address * use replication user for streaming changes * update README to higlight new changes * change permisions of default schema to enable replication * add missing env variables * Add logic to cater for destroy database on restart. It can be True or False on start and the logic will handle it * fix for version 12 upgrade * add postgis raster extension * Small fixes for postgresql 12 * Modified docker-compose to run against pg 12
2019-11-25 12:47:29 +00:00
2021-03-01 06:42:38 +00:00
if [[ ! -f ${ROOT_CONF}/extra.conf ]]; then
# If it doesn't exists, copy from ${EXTRA_CONF_DIR} directory if exists
if [[ -f ${EXTRA_CONF_DIR}/extra.conf ]]; then
cp -f "${EXTRA_CONF_DIR}"/extra.conf "${ROOT_CONF}"/extra.conf
echo "include 'extra.conf'" >> "${CONF}"
2021-03-01 06:42:38 +00:00
else
# default value
2021-03-02 05:45:59 +00:00
if [[ -n "$EXTRA_CONF" ]]; then
echo -e "${EXTRA_CONF}" >> "${ROOT_CONF}"/extra.conf
echo "include 'extra.conf'" >> "${CONF}"
2021-03-01 06:42:38 +00:00
fi
fi
fi
2023-03-25 09:13:07 +00:00
# Timescale default tuning
# TODO If timescale DB accepts reading from include directory then refactor code to remove line 97 - 112 (https://github.com/timescale/timescaledb-tune/issues/80)
if [[ $(dpkg -l | grep "timescaledb") > /dev/null ]] && [[ ${ACCEPT_TIMESCALE_TUNING} =~ [Tt][Rr][Uu][Ee] ]] ;then
2023-03-25 09:13:07 +00:00
# copy default conf as a backup
cp "${ROOT_CONF}"/postgresql.conf "${ROOT_CONF}"/postgresql_orig.conf
over_write_conf
echo -e "\e[1;31m Time scale config tuning values below"
# TODO Add logic to find defaults memory, CPUS as these can vary from defaults on host machine and in docker container
timescaledb-tune -yes -quiet "${TIMESCALE_TUNING_PARAMS}" --dry-run >"${ROOT_CONF}"/"${TIMESCALE_TUNING_CONFIG}"
2023-03-25 09:13:07 +00:00
if [[ -f "${ROOT_CONF}"/${TIMESCALE_TUNING_CONFIG} ]]; then
mv "${ROOT_CONF}"/postgresql_orig.conf "${CONF}"
echo "include '${TIMESCALE_TUNING_CONFIG}'" >> "${CONF}"
2023-03-25 09:13:07 +00:00
fi
echo -e "\033[0m Time scale config tuning values set in ${ROOT_CONF}/${TIMESCALE_TUNING_CONFIG}"
fi
# Optimise PostgreSQL shared memory for PostGIS
# shmall units are pages and shmmax units are bytes(?) equivalent to the desired shared_buffer size set in setup_conf.sh - in this case 500MB
echo "kernel.shmmax=${KERNEL_SHMMAX}" >> /etc/sysctl.conf
echo "kernel.shmall=${KERNEL_SHMALL}" >> /etc/sysctl.conf
# Put lock file to make sure conf was not reinitialized
touch "${SETUP_LOCKFILE}"