Use a simpler wait_to_start script.

This commit is contained in:
Ivaylo Novakov 2021-05-11 16:02:48 +02:00
parent c713059249
commit 69a30628b1
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
2 changed files with 35 additions and 4 deletions

View File

@ -33,7 +33,7 @@ services:
jaeger-collector: jaeger-collector:
image: jaegertracing/jaeger-collector image: jaegertracing/jaeger-collector
command: [ "/wait-for-it/wait-for-it.sh", "elasticsearch:9200", "--", "--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200" ] entrypoint: /wait_to_start/wait_to_start.sh
container_name: jaeger-collector container_name: jaeger-collector
restart: on-failure restart: on-failure
expose: expose:
@ -43,8 +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 -O index.html http://elasticsearch:9200
- WAIT_SLEEP=1
- WAIT_LOOPS=600
volumes: volumes:
- ./packages/wait-for-it:/wait-for-it - ./packages/wait_to_start:/wait_to_start
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: [ "/wait-for-it/wait-for-it.sh", "elasticsearch:9200", "--", "--es.num-shards=1", "--es.num-replicas=0", "--es.server-urls=http://elasticsearch:9200" ] entrypoint: /wait_to_start/wait_to_start.sh
container_name: jaeger-query container_name: jaeger-query
restart: on-failure restart: on-failure
ports: ports:
@ -63,8 +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 -O index.html http://elasticsearch:9200
- WAIT_SLEEP=1
- WAIT_LOOPS=600
volumes: volumes:
- ./packages/wait-for-it:/wait-for-it - ./packages/wait_to_start:/wait_to_start
networks: networks:
shared: shared:
ipv4_address: 10.10.10.92 ipv4_address: 10.10.10.92

View File

@ -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