From bbc53ca4cc618ffbccaab1b0a65556d9717b596b Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 30 Jan 2024 16:33:49 +0100 Subject: [PATCH 1/2] Update postgres.service --- imageroot/systemd/user/postgres.service | 1 + 1 file changed, 1 insertion(+) diff --git a/imageroot/systemd/user/postgres.service b/imageroot/systemd/user/postgres.service index 4a1aec0..c8697b0 100644 --- a/imageroot/systemd/user/postgres.service +++ b/imageroot/systemd/user/postgres.service @@ -23,6 +23,7 @@ ExecStart=/usr/bin/podman run \ --volume=pgdata:/var/lib/postgresql/data \ --replace --name=%N \ ${WEBTOP_POSTGRES_IMAGE} +ExecStartPost=/usr/bin/bash -c "while ! podman exec postgres pg_isready ; do sleep 5 ; done" ExecStop=/usr/bin/podman stop --ignore --cidfile %t/postgres.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/postgres.ctr-id PIDFile=%t/postgres.pid From 0450dda047c6e99832e18e601ec5a0a8cd774eed Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Tue, 30 Jan 2024 19:47:06 +0100 Subject: [PATCH 2/2] Update ExecStartPost command in postgres.service --- imageroot/systemd/user/postgres.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imageroot/systemd/user/postgres.service b/imageroot/systemd/user/postgres.service index c8697b0..6928a55 100644 --- a/imageroot/systemd/user/postgres.service +++ b/imageroot/systemd/user/postgres.service @@ -23,7 +23,7 @@ ExecStart=/usr/bin/podman run \ --volume=pgdata:/var/lib/postgresql/data \ --replace --name=%N \ ${WEBTOP_POSTGRES_IMAGE} -ExecStartPost=/usr/bin/bash -c "while ! podman exec postgres pg_isready ; do sleep 5 ; done" +ExecStartPost=/usr/bin/bash -c "while ! podman exec postgres psql -U postgres -c '\\l' > /dev/null ; do sleep 5 ; done" ExecStop=/usr/bin/podman stop --ignore --cidfile %t/postgres.ctr-id -t 10 ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/postgres.ctr-id PIDFile=%t/postgres.pid