- Move local database dir form ./pgsql/data to ./pgsql-data,

- Fix support of special chars in User & Database names.
This commit is contained in:
Arnaud G. GIBERT 2024-08-31 12:26:19 +02:00
parent 234c8ce218
commit 6ec93aa56e
4 changed files with 43 additions and 34 deletions

2
.env
View File

@ -17,7 +17,7 @@ IMG_URL_PREFIX="${IMG_REGISTRY}/${IMG_ORG}"
IMG_NAME="postgresql-mga9" IMG_NAME="postgresql-mga9"
IMG_FULL_NAME="Rx3 MariaDB Mageia-9 Docker Image" 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_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>' IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'

View File

@ -19,7 +19,7 @@ ARG POSTGRESQL_LIB=/var/lib/pgsql
ARG POSTGRESQL_DATA=${POSTGRESQL_LIB}/data ARG POSTGRESQL_DATA=${POSTGRESQL_LIB}/data
ARG POSTGRESQL_PORT=5432 ARG POSTGRESQL_PORT=5432
#--------------------------------------------------------------------------------------------------- #-----------------------------------------------------------------------------------------------------------------------------
ARG POSTGRESQLD='#!/bin/bash \n\ ARG POSTGRESQLD='#!/bin/bash \n\
\n\ \n\
usermod -u ${POSTGRESQL_UID} postgres \n\ usermod -u ${POSTGRESQL_UID} postgres \n\
@ -33,16 +33,16 @@ then
\n\ \n\
if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\
then \n\ then \n\
echo "CREATE DATABASE ${POSTGRESQL_DATABASE};" >>/tmp/post.sql \n\ echo "CREATE DATABASE \"${POSTGRESQL_DATABASE}\";" >>/tmp/post.sql \n\
fi \n\ fi \n\
\n\ \n\
if [[ -n "${POSTGRESQL_USER}" ]] && [[ -n "${POSTGRESQL_PASSWORD}" ]] \n\ if [[ -n "${POSTGRESQL_USER}" ]] && [[ -n "${POSTGRESQL_PASSWORD}" ]] \n\
then \n\ then \n\
echo "CREATE USER ${POSTGRESQL_USER} WITH PASSWORD `${POSTGRESQL_PASSWORD}`;" >>/tmp/post.sql \n\ echo "CREATE USER \"${POSTGRESQL_USER}\" WITH PASSWORD `${POSTGRESQL_PASSWORD}`;" >>/tmp/post.sql \n\
\n\ \n\
if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\ if [[ -n "${POSTGRESQL_DATABASE}" ]] \n\
then \n\ then \n\
echo "GRANT ALL PRIVILEGES ON DATABASE ${POSTGRESQL_DATABASE} TO ${POSTGRESQL_USER};" >>/tmp/post.sql \n\ echo "GRANT ALL PRIVILEGES ON DATABASE \"${POSTGRESQL_DATABASE}\" TO \"${POSTGRESQL_USER}\";" >>/tmp/post.sql \n\
fi \n\ fi \n\
fi \n\ fi \n\
\n\ \n\

View File

@ -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 Rx3/PostgreSQL-Mga9 V 1.0.0 - A. GIBERT - 2024/08/30
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------

View File

@ -30,7 +30,7 @@ services:
POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD}
volumes: volumes:
- ./pgsql/data:/var/lib/pgsql/data - ./pgsql-data:/var/lib/pgsql/data
network_mode: bridge network_mode: bridge