This demo shows how to make the boca-web
and boca-jail
services wait for the database container (boca-db
) to startup and be ready to accept requests before continuing. The healthcheck
has been configured to periodically check if PostgreSQL is ready using the pg_isready
command.
If the check is successful the container will be marked as healthy
. Until then it will remain in an unhealthy
state. For more details about the parameters interval
, timeout
, retries
, and start_period
see the documentation here.
NOTE:
depends_on
withhealthcheck
does not work when used withdocker stack deploy
. For more information, see the discussion thread here.
- Launch the application:
... via docker compose
docker compose -f tests/healthcheck/docker-compose.yml up -d
-
Open a web browser and visit the URL http://localhost:8000/boca. To login use the default credentials (Name: system | Password: boca).
-
To bring it down:
... via docker-compose
docker compose -f tests/healthcheck/docker-compose.yml down