docker: make home wait for solr via healthcheck in compose.override.yaml#12325
Conversation
|
Thank you for this contribution, @modi02! @RayBB is assigned to this PR and currently has:
PR triage checklist (maintainers / Pam)
Note This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting. |
There was a problem hiding this comment.
Pull request overview
Updates the local Docker dev workflow so the home service waits for Solr readiness via Docker Compose healthchecks, replacing the manual Solr polling loop previously embedded in docker/ol-home-start.sh.
Changes:
- Removed the “Waiting for Solr…” polling loop from
docker/ol-home-start.sh. - Added a Solr HTTP healthcheck in
compose.override.yamland madehomedepend on Solr being healthy before starting.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
docker/ol-home-start.sh |
Removes the in-container Solr wait loop so startup sequencing is handled by Compose. |
compose.override.yaml |
Introduces Solr healthcheck + home depends_on gating on service_healthy. |
| healthcheck: | ||
| test: ["CMD", "curl", "-sf", "http://localhost:8983/solr/openlibrary/admin/ping"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 10 |
There was a problem hiding this comment.
healthcheck is indented at the same level as the service definitions (e.g., solr-updater:), so it will be treated as a separate service named healthcheck rather than the solr service’s healthcheck. This will prevent depends_on: condition: service_healthy from working and may make the compose file invalid. Indent healthcheck: (and its fields) so it is under the solr: service block.
RayBB
left a comment
There was a problem hiding this comment.
Please restore the new line at the end of the script file and use the health check that we added in the most recent pull request. You may need to branch off the most recent version of master.
https://github.com/internetarchive/openlibrary/pull/11570/changes
|
Also, please include screenshots of what happens when you run Docker Compose up and preferably timings before and after. |
09ad38a to
447dc33
Compare
RayBB
left a comment
There was a problem hiding this comment.
Almost there, just need to remove the submodule changes you committed.
Should be possible to do this with make git or follow our git guide on docs.openlibrary.org for more info.
447dc33 to
f8323c0
Compare
f8323c0 to
3750143
Compare
3750143 to
c1df5e2
Compare
RayBB
left a comment
There was a problem hiding this comment.
This is awesome, good job! It cuts startup time by about 24% in my case (8.501s → 6.473s)
|
Hi @RayBB, glad the improvement was useful! Apologies for the delayed comment, had some trouble attaching the screenshots earlier, but it looks like you were able to verify the fix directly. |
Closes #12321
Summary
Replaces the manual Solr polling loop in
docker/ol-home-start.shwithDocker's native
healthcheckanddepends_onmechanism.Changes
healthcheckto thesolrservice incompose.override.yamlusing the
/solr/openlibrary/admin/pingendpoint (consistent with fix: Add wait_for_solr to prevent race condition on startup (#11013) #11570)depends_on: solr: condition: service_healthyto thehomeservice in
compose.override.yamldocker/ol-home-start.shcompose.override.yamlfor postgres and makehomewait ondb#12322Testing
Run
docker compose upand verify thehomeservice starts only afterSolr is healthy, without the manual polling loop.
Checklist
/solr/openlibrary/admin/pingendpoint