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:
|
||||
- docker
|
||||
|
||||
virtualenv:
|
||||
system_site_packages: true
|
||||
|
||||
python:
|
||||
- '2.7'
|
||||
- '3.5'
|
||||
- '3.6.7'
|
||||
- '3.7.1'
|
||||
|
||||
script:
|
||||
- ./build.sh
|
||||
|
|
|
@ -49,8 +49,8 @@ ADD setup-replication.sh /
|
|||
ADD setup-ssl.sh /
|
||||
ADD setup-user.sh /
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& dpkg --remove --force-depends unzip
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
|
||||
&& dpkg --remove --force-depends unzip
|
||||
|
||||
ENTRYPOINT /docker-entrypoint.sh
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
[](https://travis-ci.org/kartoza/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_PASS=<PGPASSWORD>
|
||||
* -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.
|
||||
* -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
|
||||
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_PASS** Password for a user with streaming replication role
|
||||
- **REPLICATION_PASS** Password for a user with streaming replication role
|
||||
|
||||
Slave settings:
|
||||
- **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
|
||||
with the new master.
|
||||
- **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:
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ source /setup-pg_hba.sh
|
|||
function entry_point_script {
|
||||
SETUP_LOCKFILE="/docker-entrypoint-initdb.d/.entry_point.lock"
|
||||
if [[ -f "${SETUP_LOCKFILE}" ]]; then
|
||||
return 0
|
||||
return 0
|
||||
else
|
||||
if find "/docker-entrypoint-initdb.d" -mindepth 1 -print -quit 2>/dev/null | grep -q .; then
|
||||
for f in /docker-entrypoint-initdb.d/*; do
|
||||
|
@ -58,31 +58,31 @@ done
|
|||
}
|
||||
|
||||
if [[ -z "$REPLICATE_FROM" ]]; then
|
||||
# This means this is a master instance. We check that database exists
|
||||
echo "Setup master database"
|
||||
source /setup-database.sh
|
||||
entry_point_script
|
||||
kill_postgres
|
||||
# This means this is a master instance. We check that database exists
|
||||
echo "Setup master database"
|
||||
source /setup-database.sh
|
||||
entry_point_script
|
||||
kill_postgres
|
||||
else
|
||||
# This means this is a slave/replication instance.
|
||||
echo "Setup slave database"
|
||||
source /setup-replication.sh
|
||||
# This means this is a slave/replication instance.
|
||||
echo "Setup slave database"
|
||||
source /setup-replication.sh
|
||||
fi
|
||||
|
||||
|
||||
# If no arguments passed to entrypoint, then run postgres by default
|
||||
if [[ $# -eq 0 ]];
|
||||
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
|
||||
|
||||
# If arguments passed, run postgres with these arguments
|
||||
# This will make sure entrypoint will always be executed
|
||||
if [[ "${1:0:1}" = '-' ]]; then
|
||||
# append postgres into the arguments
|
||||
set -- postgres "$@"
|
||||
# append postgres into the arguments
|
||||
set -- postgres "$@"
|
||||
fi
|
||||
|
||||
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}';\""`
|
||||
if [[ ${RESULT} -eq 0 ]]; then
|
||||
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
|
||||
echo "Enabling ${ext} in the database ${db}"
|
||||
su - postgres -c "psql -c 'CREATE EXTENSION IF NOT EXISTS ${ext} cascade;' $db"
|
||||
|
@ -79,5 +79,3 @@ done
|
|||
rm custom.sql
|
||||
# This should show up in docker logs afterwards
|
||||
su - postgres -c "psql -l"
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ function configure_replication_permissions {
|
|||
|
||||
echo "Setup data permissions"
|
||||
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 "chmod 0600 ~/.pgpass"
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ fi
|
|||
# This script will setup default SSL config
|
||||
|
||||
# /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/
|
||||
chmod -R 0700 /etc/ssl
|
||||
chown -R postgres /tmp/ssl-copy
|
||||
|
|
Ładowanie…
Reference in New Issue