diff --git a/README.md b/README.md index a2f4827..6bdfa39 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ A tiny, stateless Go tool that blocks until a database is ready, then exits `0`. It is designed to run as a Kubernetes **initContainer** so an app never starts -before its database can serve queries. It replaces the hand-written -`psql`-in-a-shell initContainers we used on the arrstack (sonarr/radarr/prowlarr). +before its database can serve queries, without hand-writing a `psql`-in-a-shell +probe in every workload. Readiness means a trivial liveness query (`SELECT 1`) succeeds under the given credentials and database — proving the **server is up, auth works, and the @@ -46,9 +46,9 @@ is a drop-in replacement anywhere those variables are already set. ### Example logs ``` -12:49:50 waitfordb v0.1.0: waiting for database (driver=postgres addr=db:5432 database=sonarr-main user=sonarr password=*** timeout=5m interval=2s connect_timeout=5s) -12:49:52 attempt 1: failed to connect to `user=sonarr database=sonarr-main`: dial tcp ... connection refused; retrying in 2s (elapsed 2s/5m) -12:49:56 database sonarr-main ready after 4.2s (3 attempts) +12:49:50 waitfordb v0.1.0: waiting for database (driver=postgres addr=db:5432 database=appdb user=appuser password=*** timeout=5m interval=2s connect_timeout=5s) +12:49:52 attempt 1: failed to connect to `user=appuser database=appdb`: dial tcp ... connection refused; retrying in 2s (elapsed 2s/5m) +12:49:56 database appdb ready after 4.2s (3 attempts) ``` The password is never printed — not in the startup line, not in any error line. @@ -64,11 +64,11 @@ initContainers: image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/waitfordb:latest env: - name: WAITFORDB_HOST - value: arrstack-postgres-rw.arrstack.svc.cluster.local + value: postgres-rw.default.svc.cluster.local - name: WAITFORDB_PORT value: "5432" - name: WAITFORDB_DATABASE - value: sonarr-main + value: appdb - name: WAITFORDB_SSLMODE value: disable - name: WAITFORDB_TIMEOUT @@ -76,12 +76,12 @@ initContainers: - name: WAITFORDB_USER valueFrom: secretKeyRef: - name: sonarr-db + name: app-db key: username - name: WAITFORDB_PASSWORD valueFrom: secretKeyRef: - name: sonarr-db + name: app-db key: password resources: requests: