From 0605c2843b94e199ef98838283ea075a6f366b1c Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 26 May 2022 09:07:33 +0200 Subject: [PATCH 1/3] add healthcheck --- CHANGES_NEXT_RELEASE | 1 + docker/Dockerfile | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index bb770094be..192a985788 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- Add: Docker healthcheck based on context broker API - Add: support for Feature and FeaturesCollection GeoJSON types (normalizing geometries) in entity locations (#4114) - Add: support to null element in string list filters (e.g. q=A:foo,null) (#4120) - Add: improve BadInput logs with extra information when available (#4121) diff --git a/docker/Dockerfile b/docker/Dockerfile index 86dffa6284..b4048dc808 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -170,3 +170,6 @@ LABEL "org.opencontainers.image.source"=https://github.com/${GITHUB_ACCOUNT}/${G RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \ && sed -i -r 's#^(.*):[^:]*$#\1:/sbin/nologin#' /etc/passwd USER nobody + +HEALTHCHECK --interval=60s --timeout=5s --start-period=10s \ + CMD curl --fail -X GET http://localhost:1026/version || exit 1 From 8fdb375f6723b41009fdadcc2e9fc3c2ad7d41ae Mon Sep 17 00:00:00 2001 From: Alvaro Vega Date: Thu, 26 May 2022 09:34:08 +0200 Subject: [PATCH 2/3] keep curl for healthcheck --- docker/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b4048dc808..f5d89beda2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -128,7 +128,6 @@ RUN \ /opt/fiware-orion && \ # remove the same packages we installed at the beginning to build Orion apt-get -y remove --purge \ - curl \ cmake \ libssl-dev \ git \ From 9e78dd19ab01c643a5c15b056af9e58cb66eae90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 26 May 2022 09:56:45 +0200 Subject: [PATCH 3/3] FIX healthcheck condition --- docker/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f5d89beda2..715fa47d66 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -171,4 +171,6 @@ RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \ USER nobody HEALTHCHECK --interval=60s --timeout=5s --start-period=10s \ - CMD curl --fail -X GET http://localhost:1026/version || exit 1 + # Note we cannot use GET /version for healthchecking as that operation is working even in the case + # the database is down. In this sense, GET /v2/entities is better, as it touches database + CMD curl --fail -X GET http://localhost:1026/v2/entities?limit=1 || exit 1