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 1/4] 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 From b2701431e96a20e43a2116938a0981336442656d Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Tue, 24 Jun 2025 09:07:43 +0000 Subject: [PATCH 2/4] make healthcheck script executable --- postgres_15/rootfs/usr/local/bin/healthcheck.sh | 0 postgres_17/rootfs/usr/local/bin/healthcheck.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 postgres_15/rootfs/usr/local/bin/healthcheck.sh mode change 100644 => 100755 postgres_17/rootfs/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 old mode 100644 new mode 100755 diff --git a/postgres_17/rootfs/usr/local/bin/healthcheck.sh b/postgres_17/rootfs/usr/local/bin/healthcheck.sh old mode 100644 new mode 100755 From e633f9abe3c2b72c701e4930267b95e949d97a32 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Tue, 24 Jun 2025 11:24:37 +0000 Subject: [PATCH 3/4] increment version --- postgres_15/config.json | 2 +- postgres_17/config.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/postgres_15/config.json b/postgres_15/config.json index 47ffe5006..527fba26a 100644 --- a/postgres_15/config.json +++ b/postgres_15/config.json @@ -32,5 +32,5 @@ "slug": "postgres", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres", - "version": "15.7-46" + "version": "15.7-47" } diff --git a/postgres_17/config.json b/postgres_17/config.json index e729135e1..8016918e5 100644 --- a/postgres_17/config.json +++ b/postgres_17/config.json @@ -32,5 +32,5 @@ "slug": "postgres_latest", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres", - "version": "17.4-8" + "version": "17.4-9" } From 603df68c48aa2e8ea48dad720bab1a5b6f64d064 Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Tue, 24 Jun 2025 11:32:17 +0000 Subject: [PATCH 4/4] add changelog --- postgres_15/CHANGELOG.md | 4 ++++ postgres_17/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/postgres_15/CHANGELOG.md b/postgres_15/CHANGELOG.md index 0ec399489..fc38db888 100644 --- a/postgres_15/CHANGELOG.md +++ b/postgres_15/CHANGELOG.md @@ -1,3 +1,7 @@ +## 15.7-47 (24-06-2025) + +- Fix healthcheck to run with correct user and database + ## 15.7-46 (23-06-2025) - Version 45 was erroneous : you need to restore prior to version 45 then update to 46 again. If you don't have a backup please create an issue in the github repo diff --git a/postgres_17/CHANGELOG.md b/postgres_17/CHANGELOG.md index bbed7414b..974146dba 100644 --- a/postgres_17/CHANGELOG.md +++ b/postgres_17/CHANGELOG.md @@ -1,3 +1,7 @@ +## 17.4-9 (24-06-2025) + +- Fix healthcheck to run with correct user and database + ## 17.4-8 (23-06-2025) - Version 5, 6 and 7 had an issue : you need to restore prior to version 45 then update to 46 again. If you don't have a backup please create an issue in the github repo