File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,25 @@ ElasticSearch.
5757> [ !TIP]
5858> Use ` task fixtures:load ` to load all fixtures into Elasticsearch.
5959
60+ > [ !CAUTION]
61+ > If the ` task fixtures:load ` command (or any ` bin/console app:fixtures:load ` incantation) fails with an error like
62+ >
63+ > ``` shell
64+ > No alive nodes. All the 1 nodes seem to be down.
65+ > ` ` `
66+ >
67+ > you must reset the Elasticsearch service to be ready for requests, e.g. by running
68+ >
69+ > ` ` ` shell
70+ > docker compose exec elasticsearch curl ' http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' --verbose
71+ > ` ` `
72+ >
73+ > until it returns ` HTTP/1.1 200 OK` (cf. [How to Implement Elasticsearch Health Check in Docker
74+ > Compose](https://www.baeldung.com/ops/elasticsearch-docker-compose)).
75+ >
76+ > Alternatively, you can run ` docker compose up --detach --wait` to recreate all services and
77+ > (automatically) wait for Elasticsearch to be ready – it takes a while …
78+
6079# # Accessing the API
6180
6281To access the API, a valid API key must be presented in the ` X-Api-Key` header, e.g.
Original file line number Diff line number Diff line change @@ -44,6 +44,14 @@ services:
4444 environment :
4545 - discovery.type=single-node
4646 - xpack.security.enabled=false
47+ # We need to be able to wait for Elasticsearch to be ready for requests
48+ # https://www.baeldung.com/ops/elasticsearch-docker-compose
49+ healthcheck :
50+ test : ["CMD-SHELL", "curl -fs 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' || exit 1"]
51+ interval : 10s
52+ timeout : 5s
53+ retries : 5
54+ start_period : 20s
4755
4856 markdownlint :
4957 image : itkdev/markdownlint
You can’t perform that action at this time.
0 commit comments