Skip to content

Commit 53ca6ac

Browse files
MatusBekeclaude
andcommitted
Drop grep from the Solr probe by asking the core's ping handler
Follow-up to review feedback that `grep` is as implicit a dependency as `curl` was. It is not, strictly - in Debian the two differ: grep: Essential=yes (apt refuses to remove it; it is part of the base system) curl: Essential=no (genuinely optional, which is why it is now installed explicitly) But the objection points at something better than installing another package: the probe does not need grep at all. Asking the core's own ping handler is enough, because an unregistered core is not a route: curl -fsS -o /dev/null http://localhost:8983/solr/search/admin/ping registered core -> HTTP 200, exit 0 unloaded core -> HTTP 404, exit 22 Verified by unloading and recreating the core against the running container. This is a better probe than the CoreAdmin STATUS + grep it replaces: - depends on curl alone, no pipe and no second binary - does not match on Solr's JSON, which a Solr upgrade could reformat - ping executes a real query against the core, so it checks the core answers rather than merely appearing in a list Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent f519da8 commit 53ca6ac

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

docker-compose.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,17 @@ services:
250250
precreate-core statistics /opt/solr/server/solr/configsets/statistics
251251
cp -r /opt/solr/server/solr/configsets/statistics/* statistics
252252
exec solr -f
253-
# A port check is not enough: precreate-core runs AFTER Solr starts listening,
254-
# so a port probe goes green while DSpace would still fail every query.
255-
# Asking for a specific core discriminates - a missing core returns
256-
# {"status":{"search":{}}} with no "name", so the grep fails.
253+
# Asks the core's own ping handler rather than the CoreAdmin list. A registered core
254+
# answers 200; an unregistered one is simply not a route, so Solr answers 404 and
255+
# curl -f fails. That is worth more than it looks:
256+
# - no pipe and no grep, so the probe depends on nothing but curl
257+
# - no matching on Solr's JSON, which could be reformatted by a Solr upgrade
258+
# - ping runs a real query against the core, so it checks the core actually
259+
# answers rather than merely appearing in a list
260+
# A port check would be useless here: precreate-core runs AFTER Solr starts
261+
# listening, so the port is up while every DSpace query would still fail.
257262
healthcheck:
258-
test: ["CMD-SHELL", "curl -fsS 'http://localhost:8983/solr/admin/cores?action=STATUS&core=search' | grep -q '\"name\":\"search\"'"]
263+
test: ["CMD-SHELL", "curl -fsS -o /dev/null http://localhost:8983/solr/search/admin/ping"]
259264
interval: 10s
260265
timeout: 5s
261266
retries: 5

0 commit comments

Comments
 (0)