-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the jaeger-query service that visualizes traces stored in Elast…
…icsearch The jaeger-query service uses a custom image containing a wait script wrapping the jaeger-query binary. The wait script is a workaround for ensuring elastic search is ready before starting the query service. Docker does not support this natively. TODO: figure out a way to download the jaeger-query binary in the Dockerfile, instead of saving the binary in the repo.
- Loading branch information
Uzziah Eyee
committed
May 5, 2019
1 parent
bc47d3a
commit 6e4baac
Showing
4 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM alpine:3.9.3 | ||
|
||
# required by wait script | ||
RUN apk add --no-cache bash curl | ||
|
||
COPY jaeger-query wait.sh /usr/local/bin/ | ||
|
||
RUN chmod +x /usr/local/bin/wait.sh |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Requires a container with Bash and Curl installed. | ||
|
||
is_healthy () { | ||
retryInterval=${2:-5} | ||
maxAttempts=${3:-1000000} | ||
|
||
i=0 | ||
while [ $i -lt $maxAttempts ] | ||
do | ||
status=$(curl -s -L -o /dev/null -w %{http_code} $1) | ||
|
||
# stop trying if we get a success response | ||
if [ $status -ge 200 ] && [ $status -lt 300 ] | ||
then | ||
return 0 | ||
fi | ||
|
||
((i++)) | ||
echo "Attempt $i of $maxAttempts: Endpoint $1 returned code $status. Retrying in $retryInterval seconds." | ||
sleep $retryInterval | ||
done | ||
|
||
return 1 | ||
} | ||
|
||
# args: endpoint, retryInterval (secs), maxAttempts, command | ||
if is_healthy $1 $2 $3 | ||
then | ||
echo "Running command: $4" | ||
# vulnerable to input-injection attacts (but I don't care :) | ||
eval "$4" | ||
else | ||
echo "Exiting: Cannot run command because health-check failed." | ||
fi |