arrstack: use waitfordb initContainer instead of inline psql loop #386

Merged
benvin merged 1 commits from benvin/arrstack-use-waitfordb into main 2026-08-22 16:15:46 +10:00
3 changed files with 18 additions and 30 deletions
+6 -10
View File
@@ -31,18 +31,14 @@ spec:
initContainers:
# Gate the app on its own Postgres database+role being reachable, instead
# of relying on ArgoCD sync-waves (which deadlock if apps aren't Healthy).
# libpq reads PG* from env, so the password never lands in argv.
# waitfordb reads the PG* env as a libpq fallback, so the password never lands in argv.
- name: wait-for-db
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/postgres:17-alpine
command:
- sh
- -c
- |
until psql -tAc 'select 1' >/dev/null 2>&1; do
echo "waiting for $PGDATABASE on $PGHOST..."; sleep 3
done
echo "database ready"
image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/waitfordb:v0.1.0
env:
- name: WAITFORDB_TIMEOUT
value: 5m
- name: WAITFORDB_SSLMODE
value: disable
- name: PGHOST
value: arrstack-postgres-rw.arrstack.svc.cluster.local
- name: PGPORT
+6 -10
View File
@@ -31,18 +31,14 @@ spec:
initContainers:
# Gate the app on its own Postgres database+role being reachable, instead
# of relying on ArgoCD sync-waves (which deadlock if apps aren't Healthy).
# libpq reads PG* from env, so the password never lands in argv.
# waitfordb reads the PG* env as a libpq fallback, so the password never lands in argv.
- name: wait-for-db
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/postgres:17-alpine
command:
- sh
- -c
- |
until psql -tAc 'select 1' >/dev/null 2>&1; do
echo "waiting for $PGDATABASE on $PGHOST..."; sleep 3
done
echo "database ready"
image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/waitfordb:v0.1.0
env:
- name: WAITFORDB_TIMEOUT
value: 5m
- name: WAITFORDB_SSLMODE
value: disable
- name: PGHOST
value: arrstack-postgres-rw.arrstack.svc.cluster.local
- name: PGPORT
+6 -10
View File
@@ -31,18 +31,14 @@ spec:
initContainers:
# Gate the app on its own Postgres database+role being reachable, instead
# of relying on ArgoCD sync-waves (which deadlock if apps aren't Healthy).
# libpq reads PG* from env, so the password never lands in argv.
# waitfordb reads the PG* env as a libpq fallback, so the password never lands in argv.
- name: wait-for-db
image: artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/postgres:17-alpine
command:
- sh
- -c
- |
until psql -tAc 'select 1' >/dev/null 2>&1; do
echo "waiting for $PGDATABASE on $PGHOST..."; sleep 3
done
echo "database ready"
image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/waitfordb:v0.1.0
env:
- name: WAITFORDB_TIMEOUT
value: 5m
- name: WAITFORDB_SSLMODE
value: disable
- name: PGHOST
value: arrstack-postgres-rw.arrstack.svc.cluster.local
- name: PGPORT