-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
49 lines (47 loc) · 1.53 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
services:
elasticsearch:
build:
context: .
dockerfile: elastic8.dockerfile
image: elastic8
volumes:
- elastic_data:/var/lib/elasticsearch
ports:
- "9200:9200"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health"]
interval: 10s
timeout: 5s
retries: 5
kibana:
build:
context: .
dockerfile: kibana8.dockerfile
image: kibana8
depends_on:
- elasticsearch
entrypoint: |
/bin/bash -c '
echo "Waiting for Elasticsearch to be ready..."
while true; do
CLUSTER_HEALTH=$(curl -s http://elasticsearch:9200/_cluster/health | grep -oP "(?<=\"status\":\")[a-z]+")
if [ "$$CLUSTER_HEALTH" == "green" ]; then
echo "Elasticsearch is completely healthy : status is now $$CLUSTER_HEALTH"
break
elif [ "$$CLUSTER_HEALTH" == "yellow" ]; then
echo "Elasticsearch is partly healthy : status is now $$CLUSTER_HEALTH. It'\''s not great, but it'\''s enough to start Kibana."
break
elif [ "$$CLUSTER_HEALTH" == "red" ]; then
echo "WARNING: Elasticsearch is in $$CLUSTER_HEALTH state. It might resolve by itself in a few seconds. Otherwise check your cluster and try to delete the data volume !"
else
echo "Elasticsearch health status not yet available ... waiting for it to be available ..."
fi
sleep 1
done
echo "Starting Kibana..."
exec kibana
'
ports:
- "5601:5601"
volumes:
elastic_data: