Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ EXPOSE 8080
RUN apk --no-cache add tini
ENTRYPOINT ["/sbin/tini", "-g", "--"]
CMD ["docker-flow-proxy", "server"]
HEALTHCHECK --interval=5s --start-period=3s --timeout=5s CMD check.sh
HEALTHCHECK --interval=5s --start-period=3s --timeout=10s CMD check.sh

COPY scripts/check.sh /usr/local/bin/check.sh
RUN chmod +x /usr/local/bin/check.sh
Expand Down
22 changes: 19 additions & 3 deletions scripts/check.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
if [[ "$HEALTHCHECK" = "true" ]] ; then
if [[ "$HEALTHCHECK" == "true" ]]; then

wget -qO- "http://localhost:8080/v1/docker-flow-proxy/ping"

if [[ $? -ne 0 ]] ; then
if [[ $? -ne 0 ]]; then
echo "ERROR: Failed to ping docker-flow-proxy"
exit 1
fi

pgrep -x "haproxy"

if [[ $? -ne 0 ]] ; then
if [[ $? -ne 0 ]]; then
echo "ERROR: haproxy process is not running"
exit 1
fi

if [[ "$LISTENER_ADDRESS" != "" ]]; then
wget -qO- "http://${LISTENER_ADDRESS}:8080/v1/docker-flow-swarm-listener/ping"

if [[ $? -ne 0 ]]; then
echo "ERROR: Unable to ping ${LISTENER_ADDRESS}"
exit 1
fi

wget -qO- "http://localhost:8080/v1/docker-flow-proxy/reload"

if [[ $? -ne 0 ]]; then
echo "ERROR: Unable to reload docker flow proxy"
exit 1
fi
fi

fi

exit 0