diff --git a/bitnami/postgresql/14/debian-11/Dockerfile b/bitnami/postgresql/14/debian-11/Dockerfile index 8891719b4785..57441de38e79 100644 --- a/bitnami/postgresql/14/debian-11/Dockerfile +++ b/bitnami/postgresql/14/debian-11/Dockerfile @@ -9,10 +9,10 @@ ARG WITH_ALL_LOCALES="no" LABEL com.vmware.cp.artifact.flavor="sha256:1e1b4657a77f0d47e9220f0c37b9bf7802581b93214fff7d1bd2364c8bf22e8e" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \ - org.opencontainers.image.created="2024-02-15T07:52:07Z" \ + org.opencontainers.image.created="2024-02-16T11:23:22Z" \ org.opencontainers.image.description="Application packaged by VMware, Inc" \ org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="14.11.0-debian-11-r13" \ + org.opencontainers.image.ref.name="14.11.0-debian-11-r14" \ org.opencontainers.image.title="postgresql" \ org.opencontainers.image.vendor="VMware, Inc." \ org.opencontainers.image.version="14.11.0" diff --git a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql-env.sh b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql-env.sh index e4fa8f525534..91a35253de37 100644 --- a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql-env.sh +++ b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql-env.sh @@ -181,6 +181,7 @@ export POSTGRESQL_BASE_DIR="/opt/bitnami/postgresql" POSTGRESQL_DATA_DIR="${POSTGRESQL_DATA_DIR:-"${POSTGRES_DATA_DIR:-}"}" POSTGRESQL_DATA_DIR="${POSTGRESQL_DATA_DIR:-"${PGDATA:-}"}" export POSTGRESQL_DATA_DIR="${POSTGRESQL_DATA_DIR:-${POSTGRESQL_VOLUME_DIR}/data}" +export POSTGRESQL_DEFAULT_CONF_DIR="$POSTGRESQL_BASE_DIR/conf.default" export POSTGRESQL_CONF_DIR="$POSTGRESQL_BASE_DIR/conf" export POSTGRESQL_MOUNTED_CONF_DIR="$POSTGRESQL_VOLUME_DIR/conf" export POSTGRESQL_CONF_FILE="$POSTGRESQL_CONF_DIR/postgresql.conf" diff --git a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh index 8ea9cb4f10ee..6ab92ebcafd5 100755 --- a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh +++ b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/entrypoint.sh @@ -21,6 +21,12 @@ print_welcome_page # Enable the nss_wrapper settings postgresql_enable_nss_wrapper +# We add the copy from default config in the entrypoint to not break users +# bypassing the setup.sh logic. If the file already exists do not overwrite (in +# case someone mounts a configuration file in /opt/bitnami/postgresql/conf) +debug "Copying files from $POSTGRESQL_DEFAULT_CONF_DIR to $POSTGRESQL_CONF_DIR" +cp -nr "$POSTGRESQL_DEFAULT_CONF_DIR"/. "$POSTGRESQL_CONF_DIR" + if [[ "$*" = *"/opt/bitnami/scripts/postgresql/run.sh"* ]]; then info "** Starting PostgreSQL setup **" /opt/bitnami/scripts/postgresql/setup.sh diff --git a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh index 544976a70ef0..a2531a5f168f 100755 --- a/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh +++ b/bitnami/postgresql/14/debian-11/rootfs/opt/bitnami/scripts/postgresql/postunpack.sh @@ -11,7 +11,7 @@ # Load PostgreSQL environment variables . /opt/bitnami/scripts/postgresql-env.sh -for dir in "$POSTGRESQL_INITSCRIPTS_DIR" "$POSTGRESQL_TMP_DIR" "$POSTGRESQL_LOG_DIR" "$POSTGRESQL_CONF_DIR" "${POSTGRESQL_CONF_DIR}/conf.d" "$POSTGRESQL_MOUNTED_CONF_DIR" "${POSTGRESQL_MOUNTED_CONF_DIR}/conf.d" "$POSTGRESQL_VOLUME_DIR"; do +for dir in "$POSTGRESQL_INITSCRIPTS_DIR" "$POSTGRESQL_TMP_DIR" "$POSTGRESQL_LOG_DIR" "$POSTGRESQL_CONF_DIR" "${POSTGRESQL_CONF_DIR}/conf.d" "$POSTGRESQL_MOUNTED_CONF_DIR" "$POSTGRESQL_DEFAULT_CONF_DIR" "${POSTGRESQL_MOUNTED_CONF_DIR}/conf.d" "$POSTGRESQL_VOLUME_DIR"; do ensure_dir_exists "$dir" done @@ -22,5 +22,9 @@ postgresql_create_config chmod -R g+rwX "$POSTGRESQL_INITSCRIPTS_DIR" "$POSTGRESQL_TMP_DIR" "$POSTGRESQL_LOG_DIR" "$POSTGRESQL_CONF_DIR" "${POSTGRESQL_CONF_DIR}/conf.d" "$POSTGRESQL_MOUNTED_CONF_DIR" "${POSTGRESQL_MOUNTED_CONF_DIR}/conf.d" "$POSTGRESQL_VOLUME_DIR" +# Copy all initially generated configuration files to the default directory +# (this is to avoid breaking when entrypoint is being overridden) +cp -r "${POSTGRESQL_CONF_DIR}/"* "$POSTGRESQL_DEFAULT_CONF_DIR" + # Redirect all logging to stdout ln -sf /dev/stdout "$POSTGRESQL_LOG_DIR/postgresql.log" diff --git a/bitnami/postgresql/README.md b/bitnami/postgresql/README.md index c5da8c834cbf..9f4a58c088ec 100644 --- a/bitnami/postgresql/README.md +++ b/bitnami/postgresql/README.md @@ -202,6 +202,7 @@ docker-compose up -d | Name | Description | Value | |-------------------------------------|--------------------------------------------|-----------------------------------------------| | `POSTGRESQL_BASE_DIR` | PostgreSQL installation directory | `/opt/bitnami/postgresql` | +| `POSTGRESQL_DEFAULT_CONF_DIR` | PostgreSQL configuration directory | `$POSTGRESQL_BASE_DIR/conf.default` | | `POSTGRESQL_CONF_DIR` | PostgreSQL configuration directory | `$POSTGRESQL_BASE_DIR/conf` | | `POSTGRESQL_MOUNTED_CONF_DIR` | PostgreSQL mounted configuration directory | `$POSTGRESQL_VOLUME_DIR/conf` | | `POSTGRESQL_CONF_FILE` | PostgreSQL configuration file | `$POSTGRESQL_CONF_DIR/postgresql.conf` |