From 6ec93aa56e817cdc4ee7d23fb6b5f8383cd03d90 Mon Sep 17 00:00:00 2001 From: "Arnaud G. GIBERT" Date: Sat, 31 Aug 2024 12:26:19 +0200 Subject: [PATCH] - Move local database dir form ./pgsql/data to ./pgsql-data, - Fix support of special chars in User & Database names. --- .env | 2 +- Dockerfile | 64 ++++++++++++++++++++++++------------------------ ReleaseNotes.txt | 9 +++++++ compose.yaml | 2 +- 4 files changed, 43 insertions(+), 34 deletions(-) diff --git a/.env b/.env index cab1026..099c513 100644 --- a/.env +++ b/.env @@ -17,7 +17,7 @@ IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}" IMG_NAME="postgresql-mga9" IMG_FULL_NAME="Rx3 MariaDB Mageia-9 Docker Image" -IMG_VERSION="1.0.0" +IMG_VERSION="1.0.1" IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}" IMG_MAINTAINER='"Arnaud G. GIBERT" ' diff --git a/Dockerfile b/Dockerfile index 4d7f555..849dd49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,38 +19,38 @@ ARG POSTGRESQL_LIB=/var/lib/pgsql ARG POSTGRESQL_DATA=${POSTGRESQL_LIB}/data ARG POSTGRESQL_PORT=5432 -#--------------------------------------------------------------------------------------------------- -ARG POSTGRESQLD='#!/bin/bash \n\ - \n\ -usermod -u ${POSTGRESQL_UID} postgres \n\ -groupmod -g ${POSTGRESQL_GID} postgres \n\ - \n\ -chown -R postgres:postgres '${POSTGRESQL_LIB}' /var/log/postgres /var/run/postgresql \n\ - \n\ -if [[ ! -f '${POSTGRESQL_DATA}/pg_hba.conf' ]] \n\ -then \n\ - echo "ALTER USER postgres WITH PASSWORD `${POSTGRESQL_POSTGRES_PASSWORD}`;" >>/tmp/post.sql \n\ - \n\ - if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ - then \n\ - echo "CREATE DATABASE ${POSTGRESQL_DATABASE};" >>/tmp/post.sql \n\ - fi \n\ - \n\ - if [[ -n "${POSTGRESQL_USER}" ]] && [[ -n "${POSTGRESQL_PASSWORD}" ]] \n\ - then \n\ - echo "CREATE USER ${POSTGRESQL_USER} WITH PASSWORD `${POSTGRESQL_PASSWORD}`;" >>/tmp/post.sql \n\ - \n\ - if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ - then \n\ - echo "GRANT ALL PRIVILEGES ON DATABASE ${POSTGRESQL_DATABASE} TO ${POSTGRESQL_USER};" >>/tmp/post.sql \n\ - fi \n\ - fi \n\ - \n\ - su - postgres -c "/usr/libexec/postgresql_initdb.sh '${POSTGRESQL_DATA}'" \n\ - \n\ - echo "# IPv4 extern connections:" >>'${POSTGRESQL_DATA}'/pg_hba.conf \n\ - echo "host all all 0.0.0.0/0 password" >>'${POSTGRESQL_DATA}'/pg_hba.conf \n\ - sed -i "s/#port = 5432/listen_addresses=`*`\\n#port = 5432/" '${POSTGRESQL_DATA}'/postgresql.conf \n\ +#----------------------------------------------------------------------------------------------------------------------------- +ARG POSTGRESQLD='#!/bin/bash \n\ + \n\ +usermod -u ${POSTGRESQL_UID} postgres \n\ +groupmod -g ${POSTGRESQL_GID} postgres \n\ + \n\ +chown -R postgres:postgres '${POSTGRESQL_LIB}' /var/log/postgres /var/run/postgresql \n\ + \n\ +if [[ ! -f '${POSTGRESQL_DATA}/pg_hba.conf' ]] \n\ +then \n\ + echo "ALTER USER postgres WITH PASSWORD `${POSTGRESQL_POSTGRES_PASSWORD}`;" >>/tmp/post.sql \n\ + \n\ + if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ + then \n\ + echo "CREATE DATABASE \"${POSTGRESQL_DATABASE}\";" >>/tmp/post.sql \n\ + fi \n\ + \n\ + if [[ -n "${POSTGRESQL_USER}" ]] && [[ -n "${POSTGRESQL_PASSWORD}" ]] \n\ + then \n\ + echo "CREATE USER \"${POSTGRESQL_USER}\" WITH PASSWORD `${POSTGRESQL_PASSWORD}`;" >>/tmp/post.sql \n\ + \n\ + if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ + then \n\ + echo "GRANT ALL PRIVILEGES ON DATABASE \"${POSTGRESQL_DATABASE}\" TO \"${POSTGRESQL_USER}\";" >>/tmp/post.sql \n\ + fi \n\ + fi \n\ + \n\ + su - postgres -c "/usr/libexec/postgresql_initdb.sh '${POSTGRESQL_DATA}'" \n\ + \n\ + echo "# IPv4 extern connections:" >>'${POSTGRESQL_DATA}'/pg_hba.conf \n\ + echo "host all all 0.0.0.0/0 password" >>'${POSTGRESQL_DATA}'/pg_hba.conf \n\ + sed -i "s/#port = 5432/listen_addresses=`*`\\n#port = 5432/" '${POSTGRESQL_DATA}'/postgresql.conf \n\ fi' #--------------------------------------------------------------------------------------------------- diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index e19f17d..92b5925 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -1,3 +1,12 @@ +------------------------------------------------------------------------------------------------------------------------------------ +Rx3/PostgreSQL-Mga9 V 1.0.1 - A. GIBERT - 2024/08/31 +------------------------------------------------------------------------------------------------------------------------------------ + +- Move local database dir form ./pgsql/data to ./pgsql-data, +- Fix support of special chars in User & Database names. + + + ------------------------------------------------------------------------------------------------------------------------------------ Rx3/PostgreSQL-Mga9 V 1.0.0 - A. GIBERT - 2024/08/30 ------------------------------------------------------------------------------------------------------------------------------------ diff --git a/compose.yaml b/compose.yaml index 2ca8917..03ce402 100644 --- a/compose.yaml +++ b/compose.yaml @@ -30,7 +30,7 @@ services: POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} volumes: - - ./pgsql/data:/var/lib/pgsql/data + - ./pgsql-data:/var/lib/pgsql/data network_mode: bridge