kopia lustrzana https://github.com/kartoza/docker-postgis
Add python 3 Test on Travis (#193)
* Shell script clean up * Add python 3 test * Add travis Test for Python 3pull/200/head
rodzic
166e7aeb1a
commit
5a12120d1f
|
@ -5,11 +5,11 @@ language: python
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
virtualenv:
|
|
||||||
system_site_packages: true
|
|
||||||
|
|
||||||
python:
|
python:
|
||||||
- '2.7'
|
- '2.7'
|
||||||
|
- '3.5'
|
||||||
|
- '3.6.7'
|
||||||
|
- '3.7.1'
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./build.sh
|
- ./build.sh
|
||||||
|
|
|
@ -49,8 +49,8 @@ ADD setup-replication.sh /
|
||||||
ADD setup-ssl.sh /
|
ADD setup-ssl.sh /
|
||||||
ADD setup-user.sh /
|
ADD setup-user.sh /
|
||||||
RUN chmod +x /docker-entrypoint.sh
|
RUN chmod +x /docker-entrypoint.sh
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||||
&& dpkg --remove --force-depends unzip
|
&& dpkg --remove --force-depends unzip
|
||||||
|
|
||||||
ENTRYPOINT /docker-entrypoint.sh
|
ENTRYPOINT /docker-entrypoint.sh
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
[](https://travis-ci.org/kartoza/docker-postgis)
|
||||||
|
|
||||||
# docker-postgis
|
# docker-postgis
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +97,7 @@ user name, password and/or default database name(or multiple databases comma sep
|
||||||
* -e POSTGRES_USER=<PGUSER>
|
* -e POSTGRES_USER=<PGUSER>
|
||||||
* -e POSTGRES_PASS=<PGPASSWORD>
|
* -e POSTGRES_PASS=<PGPASSWORD>
|
||||||
* -e POSTGRES_DBNAME=<PGDBNAME>
|
* -e POSTGRES_DBNAME=<PGDBNAME>
|
||||||
* -e POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology
|
* -e POSTGRES_MULTIPLE_EXTENSIONS=postgis,hstore,postgis_topology
|
||||||
|
|
||||||
You can pass as many extensions as you need.
|
You can pass as many extensions as you need.
|
||||||
* -e SSL_CERT_FILE=/your/own/ssl_cert_file.pem
|
* -e SSL_CERT_FILE=/your/own/ssl_cert_file.pem
|
||||||
|
@ -247,7 +249,7 @@ Master settings:
|
||||||
to connect into the container. This is needed to allow the `slave` to connect
|
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.
|
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** User to initiate streaming replication
|
- **REPLICATION_USER** User to initiate streaming replication
|
||||||
- **REPLICATION_PASS** Password for a user with streaming replication role
|
- **REPLICATION_PASS** Password for a user with streaming replication role
|
||||||
|
|
||||||
Slave settings:
|
Slave settings:
|
||||||
- **REPLICATE_FROM**: This should be the domain name or IP address of the `master`
|
- **REPLICATE_FROM**: This should be the domain name or IP address of the `master`
|
||||||
|
@ -266,7 +268,7 @@ Slave settings:
|
||||||
is not able to revert to replicant anymore, unless it is destroyed and resynced
|
is not able to revert to replicant anymore, unless it is destroyed and resynced
|
||||||
with the new master.
|
with the new master.
|
||||||
- **REPLICATION_USER** User to initiate streaming replication
|
- **REPLICATION_USER** User to initiate streaming replication
|
||||||
- **REPLICATION_PASS** Password for a user with streaming replication role
|
- **REPLICATION_PASS** Password for a user with streaming replication role
|
||||||
|
|
||||||
To run the sample replication, follow these instructions:
|
To run the sample replication, follow these instructions:
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ source /setup-pg_hba.sh
|
||||||
function entry_point_script {
|
function entry_point_script {
|
||||||
SETUP_LOCKFILE="/docker-entrypoint-initdb.d/.entry_point.lock"
|
SETUP_LOCKFILE="/docker-entrypoint-initdb.d/.entry_point.lock"
|
||||||
if [[ -f "${SETUP_LOCKFILE}" ]]; then
|
if [[ -f "${SETUP_LOCKFILE}" ]]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
if find "/docker-entrypoint-initdb.d" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then
|
if find "/docker-entrypoint-initdb.d" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then
|
||||||
for f in /docker-entrypoint-initdb.d/*; do
|
for f in /docker-entrypoint-initdb.d/*; do
|
||||||
|
@ -58,31 +58,31 @@ done
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z "$REPLICATE_FROM" ]]; then
|
if [[ -z "$REPLICATE_FROM" ]]; then
|
||||||
# This means this is a master instance. We check that database exists
|
# This means this is a master instance. We check that database exists
|
||||||
echo "Setup master database"
|
echo "Setup master database"
|
||||||
source /setup-database.sh
|
source /setup-database.sh
|
||||||
entry_point_script
|
entry_point_script
|
||||||
kill_postgres
|
kill_postgres
|
||||||
else
|
else
|
||||||
# This means this is a slave/replication instance.
|
# This means this is a slave/replication instance.
|
||||||
echo "Setup slave database"
|
echo "Setup slave database"
|
||||||
source /setup-replication.sh
|
source /setup-replication.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# If no arguments passed to entrypoint, then run postgres by default
|
# If no arguments passed to entrypoint, then run postgres by default
|
||||||
if [[ $# -eq 0 ]];
|
if [[ $# -eq 0 ]];
|
||||||
then
|
then
|
||||||
echo "Postgres initialisation process completed .... restarting in foreground"
|
echo "Postgres initialisation process completed .... restarting in foreground"
|
||||||
|
|
||||||
su - postgres -c "$SETVARS $POSTGRES -D $DATADIR -c config_file=$CONF"
|
su - postgres -c "$SETVARS $POSTGRES -D $DATADIR -c config_file=$CONF"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If arguments passed, run postgres with these arguments
|
# If arguments passed, run postgres with these arguments
|
||||||
# This will make sure entrypoint will always be executed
|
# This will make sure entrypoint will always be executed
|
||||||
if [[ "${1:0:1}" = '-' ]]; then
|
if [[ "${1:0:1}" = '-' ]]; then
|
||||||
# append postgres into the arguments
|
# append postgres into the arguments
|
||||||
set -- postgres "$@"
|
set -- postgres "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su - "$@"
|
exec su - "$@"
|
||||||
|
|
|
@ -62,7 +62,7 @@ for db in $(echo ${POSTGRES_DBNAME} | tr ',' ' '); do
|
||||||
RESULT=`su - postgres -c "psql -t -c \"SELECT count(1) from pg_database where datname='${db}';\""`
|
RESULT=`su - postgres -c "psql -t -c \"SELECT count(1) from pg_database where datname='${db}';\""`
|
||||||
if [[ ${RESULT} -eq 0 ]]; then
|
if [[ ${RESULT} -eq 0 ]]; then
|
||||||
echo "Create db ${db}"
|
echo "Create db ${db}"
|
||||||
su - postgres -c "createdb -O ${POSTGRES_USER} ${db}"
|
su - postgres -c "createdb -O ${POSTGRES_USER} ${db}"
|
||||||
for ext in $(echo ${POSTGRES_MULTIPLE_EXTENSIONS} | tr ',' ' '); do
|
for ext in $(echo ${POSTGRES_MULTIPLE_EXTENSIONS} | tr ',' ' '); do
|
||||||
echo "Enabling ${ext} in the database ${db}"
|
echo "Enabling ${ext} in the database ${db}"
|
||||||
su - postgres -c "psql -c 'CREATE EXTENSION IF NOT EXISTS ${ext} cascade;' $db"
|
su - postgres -c "psql -c 'CREATE EXTENSION IF NOT EXISTS ${ext} cascade;' $db"
|
||||||
|
@ -79,5 +79,3 @@ done
|
||||||
rm custom.sql
|
rm custom.sql
|
||||||
# This should show up in docker logs afterwards
|
# This should show up in docker logs afterwards
|
||||||
su - postgres -c "psql -l"
|
su - postgres -c "psql -l"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ function configure_replication_permissions {
|
||||||
|
|
||||||
echo "Setup data permissions"
|
echo "Setup data permissions"
|
||||||
echo "----------------------"
|
echo "----------------------"
|
||||||
chown -R postgres:postgres $(getent passwd postgres | cut -d: -f6)
|
chown -R postgres:postgres $(getent passwd postgres | cut -d: -f6)
|
||||||
su - postgres -c "echo \"${REPLICATE_FROM}:${REPLICATE_PORT}:*:${REPLICATION_USER}:${REPLICATION_PASS}\" > ~/.pgpass"
|
su - postgres -c "echo \"${REPLICATE_FROM}:${REPLICATE_PORT}:*:${REPLICATION_USER}:${REPLICATION_PASS}\" > ~/.pgpass"
|
||||||
su - postgres -c "chmod 0600 ~/.pgpass"
|
su - postgres -c "chmod 0600 ~/.pgpass"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ fi
|
||||||
# This script will setup default SSL config
|
# This script will setup default SSL config
|
||||||
|
|
||||||
# /etc/ssl/private can't be accessed from within container for some reason
|
# /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
|
# (@andrewgodwin says it's something AUFS related) - taken from https://github.com/orchardup/docker-postgresql/blob/master/Dockerfile
|
||||||
cp -r /etc/ssl /tmp/ssl-copy/
|
cp -r /etc/ssl /tmp/ssl-copy/
|
||||||
chmod -R 0700 /etc/ssl
|
chmod -R 0700 /etc/ssl
|
||||||
chown -R postgres /tmp/ssl-copy
|
chown -R postgres /tmp/ssl-copy
|
||||||
|
|
Ładowanie…
Reference in New Issue