kopia lustrzana https://github.com/kartoza/docker-postgis
Resolved merge conflicts
commit
30d3260239
|
@ -13,6 +13,12 @@ RUN dpkg-divert --local --rename --add /sbin/initctl
|
|||
ADD 71-apt-cacher-ng /etc/apt/apt.conf.d/71-apt-cacher-ng
|
||||
|
||||
#RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
|
||||
# Add the PostgreSQL PGP key to verify their Debian packages.
|
||||
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc
|
||||
RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8
|
||||
# Add PostgreSQL's repository. It contains the most recent stable release
|
||||
# of PostgreSQL, ``9.5``.
|
||||
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
||||
RUN apt-get -y update
|
||||
RUN apt-get -y install ca-certificates rpl pwgen
|
||||
|
||||
|
@ -23,7 +29,7 @@ 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.4-postgis-2.1 postgis netcat
|
||||
RUN apt-get install -y postgresql-9.5-postgis-2.2 netcat
|
||||
ADD postgres.conf /etc/supervisor/conf.d/postgres.conf
|
||||
|
||||
# Open port 5432 so linked containers can see them
|
||||
|
|
10
README.md
10
README.md
|
@ -30,7 +30,7 @@ kartoza/postgis:[postgres_version]-[postgis-version]
|
|||
|
||||
So for example:
|
||||
|
||||
``kartoza/postgis:9.4-2.1`` Provides PostgreSQL 9.4, PostGIS 2.1
|
||||
``kartoza/postgis:9.5-2.2`` Provides PostgreSQL 9.5, PostGIS 2.2
|
||||
|
||||
**Note:** We highly recommend that you use tagged versions because
|
||||
successive minor versions of PostgreSQL write their database clusters
|
||||
|
@ -82,6 +82,8 @@ To create a running container do:
|
|||
sudo docker run --name "postgis" -p 25432:5432 -d -t kartoza/postgis
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
|
||||
You can also use the following environment variables to pass a
|
||||
user name and password.
|
||||
|
||||
|
@ -92,6 +94,12 @@ These will be used to create a new superuser with
|
|||
your preferred credentials. If these are not specified then the postgresql
|
||||
user is set to 'docker' with password 'docker'.
|
||||
|
||||
You can open up the PG port by using the following environment variable. By default
|
||||
the container will allow connections only from the docker private subnet.
|
||||
|
||||
* -e ALLOW_IP_RANGE=<0.0.0.0/0>
|
||||
|
||||
|
||||
## Convenience run script
|
||||
|
||||
For convenience we have provided a bash script for running this container
|
||||
|
|
|
@ -80,7 +80,7 @@ eval $CMD
|
|||
|
||||
docker ps | grep ${CONTAINER_NAME}
|
||||
|
||||
IPADDRESS=`docker inspect postgis | grep IPAddress | grep -o '[0-9\.]*'`
|
||||
IPADDRESS=`docker inspect ${CONTAINER_NAME} | grep IPAddress | grep -o '[0-9\.]*'`
|
||||
|
||||
echo "Connect using:"
|
||||
echo "psql -l -p 5432 -h $IPADDRESS -U $PGUSER"
|
||||
|
|
9
setup.sh
9
setup.sh
|
@ -1,15 +1,16 @@
|
|||
# Add any additional setup tasks here
|
||||
chmod 600 /etc/ssl/private/ssl-cert-snakeoil.key
|
||||
|
||||
# These tasks are run as root
|
||||
CONF="/etc/postgresql/9.4/main/postgresql.conf"
|
||||
CONF="/etc/postgresql/9.5/main/postgresql.conf"
|
||||
|
||||
# Restrict subnet to docker private network
|
||||
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
|
||||
echo "host all all 172.17.0.0/16 md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
# And allow access from DockerToolbox / Boottodocker on OSX
|
||||
echo "host all all 192.168.0.0/16 md5" >> /etc/postgresql/9.4/main/pg_hba.conf
|
||||
# Listen on all ip addresses
|
||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf
|
||||
echo "port = 5432" >> /etc/postgresql/9.4/main/postgresql.conf
|
||||
echo "listen_addresses = '*'" >> /etc/postgresql/9.5/main/postgresql.conf
|
||||
echo "port = 5432" >> /etc/postgresql/9.5/main/postgresql.conf
|
||||
|
||||
# Enable ssl
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[program:sshd]
|
||||
user=root
|
||||
command=/usr/sbin/sshd -D
|
||||
autorestart=true
|
||||
stopsignal=INT
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
# This script will run as the postgres user due to the Dockerfile USER directive
|
||||
|
||||
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/"
|
||||
DATADIR="/var/lib/postgresql/9.5/main"
|
||||
CONF="/etc/postgresql/9.5/main/postgresql.conf"
|
||||
POSTGRES="/usr/lib/postgresql/9.5/bin/postgres"
|
||||
INITDB="/usr/lib/postgresql/9.5/bin/initdb"
|
||||
SQLDIR="/usr/share/postgresql/9.5/contrib/postgis-2.2/"
|
||||
LOCALONLY="-c listen_addresses='127.0.0.1, ::1'"
|
||||
|
||||
# /etc/ssl/private can't be accessed from within container for some reason
|
||||
|
@ -18,8 +18,8 @@ rm -r /etc/ssl
|
|||
mv /tmp/ssl-copy /etc/ssl
|
||||
|
||||
# Needed under debian, wasnt needed under ubuntu
|
||||
mkdir /var/run/postgresql/9.4-main.pg_stat_tmp
|
||||
chmod 0777 /var/run/postgresql/9.4-main.pg_stat_tmp
|
||||
mkdir /var/run/postgresql/9.5-main.pg_stat_tmp
|
||||
chmod 0777 /var/run/postgresql/9.5-main.pg_stat_tmp
|
||||
|
||||
# test if DATADIR is existent
|
||||
if [ ! -d $DATADIR ]; then
|
||||
|
@ -63,6 +63,12 @@ if [ -z "$TOPOLOGY" ]; then
|
|||
TOPOLOGY=true
|
||||
fi
|
||||
|
||||
# Custom IP range via docker run -e (https://docs.docker.com/engine/reference/run/#env-environment-variables)
|
||||
# Usage is: docker run [...] -e ALLOW_IP_RANGE='192.168.0.0/16'
|
||||
if [ "$ALLOW_IP_RANGE" ]
|
||||
then
|
||||
echo "host all all $ALLOW_IP_RANGE md5" >> /etc/postgresql/9.5/main/pg_hba.conf
|
||||
fi
|
||||
|
||||
# redirect user/pass into a file so we can echo it into
|
||||
# docker logs when container starts
|
||||
|
@ -128,7 +134,7 @@ fi
|
|||
# This should show up in docker logs afterwards
|
||||
su - postgres -c "psql -l"
|
||||
|
||||
PID=`cat /var/run/postgresql/9.4-main.pid`
|
||||
PID=`cat /var/run/postgresql/9.5-main.pid`
|
||||
kill -9 ${PID}
|
||||
echo "Postgres initialisation process completed .... restarting in foreground"
|
||||
SETVARS="POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL"
|
||||
|
|
Ładowanie…
Reference in New Issue