From cd39da18fe543e839cf3267693faf4ef631f6ee2 Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Tue, 11 Aug 2015 23:54:59 +0200 Subject: [PATCH 1/3] Fix incorrect version in 9.4 branch --- Dockerfile | 5 +++-- setup.sh | 8 ++++---- start-postgis.sh | 16 ++++++++-------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 647016e..48ee356 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ #--------- Generic stuff all our Dockerfiles should start with so we get caching ------------ -FROM ubuntu:14.04 +FROM debian:stable MAINTAINER Tim Sutton RUN export DEBIAN_FRONTEND=noninteractive @@ -23,7 +23,8 @@ RUN apt-get -y install ca-certificates rpl pwgen # The following packages have unmet dependencies: # postgresql-9.3-postgis-2.1 : Depends: libgdal1h (>= 1.9.0) but it is not going to be installed # Recommends: postgis but it is not going to be installed -RUN apt-get install -y postgresql-9.3-postgis-2.1 postgis +RUN apt-get install -y postgresql-9.4-postgis-2.1 postgis +ADD postgres.conf /etc/supervisor/conf.d/postgres.conf # Open port 5432 so linked containers can see them EXPOSE 5432 diff --git a/setup.sh b/setup.sh index 52ea0fd..1a50933 100755 --- a/setup.sh +++ b/setup.sh @@ -1,13 +1,13 @@ # Add any additional setup tasks here # These tasks are run as root -CONF="/etc/postgresql/9.3/main/postgresql.conf" +CONF="/etc/postgresql/9.4/main/postgresql.conf" # Restrict subnet to docker private network -echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.3/main/pg_hba.conf +echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.4/main/pg_hba.conf # Listen on all ip addresses -echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/postgresql.conf -echo "port = 5432" >> /etc/postgresql/9.3/main/postgresql.conf +echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf +echo "port = 5432" >> /etc/postgresql/9.4/main/postgresql.conf # Enable ssl diff --git a/start-postgis.sh b/start-postgis.sh index cd4c7c1..ac2f05f 100755 --- a/start-postgis.sh +++ b/start-postgis.sh @@ -2,11 +2,11 @@ # This script will run as the postgres user due to the Dockerfile USER directive -DATADIR="/var/lib/postgresql/9.3/main" -CONF="/etc/postgresql/9.3/main/postgresql.conf" -POSTGRES="/usr/lib/postgresql/9.3/bin/postgres" -INITDB="/usr/lib/postgresql/9.3/bin/initdb" -SQLDIR="/usr/share/postgresql/9.3/contrib/postgis-2.1/" +DATADIR="/var/lib/postgresql/9.4/main" +CONF="/etc/postgresql/9.4/main/postgresql.conf" +POSTGRES="/usr/lib/postgresql/9.4/bin/postgres" +INITDB="/usr/lib/postgresql/9.4/bin/initdb" +SQLDIR="/usr/share/postgresql/9.4/contrib/postgis-2.1/" # /etc/ssl/private can't be accessed from within container for some reason # (@andrewgodwin says it's something AUFS related) - taken from https://github.com/orchardup/docker-postgresql/blob/master/Dockerfile @@ -17,8 +17,8 @@ rm -r /etc/ssl mv /tmp/ssl-copy /etc/ssl # Needed under debian, wasnt needed under ubuntu -mkdir /var/run/postgresql/9.3-main.pg_stat_tmp -chmod 0777 /var/run/postgresql/9.3-main.pg_stat_tmp +mkdir /var/run/postgresql/9.4-main.pg_stat_tmp +chmod 0777 /var/run/postgresql/9.4-main.pg_stat_tmp # test if DATADIR is existent if [ ! -d $DATADIR ]; then @@ -123,7 +123,7 @@ fi # This should show up in docker logs afterwards su - postgres -c "psql -l" -PID=`cat /var/run/postgresql/9.3-main.pid` +PID=`cat /var/run/postgresql/9.4-main.pid` kill -9 ${PID} echo "Postgres initialisation process completed .... restarting in foreground" su - postgres -c "$POSTGRES -D $DATADIR -c config_file=$CONF" From 272af0e471f699ef5d684b7e74c397835e8dc5ab Mon Sep 17 00:00:00 2001 From: Luke Swart Date: Wed, 2 Sep 2015 12:10:28 -0700 Subject: [PATCH 2/3] Fix TOPOLOGY conditional typo --- start-postgis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start-postgis.sh b/start-postgis.sh index ac2f05f..f085e3f 100755 --- a/start-postgis.sh +++ b/start-postgis.sh @@ -86,7 +86,7 @@ then if [[ ${HSTORE} == "true" ]]; then echo 'HSTORE is only useful when you create the postgis database.' fi - if [[] ${TOPOLOGY} == "true" ]]; then + if [[ ${TOPOLOGY} == "true" ]]; then echo 'TOPOLOGY is only useful when you create the postgis database.' fi else From 540b2e00c2cc79958d1e792347d692f015291a2a Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Mon, 14 Sep 2015 11:57:12 +0300 Subject: [PATCH 3/3] Updates from Marco --- run-postgis-docker.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run-postgis-docker.sh b/run-postgis-docker.sh index 2af1ca6..a2d92b5 100755 --- a/run-postgis-docker.sh +++ b/run-postgis-docker.sh @@ -7,6 +7,9 @@ cat << EOF usage: $0 options This script runs a new docker postgis instance for you. +To get the image run: +docker pull kartoza/postgis + OPTIONS: -h Show this message @@ -77,6 +80,8 @@ eval $CMD docker ps | grep ${CONTAINER_NAME} +IPADDRESS=`docker inspect postgis | grep IPAddress | grep -o '[0-9\.]*'` + echo "Connect using:" echo "psql -l -p 5432 -h $IPADDRESS -U $PGUSER" echo "and password $PGPASSWORD" @@ -87,4 +92,3 @@ echo "Will make the connection details to the postgis server available" echo "in your app container as $PG_PORT_5432_TCP_ADDR (for the ip address)" echo "and $PG_PORT_5432_TCP_PORT (for the port number)." -