Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Postgres: Add healthcheck examples #2393

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LaurentGoderre
Copy link
Member

@LaurentGoderre LaurentGoderre commented Nov 17, 2023


```console
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword \
--health-cmd='pg_isready' --health-interval=5s -d %%IMAGE%%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't just a raw pg_isready like this happily connect to the temporary unix-socket-only instance of the server that's used for initdb, and thus prematurely report that the database is up and healthy?

(see also https://github.com/docker-library/faq#healthcheck, many of which applies to trying to make "generic" documentation for health checks too, and https://github.com/docker-library/healthcheck/blob/40afbf64d69cf933af0da4df6383958a29113601/postgres/docker-healthcheck which is likely more than we'd want in the documentation but the main point there being explicitly using TCP to ensure we don't connect to the temporary server)

@@ -40,6 +40,29 @@ postgres=# SELECT 1;

Run `docker stack deploy -c stack.yml %%REPO%%` (or `docker-compose -f stack.yml up`), wait for it to initialize completely, and visit `http://swarm-ip:8080`, `http://localhost:8080`, or `http://host-ip:8080` (as appropriate).

## Healtcheck
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Healt/Health/

aslushnikov added a commit to flakiness/podkeeper that referenced this pull request Nov 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants