2 Commits

Author SHA1 Message Date
8f3ea49795 - Now use server-mga9:1.1.3 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
2024-10-05 13:11:16 +02:00
6ec93aa56e - Move local database dir form ./pgsql/data to ./pgsql-data,
- Fix support of special chars in User & Database names.
2024-08-31 12:26:19 +02:00
5 changed files with 68 additions and 40 deletions

View File

@@ -3,7 +3,7 @@
ARG IMG_URL_PREFIX="rx3"
FROM ${IMG_URL_PREFIX}/server-mga9:1.1.2
FROM ${IMG_URL_PREFIX}/server-mga9:1.1.3
ARG IMG_NAME
ARG IMG_FULL_NAME
@@ -19,42 +19,41 @@ 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'
#---------------------------------------------------------------------------------------------------
#command=/usr/bin/pg_ctl start -D '${POSTGRESQL_DATA}' -s -o "-p '${POSTGRESQL_PORT}'" -w -t 300 \n\
#---------------------------------------------------------------------------------------------------
ARG POSTGRESQLD_INI='[program:postgresqld] \n\
command=/usr/bin/postgres -D '${POSTGRESQL_DATA}' -p '${POSTGRESQL_PORT}' \n\

View File

@@ -1,6 +1,25 @@
------------------------------------------------------------------------------------------------------------------------------------
Rx3/PostgreSQL-Mga9 V 1.0.2 - A. GIBERT - 2024/10/05
------------------------------------------------------------------------------------------------------------------------------------
- Now use server-mga9:1.1.3 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
------------------------------------------------------------------------------------------------------------------------------------
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
------------------------------------------------------------------------------------------------------------------------------------
- Initial release,
- Based on server-mga9:1.1.2 image.
- Based on rx3/server-mga9:1.1.2 image.

View File

@@ -30,10 +30,10 @@ services:
POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD}
volumes:
- ./pgsql/data:/var/lib/pgsql/data
- ./var/lib/pgsql/data:/var/lib/pgsql/data
network_mode: bridge
ports:
- "127.0.0.1:9013:9001"
- "127.0.0.1:8032:5432"
- "127.0.0.1:${DATABASE_SV_PORT}:9001"
- "127.0.0.1:${DATABASE_PORT}:5432"

View File

@@ -16,8 +16,8 @@ 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_FULL_NAME="Rx3 PostgreSQL Mageia-9 Docker Image"
IMG_VERSION="1.0.2"
IMG_URL="${IMG_URL_PREFIX}/${IMG_NAME}:${IMG_VERSION}"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
@@ -27,6 +27,12 @@ IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
# User Settings
#-------------------------------------------------------------------------------
ENV_PORT_OFFSET=0
SV_PORT_OFFSET=1000
DATABASE_PORT=$(( 8032 + ${ENV_PORT_OFFSET}))
DATABASE_SV_PORT=$(( ${DATABASE_PORT} + ${SV_PORT_OFFSET}))
POSTGRESQL_UID=971
POSTGRESQL_GID=971
POSTGRESQL_POSTGRES_PASSWORD="postgresadmin"

4
var/lib/pgsql/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore