From 2fd7924e633edfafd8770a1d23b4ed9c14fb61a0 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Tue, 24 Jun 2025 00:03:28 +0000 Subject: [PATCH] Add healthcheckscript for postgres --- postgres_15/Dockerfile | 2 +- postgres_15/rootfs/usr/local/bin/healthcheck.sh | 7 +++++++ postgres_17/rootfs/usr/local/bin/healthcheck.sh | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 postgres_15/rootfs/usr/local/bin/healthcheck.sh create mode 100644 postgres_17/rootfs/usr/local/bin/healthcheck.sh diff --git a/postgres_15/Dockerfile b/postgres_15/Dockerfile index 3a8601ec4..638d9dcb2 100644 --- a/postgres_15/Dockerfile +++ b/postgres_15/Dockerfile @@ -121,4 +121,4 @@ HEALTHCHECK \ --retries=5 \ --start-period=90s \ --timeout=25s \ - CMD pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit 1 + CMD /usr/local/bin/healthcheck.sh diff --git a/postgres_15/rootfs/usr/local/bin/healthcheck.sh b/postgres_15/rootfs/usr/local/bin/healthcheck.sh new file mode 100644 index 000000000..cd04f7518 --- /dev/null +++ b/postgres_15/rootfs/usr/local/bin/healthcheck.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash + +POSTGRES_USER="$(bashio::config "POSTGRES_USER" "postgres")" +POSTGRES_DB="$(bashio::config "POSTGRES_DB" "$POSTGRES_USER")" + +pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit $?; \ No newline at end of file diff --git a/postgres_17/rootfs/usr/local/bin/healthcheck.sh b/postgres_17/rootfs/usr/local/bin/healthcheck.sh new file mode 100644 index 000000000..cd04f7518 --- /dev/null +++ b/postgres_17/rootfs/usr/local/bin/healthcheck.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bashio +# shellcheck shell=bash + +POSTGRES_USER="$(bashio::config "POSTGRES_USER" "postgres")" +POSTGRES_DB="$(bashio::config "POSTGRES_DB" "$POSTGRES_USER")" + +pg_isready --dbname="${POSTGRES_DB}" --username="${POSTGRES_USER}" || exit $?; \ No newline at end of file