From 05b4b5a527c5e64d07a80dcfc6a51c707a646e82 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Tue, 11 May 2021 13:51:58 +0200 Subject: [PATCH] Use wait-for-it in order to only start Jaeger after Elasticsearch is ready. --- .gitmodules | 3 +++ docker-compose.accounts.yml | 2 +- docker-compose.jaeger.yml | 17 +++++++++++++---- docker/wait-for-it/Dockerfile | 3 +++ docker/wait-for-it/wait-for-it | 1 + 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 .gitmodules create mode 100644 docker/wait-for-it/Dockerfile create mode 160000 docker/wait-for-it/wait-for-it diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..deebbc02 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docker/wait-for-it/wait-for-it"] + path = docker/wait-for-it/wait-for-it + url = https://github.com/vishnubob/wait-for-it.git diff --git a/docker-compose.accounts.yml b/docker-compose.accounts.yml index 2f000764..a9bca9e3 100644 --- a/docker-compose.accounts.yml +++ b/docker-compose.accounts.yml @@ -70,7 +70,7 @@ services: kratos-migrate: image: oryd/kratos:v0.5.5-alpha.1 container_name: kratos-migrate - restart: "no" + restart: off logging: *default-logging environment: - DSN=cockroach://root@cockroach:26257/defaultdb?max_conns=20&max_idle_conns=4&sslmode=verify-full&sslcert=/certs/node.crt&sslkey=/certs/node.key&sslrootcert=/certs/ca.crt diff --git a/docker-compose.jaeger.yml b/docker-compose.jaeger.yml index 7b9f1b76..22ff2fda 100644 --- a/docker-compose.jaeger.yml +++ b/docker-compose.jaeger.yml @@ -13,8 +13,6 @@ services: - JAEGER_AGENT_HOST=jaeger-agent - JAEGER_AGENT_PORT=6831 - JAEGER_REPORTER_LOG_SPANS=false - depends_on: - - jaeger-agent jaeger-agent: image: jaegertracing/jaeger-agent @@ -49,7 +47,7 @@ services: shared: ipv4_address: 10.10.10.91 depends_on: - - elasticsearch + - wait-for-it jaeger-query: image: jaegertracing/jaeger-query @@ -67,7 +65,18 @@ services: shared: ipv4_address: 10.10.10.92 depends_on: - - elasticsearch + - wait-for-it + + wait-for-it: + build: + context: ./docker/wait-for-it + dockerfile: Dockerfile + command: [ "./wait-for-it.sh", "localhost:9200" ] + container_name: wait-for-it + restart: on-failure + networks: + shared: + ipv4_address: 10.10.10.95 elasticsearch: image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.15 diff --git a/docker/wait-for-it/Dockerfile b/docker/wait-for-it/Dockerfile new file mode 100644 index 00000000..f1d23e1f --- /dev/null +++ b/docker/wait-for-it/Dockerfile @@ -0,0 +1,3 @@ +FROM bash:5 + +COPY wait-for-it/wait-for-it.sh ./ diff --git a/docker/wait-for-it/wait-for-it b/docker/wait-for-it/wait-for-it new file mode 160000 index 00000000..81b1373f --- /dev/null +++ b/docker/wait-for-it/wait-for-it @@ -0,0 +1 @@ +Subproject commit 81b1373f17855a4dc21156cfe1694c31d7d1792e