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.
57
57
> [ !TIP]
58
58
> Use ` task fixtures:load ` to load all fixtures into Elasticsearch.
59
59
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
+
60
79
# # Accessing the API
61
80
62
81
To 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:
44
44
environment :
45
45
- discovery.type=single-node
46
46
- 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
47
55
48
56
markdownlint :
49
57
image : itkdev/markdownlint
You can’t perform that action at this time.
0 commit comments