From 584963fd5144925ee47c29a657d3e02a7a8ced47 Mon Sep 17 00:00:00 2001 From: Chris Black Date: Thu, 12 Sep 2024 12:45:03 -0700 Subject: [PATCH] [docker] health check fixes (#3377) * health checks do not see traefik, need internal URLs * -c not needed here --------- Co-authored-by: David LeBauer --- docker-compose.yml | 10 +++++----- docker/data/Dockerfile | 2 +- docker/docs/Dockerfile | 5 +++++ shiny/dbsync/Dockerfile | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c5c77c37da..da03250edc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,7 +99,7 @@ services: - "traefik.http.services.bety.loadbalancer.server.port=8000" - "traefik.http.routers.bety.rule=Host(`${TRAEFIK_HOST:-pecan.localhost}`) && PathPrefix(`/bety/`)" healthcheck: - test: "curl --silent --fail http://localhost:8000/${RAILS_RELATIVE_URL_ROOT} > /dev/null || exit 1" + test: "curl --silent --fail http://localhost:8000/$${RAILS_RELATIVE_URL_ROOT} > /dev/null || exit 1" interval: 10s timeout: 5s retries: 5 @@ -190,7 +190,7 @@ services: - pecan:/data - pecan:/var/www/html/pecan/data healthcheck: - test: "curl --silent --fail http://localhost/pecan/ > /dev/null || exit 1" + test: "curl --silent --fail http://localhost:8080/pecan > /dev/null || exit 1" interval: 10s timeout: 5s retries: 5 @@ -218,7 +218,7 @@ services: volumes: - pecan:/data healthcheck: - test: "curl --silent --fail http://localhost:9999/monitor/ > /dev/null || exit 1" + test: "curl --silent --fail http://localhost:9999 > /dev/null || exit 1" interval: 10s timeout: 5s retries: 5 @@ -354,7 +354,7 @@ services: - "traefik.http.routers.dbsync.middlewares=dbsync-stripprefix" - "traefik.http.middlewares.dbsync-stripprefix.stripprefix.prefixes=/monitor" healthcheck: - test: "curl --silent --fail http://localhost/dbsync/ > /dev/null || exit 1" + test: "curl --silent --fail http://localhost:3838 > /dev/null || exit 1" interval: 10s timeout: 5s retries: 5 @@ -386,7 +386,7 @@ services: volumes: - pecan:/data/ healthcheck: - test: "curl --silent --fail http://localhost/api/ping > /dev/null || exit 1" + test: "curl --silent --fail http://localhost:8000/api/ping > /dev/null || exit 1" interval: 10s timeout: 5s retries: 5 diff --git a/docker/data/Dockerfile b/docker/data/Dockerfile index b058138603..1302d201ac 100644 --- a/docker/data/Dockerfile +++ b/docker/data/Dockerfile @@ -18,4 +18,4 @@ RUN apk --no-cache add bash curl rsync postgresql-client unzip \ && curl -s -o create_met_driver.tar.gz http://isda.ncsa.illinois.edu/~kooper/EBI/create_met_driver.tar.gz COPY add-data.sh add.util.sh /work/ -CMD ["bash", "-c", "/work/add-data.sh"] +CMD ["bash", "/work/add-data.sh"] diff --git a/docker/docs/Dockerfile b/docker/docs/Dockerfile index dcc7955b18..315769eed5 100644 --- a/docker/docs/Dockerfile +++ b/docker/docs/Dockerfile @@ -28,6 +28,11 @@ RUN make build # ---------------------------------------------------------------------- FROM httpd +# need curl for health checks +RUN apt-get update \ + && apt-get install -y curl \ + && rm -rf /var/lib/apt/lists/* + COPY docker/docs/index.html /usr/local/apache2/htdocs/ COPY --from=pecandocs /src/book_source/_book/ /usr/local/apache2/htdocs/docs/pecan/ diff --git a/shiny/dbsync/Dockerfile b/shiny/dbsync/Dockerfile index a133290de8..ccc93a5697 100644 --- a/shiny/dbsync/Dockerfile +++ b/shiny/dbsync/Dockerfile @@ -7,7 +7,7 @@ ENV PGHOST=postgres \ GEOCACHE=/srv/shiny-server/geoip.json RUN apt-get update \ - && apt-get -y install libpq-dev libssl-dev \ + && apt-get -y install curl libpq-dev libssl-dev \ && install2.r -e -s -n -1 curl dbplyr DT leaflet RPostgreSQL \ && rm -rf /srv/shiny-server/* \ && rm -rf /var/lib/apt/lists/*