Merge pull request #757 from SkynetLabs/ivo/jaeger_es
Wait for Elasticsearch to be ready
This commit is contained in:
commit
b758010c59
|
@ -13,8 +13,6 @@ services:
|
||||||
- JAEGER_AGENT_HOST=jaeger-agent
|
- JAEGER_AGENT_HOST=jaeger-agent
|
||||||
- JAEGER_AGENT_PORT=6831
|
- JAEGER_AGENT_PORT=6831
|
||||||
- JAEGER_REPORTER_LOG_SPANS=false
|
- JAEGER_REPORTER_LOG_SPANS=false
|
||||||
depends_on:
|
|
||||||
- jaeger-agent
|
|
||||||
|
|
||||||
jaeger-agent:
|
jaeger-agent:
|
||||||
image: jaegertracing/jaeger-agent
|
image: jaegertracing/jaeger-agent
|
||||||
|
@ -35,7 +33,7 @@ services:
|
||||||
|
|
||||||
jaeger-collector:
|
jaeger-collector:
|
||||||
image: jaegertracing/jaeger-collector
|
image: jaegertracing/jaeger-collector
|
||||||
command: [ "--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200" ]
|
entrypoint: /wait_to_start.sh
|
||||||
container_name: jaeger-collector
|
container_name: jaeger-collector
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
expose:
|
expose:
|
||||||
|
@ -45,6 +43,12 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- SPAN_STORAGE_TYPE=elasticsearch
|
- SPAN_STORAGE_TYPE=elasticsearch
|
||||||
- LOG_LEVEL=debug
|
- LOG_LEVEL=debug
|
||||||
|
- WAIT_START_CMD=/go/bin/collector-linux --es.num-shards=1 --es.num-replicas=0 --es.server-urls=http://elasticsearch:9200
|
||||||
|
- WAIT_COMMAND=wget -qO index.html http://elasticsearch:9200
|
||||||
|
- WAIT_SLEEP=1
|
||||||
|
- WAIT_LOOPS=600
|
||||||
|
volumes:
|
||||||
|
- ./scripts/wait_to_start.sh:/wait_to_start.sh:ro
|
||||||
networks:
|
networks:
|
||||||
shared:
|
shared:
|
||||||
ipv4_address: 10.10.10.91
|
ipv4_address: 10.10.10.91
|
||||||
|
@ -53,7 +57,7 @@ services:
|
||||||
|
|
||||||
jaeger-query:
|
jaeger-query:
|
||||||
image: jaegertracing/jaeger-query
|
image: jaegertracing/jaeger-query
|
||||||
command: [ "--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200" ]
|
entrypoint: /wait_to_start.sh
|
||||||
container_name: jaeger-query
|
container_name: jaeger-query
|
||||||
restart: on-failure
|
restart: on-failure
|
||||||
ports:
|
ports:
|
||||||
|
@ -63,6 +67,12 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- SPAN_STORAGE_TYPE=elasticsearch
|
- SPAN_STORAGE_TYPE=elasticsearch
|
||||||
- LOG_LEVEL=debug
|
- LOG_LEVEL=debug
|
||||||
|
- WAIT_START_CMD=/go/bin/query-linux --es.num-shards=1 --es.num-replicas=0 --es.server-urls=http://elasticsearch:9200
|
||||||
|
- WAIT_COMMAND=wget -qO index.html http://elasticsearch:9200
|
||||||
|
- WAIT_SLEEP=1
|
||||||
|
- WAIT_LOOPS=600
|
||||||
|
volumes:
|
||||||
|
- ./scripts/wait_to_start.sh:/wait_to_start.sh:ro
|
||||||
networks:
|
networks:
|
||||||
shared:
|
shared:
|
||||||
ipv4_address: 10.10.10.92
|
ipv4_address: 10.10.10.92
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo $WAIT_COMMAND
|
||||||
|
echo $WAIT_START_CMD
|
||||||
|
|
||||||
|
is_ready() {
|
||||||
|
eval "$WAIT_COMMAND"
|
||||||
|
}
|
||||||
|
|
||||||
|
# wait until is ready
|
||||||
|
i=0
|
||||||
|
while ! is_ready; do
|
||||||
|
i=`expr $i + 1`
|
||||||
|
if [ $i -ge $WAIT_LOOPS ]; then
|
||||||
|
echo "$(date) - still not ready, giving up"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "$(date) - waiting to be ready"
|
||||||
|
sleep $WAIT_SLEEP
|
||||||
|
done
|
||||||
|
|
||||||
|
#start the script
|
||||||
|
exec $WAIT_START_CMD
|
Reference in New Issue