diff --git a/bitnami/postgresql/12/debian-10/Dockerfile b/bitnami/postgresql/12/debian-10/Dockerfile index ac6cf977a888..ca16d6375cbd 100644 --- a/bitnami/postgresql/12/debian-10/Dockerfile +++ b/bitnami/postgresql/12/debian-10/Dockerfile @@ -22,7 +22,7 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen COPY rootfs / RUN /opt/bitnami/scripts/postgresql/postunpack.sh ENV BITNAMI_APP_NAME="postgresql" \ - BITNAMI_IMAGE_VERSION="12.3.0-debian-10-r54" \ + BITNAMI_IMAGE_VERSION="12.3.0-debian-10-r55" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US:en" \ NSS_WRAPPER_LIB="/opt/bitnami/common/lib/libnss_wrapper.so" \ diff --git a/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libpersistence.sh b/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libpersistence.sh index 6e42c882dbff..452c1f4b2831 100644 --- a/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libpersistence.sh +++ b/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libpersistence.sh @@ -46,8 +46,9 @@ persist_app() { file_to_persist_relative="$(relativize "$file_to_persist" "$install_dir")" file_to_persist_destination="${persist_dir}/${file_to_persist_relative}" file_to_persist_destination_folder="$(dirname "$file_to_persist_destination")" - # Get original permissions (except for the root directory, to avoid issues with volumes) - find "$file_to_persist_relative" | grep -E -v '^\.$' | xargs getfacl -R > "$tmp_file" + # Get original permissions for existing files, which will be applied later + # Exclude the root directory with 'sed', to avoid issues when copying the entirety of it to a volume + getfacl -R "$file_to_persist_relative" | sed -E '/# file: (\..+|[^.])/,$!d' > "$tmp_file" # Copy directories to the volume ensure_dir_exists "$file_to_persist_destination_folder" cp -Lr --preserve=links "$file_to_persist_relative" "$file_to_persist_destination_folder" @@ -62,6 +63,7 @@ persist_app() { popd >/dev/null done popd >/dev/null + rm -f "$tmp_file" # Install the persisted files into the installation directory, via symlinks restore_persisted_app "$@" } diff --git a/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh b/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh index cd68366f90ac..0fa91f65fc4f 100644 --- a/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh +++ b/bitnami/postgresql/12/debian-10/prebuildfs/opt/bitnami/scripts/libservice.sh @@ -68,6 +68,64 @@ stop_service_using_pid() { done } +######################## +# Start cron daemon +# Arguments: +# None +# Returns: +# true if started correctly, false otherwise +######################### +cron_start() { + if [[ -x "/usr/sbin/cron" ]]; then + /usr/sbin/cron + elif [[ -x "/usr/sbin/crond" ]]; then + /usr/sbin/crond + else + false + fi +} + +######################## +# Generate a cron configuration file for a given service +# Arguments: +# $1 - Service name +# $2 - Command +# Flags: +# --run-as - User to run as (default: root) +# --schedule - Cron schedule configuration (default: * * * * *) +# Returns: +# None +######################### +generate_cron_conf() { + local service_name="${1:?service name is missing}" + local cmd="${2:?command is missing}" + local run_as="root" + local schedule="* * * * *" + + # Parse optional CLI flags + shift 2 + while [[ "$#" -gt 0 ]]; do + case "$1" in + --run-as) + shift + run_as="$1" + ;; + --schedule) + shift + schedule="$1" + ;; + *) + echo "Invalid command line flag ${1}" >&2 + return 1 + ;; + esac + shift + done + + mkdir -p /etc/cron.d + echo "${schedule} ${run_as} ${cmd}" > /etc/cron.d/"$service_name" +} + ######################## # Generate a monit configuration file for a given service # Arguments: diff --git a/bitnami/postgresql/README.md b/bitnami/postgresql/README.md index 7d635619cd68..f61c12cd926f 100644 --- a/bitnami/postgresql/README.md +++ b/bitnami/postgresql/README.md @@ -42,7 +42,7 @@ Non-root container images add an extra layer of security and are generally recom Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/). -* [`12-debian-10`, `12.3.0-debian-10-r54`, `12`, `12.3.0` (12/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql/blob/12.3.0-debian-10-r54/12/debian-10/Dockerfile) +* [`12-debian-10`, `12.3.0-debian-10-r55`, `12`, `12.3.0` (12/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql/blob/12.3.0-debian-10-r55/12/debian-10/Dockerfile) * [`11-debian-10`, `11.8.0-debian-10-r59`, `11`, `11.8.0`, `latest` (11/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql/blob/11.8.0-debian-10-r59/11/debian-10/Dockerfile) * [`10-debian-10`, `10.13.0-debian-10-r55`, `10`, `10.13.0` (10/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql/blob/10.13.0-debian-10-r55/10/debian-10/Dockerfile) * [`9.6-debian-10`, `9.6.18-debian-10-r57`, `9.6`, `9.6.18` (9.6/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql/blob/9.6.18-debian-10-r57/9.6/debian-10/Dockerfile)