Skip to content
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

Make make services wait for healthchecks to pass using --wait #5556

Closed
wants to merge 1 commit into from

Conversation

robertknight
Copy link
Member

This enables starting lms services and the dev server by running make services && make dev, without encountering errors due to the DB not being ready.

nb. The --wait flag is missing from the docs but see docker/compose#8777.

This enables starting lms services and the dev server by running `make services
&& make dev`, without encountering errors due to the DB not being ready.

nb. The `--wait` flag is missing from the docs but see
docker/compose#8777.
robertknight added a commit to hypothesis/h that referenced this pull request Jul 10, 2023
Switch to Docker Compose v2 and change `make services` to use the `--wait` flag
to wait for healthchecks to pass before exiting. Also add a healthcheck for
Elasticsearch. The Makefile changes follow the pattern in the lms app.

Together these changes mean that h and its services can be started with `make
services && make dev`, without encountering errors due to Postgres /
Elasticsearch not being ready to connect.

The `start_period` setting is set to a generous value (1 min) as normal startup
times for ES are quite long (15-20s on my 2020 Intel MacBook Pro).

See also hypothesis/lms#5556.
@seanh
Copy link
Collaborator

seanh commented Jul 10, 2023

Oh nice, I wasn't aware of --wait

FYI you can just run make services dev, you don't need the &&

Copy link
Collaborator

@seanh seanh left a comment

Choose a reason for hiding this comment

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

Oh, apologies, for some reason I thought this was in h (which doesn't use the cookiecutter yet): In LMS a Makefile change like this would have to be made in the cookiecutter (specifically here: https://github.com/hypothesis/cookiecutters/blob/1a447d9aa982a7dee029777f343811746d76aa8d/_shared/project/Makefile#L10) and then it'll get applied to all cookiecutter-using projects

@robertknight
Copy link
Member Author

OK, I moved this change to the cookiecutter here: hypothesis/cookiecutters#141.

@robertknight robertknight deleted the wait-for-healthchecks branch July 10, 2023 11:02
robertknight added a commit to hypothesis/h that referenced this pull request Jul 10, 2023
Switch to Docker Compose v2 and change `make services` to use the `--wait` flag
to wait for healthchecks to pass before exiting. Also add a healthcheck for
Elasticsearch. The Makefile changes follow the pattern in the lms app.

Together these changes mean that h and its services can be started with `make
services && make dev`, without encountering errors due to Postgres /
Elasticsearch not being ready to connect.

The `start_period` setting is set to a generous value (1 min) as normal startup
times for ES are quite long (15-20s on my 2020 Intel MacBook Pro).

See also hypothesis/lms#5556.
robertknight added a commit to hypothesis/h that referenced this pull request Jul 10, 2023
Switch to Docker Compose v2 and change `make services` to use the `--wait` flag
to wait for healthchecks to pass before exiting. Also add a healthcheck for
Elasticsearch. The Makefile changes follow the pattern in the lms app.

Together these changes mean that h and its services can be started with `make
services && make dev`, without encountering errors due to Postgres /
Elasticsearch not being ready to connect.

The `start_period` setting is set to a generous value (1 min) as normal startup
times for ES are quite long (15-20s on my 2020 Intel MacBook Pro).

See also hypothesis/lms#5556.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants