- Move local database dir form ./pgsql/data to ./pgsql-data,
- Fix support of special chars in User & Database names.
This commit is contained in:
parent
234c8ce218
commit
6ec93aa56e
2
.env
2
.env
@ -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>'
|
||||||
|
|
||||||
|
64
Dockerfile
64
Dockerfile
@ -19,38 +19,38 @@ 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\
|
||||||
groupmod -g ${POSTGRESQL_GID} postgres \n\
|
groupmod -g ${POSTGRESQL_GID} postgres \n\
|
||||||
\n\
|
\n\
|
||||||
chown -R postgres:postgres '${POSTGRESQL_LIB}' /var/log/postgres /var/run/postgresql \n\
|
chown -R postgres:postgres '${POSTGRESQL_LIB}' /var/log/postgres /var/run/postgresql \n\
|
||||||
\n\
|
\n\
|
||||||
if [[ ! -f '${POSTGRESQL_DATA}/pg_hba.conf' ]] \n\
|
if [[ ! -f '${POSTGRESQL_DATA}/pg_hba.conf' ]] \n\
|
||||||
then \n\
|
then \n\
|
||||||
echo "ALTER USER postgres WITH PASSWORD `${POSTGRESQL_POSTGRES_PASSWORD}`;" >>/tmp/post.sql \n\
|
echo "ALTER USER postgres WITH PASSWORD `${POSTGRESQL_POSTGRES_PASSWORD}`;" >>/tmp/post.sql \n\
|
||||||
\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\
|
||||||
su - postgres -c "/usr/libexec/postgresql_initdb.sh '${POSTGRESQL_DATA}'" \n\
|
su - postgres -c "/usr/libexec/postgresql_initdb.sh '${POSTGRESQL_DATA}'" \n\
|
||||||
\n\
|
\n\
|
||||||
echo "# IPv4 extern connections:" >>'${POSTGRESQL_DATA}'/pg_hba.conf \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\
|
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\
|
sed -i "s/#port = 5432/listen_addresses=`*`\\n#port = 5432/" '${POSTGRESQL_DATA}'/postgresql.conf \n\
|
||||||
fi'
|
fi'
|
||||||
#---------------------------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -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
|
||||||
------------------------------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user