From 77ee9dc39d7cec6598031805d0be9b7e80df834a Mon Sep 17 00:00:00 2001 From: Leopere Date: Sun, 28 Apr 2019 17:26:58 -0400 Subject: [PATCH] Adding and enabling HEALTHCHECK --- chainquery/Dockerfile-linux-x86_64-production | 5 ++++- chainquery/stuff/healthcheck.sh | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chainquery/Dockerfile-linux-x86_64-production b/chainquery/Dockerfile-linux-x86_64-production index c280476..246ce78 100644 --- a/chainquery/Dockerfile-linux-x86_64-production +++ b/chainquery/Dockerfile-linux-x86_64-production @@ -9,6 +9,7 @@ RUN apt-get update && \ WORKDIR / SHELL ["/bin/bash", "-o", "pipefail", "-c"] COPY ./stuff/start.sh start +COPY ./stuff/healthcheck.sh healthcheck RUN curl -L -o /chainquery.zip $(curl -s https://api.github.com/repos/lbryio/chainquery/releases | grep -F 'Linux_x86_64.zip' | grep download | head -n 1 | cut -d'"' -f4) && \ unzip /chainquery.zip && \ rm /chainquery.zip @@ -17,7 +18,9 @@ FROM ubuntu:18.04 as app ADD https://raw.githubusercontent.com/lbryio/chainquery/master/config/default/chainqueryconfig.toml /etc/lbry/chainqueryconfig.toml.orig RUN adduser chainquery --gecos GECOS --shell /bin/bash --disabled-password --home /home/chainquery && \ chown -R chainquery:chainquery /etc/lbry -COPY --from=prep /chainquery /start /usr/bin/ +COPY --from=prep ./healthcheck /chainquery /start /usr/bin/ +HEALTHCHECK --interval=1m --timeout=30s \ + CMD healthcheck EXPOSE 6300 USER chainquery STOPSIGNAL SIGINT diff --git a/chainquery/stuff/healthcheck.sh b/chainquery/stuff/healthcheck.sh index 24cd27b..7584e38 100644 --- a/chainquery/stuff/healthcheck.sh +++ b/chainquery/stuff/healthcheck.sh @@ -1,3 +1,2 @@ #!/usr/bin/env bash -## TODO: Implement this at some point it requires CURL in the container. -curl http://localhost:6300/api/status +curl --fail http://localhost:6300/api/status || exit 1