-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgres: Add healthcheck examples #2393
base: master
Are you sure you want to change the base?
Postgres: Add healthcheck examples #2393
Conversation
021abfe
to
968fbdb
Compare
|
||
```console | ||
docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword \ | ||
--health-cmd='pg_isready' --health-interval=5s -d %%IMAGE%% |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Healt/Health/
#2391