kopia lustrzana https://github.com/kartoza/docker-postgis
Fix DB name with hyphen and also add env for logging (#495)
* Fix DB name with hyphen and also add env for logging and test creating database with hyphen --------- Co-authored-by: Admire Nyakudya <mazano@MacBookAir.Dlink>gubuntu-patch-1 v17.3.5--v2024.12.17--2d25521
rodzic
711b96844c
commit
2d2552114a
|
@ -2,6 +2,7 @@
|
|||
volumes:
|
||||
pg-db-data-dir:
|
||||
pg-db-schema-dir:
|
||||
pg-db-single-dir:
|
||||
|
||||
|
||||
services:
|
||||
|
@ -45,4 +46,24 @@ services:
|
|||
retries: 3
|
||||
test: "PGPASSWORD=docker pg_isready -h 127.0.0.1 -U docker -d gis"
|
||||
|
||||
pg-single-db:
|
||||
image: 'kartoza/postgis:${TAG:-manual-build}'
|
||||
restart: 'always'
|
||||
# You can optionally mount to volume, to play with the persistence and
|
||||
# observe how the node will behave after restarts.
|
||||
volumes:
|
||||
- pg-db-single-dir:/var/lib/postgresql
|
||||
- ./tests:/tests
|
||||
- ../utils:/lib/utils
|
||||
environment:
|
||||
POSTGRES_DB: 'name-with-hyphen'
|
||||
POSTGRES_PASS: 'docker'
|
||||
ALL_DATABASES: FALSE
|
||||
SCHEMA_NAME: 'demo1,demo2'
|
||||
healthcheck:
|
||||
interval: 60s
|
||||
timeout: 30s
|
||||
retries: 3
|
||||
test: "PGPASSWORD=docker pg_isready -h 127.0.0.1 -U docker -d gis"
|
||||
|
||||
|
||||
|
|
|
@ -51,3 +51,24 @@ ${VERSION} exec -T pg-schema /bin/bash /tests/test_schemas.sh
|
|||
|
||||
|
||||
${VERSION} down -v
|
||||
|
||||
|
||||
# Run service for pg-schema
|
||||
${VERSION} up -d pg-single-db
|
||||
|
||||
if [[ -n "${PRINT_TEST_LOGS}" ]]; then
|
||||
${VERSION} logs -f &
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
|
||||
# Preparing all databases and single schema
|
||||
until ${VERSION} exec -T pg-single-db pg_isready; do
|
||||
sleep 1
|
||||
done;
|
||||
|
||||
# Execute tests
|
||||
${VERSION} exec -T pg-single-db /bin/bash /tests/test_schemas.sh
|
||||
|
||||
|
||||
${VERSION} down -v
|
|
@ -264,7 +264,12 @@ if [ -z "${SSL_KEY_FILE}" ]; then
|
|||
SSL_KEY_FILE='/etc/ssl/private/ssl-cert-snakeoil.key'
|
||||
fi
|
||||
|
||||
# controls all login params below, defaults to false
|
||||
if [ -z "${LOGGING}" ]; then
|
||||
LOGGING='FALSE'
|
||||
fi
|
||||
# log
|
||||
|
||||
if [ -z "${LOGGING_COLLECTOR}" ]; then
|
||||
LOGGING_COLLECTOR='off'
|
||||
fi
|
||||
|
@ -453,7 +458,8 @@ fi
|
|||
IFS=','
|
||||
read -a dbarr <<< "$POSTGRES_DBNAME"
|
||||
SINGLE_DB=${dbarr[0]}
|
||||
export ${SINGLE_DB}
|
||||
echo ${SINGLE_DB} > /tmp/pg_dbname.txt
|
||||
|
||||
|
||||
if [ -z "${TIMEZONE}" ]; then
|
||||
TIMEZONE='Etc/UTC'
|
||||
|
|
|
@ -38,8 +38,12 @@ cron.database_name = '${SINGLE_DB}'
|
|||
password_encryption= '${PASSWORD_AUTHENTICATION}'
|
||||
timezone='${TIMEZONE}'
|
||||
cron.use_background_workers = on
|
||||
EOF
|
||||
|
||||
echo "include 'postgis.conf'" >> "${CONF}"
|
||||
|
||||
if [[ "${LOGGING}" =~ [Tt][Rr][Uu][Ee] ]];then
|
||||
cat > "${ROOT_CONF}"/logging.conf <<EOF
|
||||
logging_collector='${LOGGING_COLLECTOR}'
|
||||
log_directory='${LOG_DIRECTORY}'
|
||||
log_filename='${LOG_FILENAME}'
|
||||
|
@ -54,10 +58,10 @@ log_connections='${LOG_CONNECTIONS}'
|
|||
log_disconnections='${LOG_DISCONNECTS}'
|
||||
log_line_prefix='${LOG_LINE_PREFIX}'
|
||||
log_timezone='${LOG_TIMEZONE}'
|
||||
|
||||
EOF
|
||||
echo "include 'logging.conf'" >> "${CONF}"
|
||||
|
||||
echo "include 'postgis.conf'" >> "${CONF}"
|
||||
fi
|
||||
|
||||
# Create a config for logical replication
|
||||
if [[ "${REPLICATION}" =~ [Tt][Rr][Uu][Ee] && "$WAL_LEVEL" == 'logical' ]]; then
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source /scripts/env-data.sh
|
||||
SINGLE_DB=$(cat /tmp/pg_dbname.txt)
|
||||
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue