From c4f007713604c8078d384e1ae342c3e195c11c67 Mon Sep 17 00:00:00 2001 From: Artur Mustafin Date: Mon, 24 Feb 2020 08:27:47 +0300 Subject: [PATCH] added EXTRA_CONF for 9.6-2.4 (#208) * added EXTRA_CONF https://github.com/kartoza/docker-postgis/issues/207 * added EXTRA_CONF https://github.com/kartoza/docker-postgis/issues/207 * added EXTRA_CONF https://github.com/kartoza/docker-postgis/issues/207 * added install script * added working example based on ubunty 18.04 * additional block inot needed --- Dockerfile | 17 +++++++++-------- README.md | 5 +++++ env-data.sh | 4 ++++ setup-conf.sh | 1 + 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index abfacbd..baf1cdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,17 +2,18 @@ FROM debian:stable MAINTAINER Tim Sutton -RUN apt -y update; apt -y install gnupg2 wget ca-certificates rpl pwgen -RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" > /etc/apt/sources.list.d/pgdg.list' -RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt-get -y update && \ + apt-get -y install lsb-release wget software-properties-common gnupg2 && \ + sh -c 'echo OS: `lsb_release -cs`' +RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' && \ + wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - +RUN apt-get -y update && apt-get -y upgrade && apt-get -y install postgresql-9.6 +RUN apt-get -y install postgresql-client-9.6 postgresql-common postgresql-9.6-postgis-2.4 postgresql-9.6-pgrouting netcat #-------------Application Specific Stuff ---------------------------------------------------- -# We add postgis as well to prevent build errors (that we dont see on local builds) -# on docker hub e.g. -# The following packages have unmet dependencies: -RUN apt -y update; apt install -y postgresql-client-9.6 postgresql-common postgresql-9.6 postgresql-9.6-postgis-2.4 postgresql-9.6-pgrouting netcat - # Open port 5432 so linked containers can see them EXPOSE 5432 diff --git a/README.md b/README.md index 466fe44..ec4b65e 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,11 @@ PostgreSQL listens to you can define it with the following environment variable. all connections. * -e IP_LIST=<*> +#### Additional configuration + +You can also define any other configuration to add to `postgres.conf`, separated by '\n' e.g.: + +* `-e EXTRA_CONF="log_destination = 'stderr'\nlogging_collector = on"` ## Convenience docker-compose.yml diff --git a/env-data.sh b/env-data.sh index b90ef10..dcc5edf 100644 --- a/env-data.sh +++ b/env-data.sh @@ -66,3 +66,7 @@ fi if [ ! -z "$POSTGRES_DB" ]; then POSTGRES_DBNAME=${POSTGRES_DB} fi + +if [ -z "$EXTRA_CONF" ]; then + EXTRA_CONF="" +fi diff --git a/setup-conf.sh b/setup-conf.sh index dce1d4d..f1acb19 100644 --- a/setup-conf.sh +++ b/setup-conf.sh @@ -28,3 +28,4 @@ EOF echo "kernel.shmmax=543252480" >> /etc/sysctl.conf echo "kernel.shmall=2097152" >> /etc/sysctl.conf +echo -e $EXTRA_CONF >> $CONF