kopia lustrzana https://github.com/kartoza/docker-postgis
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
pull/161/head
rodzic
b4956aa2b6
commit
290817ebfc
|
@ -11,7 +11,7 @@ RUN dpkg-divert --local --rename --add /sbin/initctl
|
|||
|
||||
RUN apt-get -y update; apt-get -y install gnupg2 wget ca-certificates rpl pwgen gdal-bin
|
||||
|
||||
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main" > /etc/apt/sources.list.d/postgresql.list'
|
||||
RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ ${IMAGE_VERSION}-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
||||
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | apt-key add -
|
||||
|
||||
#-------------Application Specific Stuff ----------------------------------------------------
|
||||
|
@ -19,7 +19,7 @@ RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | a
|
|||
# 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-get update; apt-get install -y postgresql-client-11 postgresql-common postgresql-11 postgresql-11-postgis-2.5 postgresql-11-pgrouting netcat postgresql-11-ogr-fdw
|
||||
RUN apt-get update; apt-get install -y postgresql-client-12 postgresql-common postgresql-12 postgresql-12-postgis-3 netcat postgresql-12-ogr-fdw postgresql-12-postgis-3-scripts
|
||||
|
||||
# Open port 5432 so linked containers can see them
|
||||
EXPOSE 5432
|
||||
|
|
|
@ -123,7 +123,6 @@ You can open up the PG port by using the following environment variable. By defa
|
|||
the container will allow connections only from the docker private subnet.
|
||||
|
||||
* -e ALLOW_IP_RANGE=<0.0.0.0/0> By default
|
||||
t
|
||||
|
||||
Postgres conf is setup to listen to all connections and if a user needs to restrict which IP address
|
||||
PostgreSQL listens to you can define it with the following environment variable. The default is set to listen to
|
||||
|
@ -238,7 +237,7 @@ Master settings:
|
|||
- **ALLOW_IP_RANGE**: A pg_hba.conf domain format which will allow specified host(s)
|
||||
to connect into the container. This is needed to allow the `slave` to connect
|
||||
into `master`, so specifically this settings should allow `slave` address. It is also needed to allow clients on other hosts to connect to either the slave or the master.
|
||||
- **REPLICATION_USER** Username to initiate streaming replication
|
||||
- **REPLICATION_USER** User to initiate streaming replication
|
||||
- **REPLICATION_PASS** Password for a user with streaming replication role
|
||||
|
||||
Slave settings:
|
||||
|
@ -257,7 +256,7 @@ Slave settings:
|
|||
as `master` for a while. However, the promoted replicant will break consistencies and
|
||||
is not able to revert to replicant anymore, unless it is destroyed and resynced
|
||||
with the new master.
|
||||
- **REPLICATION_USER** Username to initiate streaming replication
|
||||
- **REPLICATION_USER** User to initiate streaming replication
|
||||
- **REPLICATION_PASS** Password for a user with streaming replication role
|
||||
|
||||
To run the sample replication, follow these instructions:
|
||||
|
|
2
build.sh
2
build.sh
|
@ -1,3 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
docker build -t kartoza/postgis:manual-build .
|
||||
docker build -t kartoza/postgis:11.0-2.5 .
|
||||
docker build -t kartoza/postgis:12.0 .
|
||||
|
|
|
@ -8,7 +8,7 @@ volumes:
|
|||
services:
|
||||
|
||||
db:
|
||||
image: kartoza/postgis:11.0-2.5
|
||||
image: kartoza/postgis:12.0
|
||||
volumes:
|
||||
- postgis-data:/var/lib/postgresql
|
||||
- dbbackups:/backups
|
||||
|
@ -27,19 +27,19 @@ services:
|
|||
test: "exit 0"
|
||||
|
||||
dbbackups:
|
||||
image: kartoza/pg-backup:11.0
|
||||
image: kartoza/pg-backup:12.0
|
||||
hostname: pg-backups
|
||||
volumes:
|
||||
- dbbackups:/backups
|
||||
links:
|
||||
- db:db
|
||||
environment:
|
||||
- DUMPPREFIX=demo
|
||||
- PGUSER=docker
|
||||
- PGPASSWORD=docker
|
||||
- PGDATABASE=gis
|
||||
- PGPORT=5432
|
||||
- PGHOST=db
|
||||
- DUMPPREFIX=PG_db
|
||||
- POSTGRES_USER=docker
|
||||
- POSTGRES_PASS=docker
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_HOST=db
|
||||
- POSTGRES_DBNAME=gis
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
db:
|
||||
|
|
|
@ -14,6 +14,8 @@ source /setup-ssl.sh
|
|||
|
||||
source /setup-pg_hba.sh
|
||||
|
||||
|
||||
|
||||
# Running extended script or sql if provided.
|
||||
# Useful for people who extends the image.
|
||||
function entry_point_script {
|
||||
|
|
29
env-data.sh
29
env-data.sh
|
@ -1,20 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
DATADIR="/var/lib/postgresql/11/main"
|
||||
ROOT_CONF="/etc/postgresql/11/main"
|
||||
DATADIR="/var/lib/postgresql/12/main"
|
||||
ROOT_CONF="/etc/postgresql/12/main"
|
||||
PG_ENV="$ROOT_CONF/environment"
|
||||
CONF="$ROOT_CONF/postgresql.conf"
|
||||
WAL_ARCHIVE="/opt/archivedir"
|
||||
RECOVERY_CONF="$ROOT_CONF/recovery.conf"
|
||||
POSTGRES="/usr/lib/postgresql/11/bin/postgres"
|
||||
INITDB="/usr/lib/postgresql/11/bin/initdb"
|
||||
SQLDIR="/usr/share/postgresql/11/contrib/postgis-2.5/"
|
||||
POSTGRES="/usr/lib/postgresql/12/bin/postgres"
|
||||
INITDB="/usr/lib/postgresql/12/bin/initdb"
|
||||
SQLDIR="/usr/share/postgresql/12/contrib/postgis-3.0/"
|
||||
SETVARS="POSTGIS_ENABLE_OUTDB_RASTERS=1 POSTGIS_GDAL_ENABLED_DRIVERS=ENABLE_ALL"
|
||||
LOCALONLY="-c listen_addresses='127.0.0.1'"
|
||||
PG_BASEBACKUP="/usr/bin/pg_basebackup"
|
||||
PROMOTE_FILE="/tmp/pg_promote_master"
|
||||
PGSTAT_TMP="/var/run/postgresql/"
|
||||
PG_PID="/var/run/postgresql/11-main.pid"
|
||||
PG_PID="/var/run/postgresql/12-main.pid"
|
||||
|
||||
|
||||
# Make sure we have a user set up
|
||||
|
@ -95,7 +95,7 @@ if [ -z "${SSL_KEY_FILE}" ]; then
|
|||
fi
|
||||
|
||||
if [ -z "${POSTGRES_MULTIPLE_EXTENSIONS}" ]; then
|
||||
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology'
|
||||
POSTGRES_MULTIPLE_EXTENSIONS='postgis,hstore,postgis_topology,postgis_raster'
|
||||
fi
|
||||
|
||||
if [ -z "${ALLOW_IP_RANGE}" ]; then
|
||||
|
@ -111,6 +111,21 @@ if [ -z "${DEFAULT_CTYPE}" ]; then
|
|||
DEFAULT_CTYPE="en_US.UTF-8"
|
||||
fi
|
||||
|
||||
if [ -z "${TARGET_TIMELINE}" ]; then
|
||||
TARGET_TIMELINE='latest'
|
||||
fi
|
||||
|
||||
if [ -z "${TARGET_ACTION}" ]; then
|
||||
TARGET_ACTION='promote'
|
||||
fi
|
||||
|
||||
if [ -z "${REPLICATION_USER}" ]; then
|
||||
REPLICATION_USER=replicator
|
||||
fi
|
||||
|
||||
if [ -z "${REPLICATION_PASS}" ]; then
|
||||
REPLICATION_PASS=replicator
|
||||
fi
|
||||
if [ -z "${REPLICATION_USER}" ]; then
|
||||
REPLICATION_USER=replicator
|
||||
fi
|
||||
|
|
|
@ -34,8 +34,14 @@ max_parallel_workers = ${MAX_WORKERS}
|
|||
checkpoint_timeout = ${CHECK_POINT_TIMEOUT}
|
||||
#archive_mode=on
|
||||
#archive_command = 'test ! -f ${WAL_ARCHIVE}/%f && cp -r %p ${WAL_ARCHIVE}/%f'
|
||||
primary_conninfo = 'host=${REPLICATE_FROM} port=${REPLICATE_PORT} user=${REPLICATION_USER} password=${REPLICATION_PASS} sslmode=${PGSSLMODE}'
|
||||
recovery_target_timeline=${TARGET_TIMELINE}
|
||||
recovery_target_action=${TARGET_ACTION}
|
||||
promote_trigger_file = '${PROMOTE_FILE}'
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
echo -e $EXTRA_CONF >> $CONF
|
||||
|
||||
# Optimise PostgreSQL shared memory for PostGIS
|
||||
|
|
|
@ -30,7 +30,7 @@ function configure_replication_permissions {
|
|||
}
|
||||
|
||||
function streaming_replication {
|
||||
until su - postgres -c "${PG_BASEBACKUP} -X stream -h ${REPLICATE_FROM} -p ${REPLICATE_PORT} -D ${DATADIR} -U ${REPLICATION_USER} -vP -w --label=gis_pg_custer"
|
||||
until su - postgres -c "${PG_BASEBACKUP} -X stream -h ${REPLICATE_FROM} -p ${REPLICATE_PORT} -D ${DATADIR} -U ${REPLICATION_USER} -R -vP -w --label=gis_pg_custer"
|
||||
do
|
||||
echo "Waiting for master to connect..."
|
||||
sleep 1s
|
||||
|
@ -55,18 +55,8 @@ if [[ "$DESTROY_DATABASE_ON_RESTART" =~ [Tt][Rr][Uu][Ee] ]]; then
|
|||
fi
|
||||
|
||||
|
||||
# Setup recovery.conf, a configuration file for slave
|
||||
cat > ${DATADIR}/recovery.conf <<EOF
|
||||
standby_mode = on
|
||||
primary_conninfo = 'host=${REPLICATE_FROM} port=${REPLICATE_PORT} user=${REPLICATION_USER} password=${REPLICATION_PASS} sslmode=${PGSSLMODE}'
|
||||
trigger_file = '${PROMOTE_FILE}'
|
||||
recovery_target_timeline='latest'
|
||||
recovery_target_action='promote'
|
||||
#restore_command = 'cp /opt/archive/%f "%p"' Use if you are syncing the wal segments from master
|
||||
EOF
|
||||
# Setup permissions. Postgres won't start without this.
|
||||
chown postgres ${DATADIR}/recovery.conf
|
||||
chmod 600 ${DATADIR}/recovery.conf
|
||||
|
||||
|
||||
|
||||
# Promote to master if desired
|
||||
if [[ ! -z "${PROMOTE_MASTER}" ]]; then
|
||||
|
|
Ładowanie…
Reference in New Issue