From 84a3c9a7770107470c676be9493f59acf2c140d7 Mon Sep 17 00:00:00 2001 From: tierno Date: Wed, 24 Oct 2018 11:02:57 +0200 Subject: [PATCH] adding healthcheck to LCM Change-Id: I6bee107efe96003c2eb69a271df9db28ad896379 Signed-off-by: tierno --- docker/LCM/Dockerfile | 4 ++++ installers/osm_health.sh | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docker/LCM/Dockerfile b/docker/LCM/Dockerfile index 46be58e7..ce39bc5b 100644 --- a/docker/LCM/Dockerfile +++ b/docker/LCM/Dockerfile @@ -91,5 +91,9 @@ ENV OSMLCM_MESSAGE_DRIVER kafka ENV OSMLCM_MESSAGE_HOST kafka ENV OSMLCM_MESSAGE_PORT 9092 +HEALTHCHECK --interval=30s --timeout=140s --retries=1 \ + CMD python3 /usr/lib/python3/dist-packages/osm_lcm/lcm.py --health-check || exit 1 + + # Run app.py when the container launches CMD ["python3", "/usr/lib/python3/dist-packages/osm_lcm/lcm.py"] diff --git a/installers/osm_health.sh b/installers/osm_health.sh index 4625dc80..b8e24ada 100755 --- a/installers/osm_health.sh +++ b/installers/osm_health.sh @@ -1,8 +1,8 @@ #!/bin/sh -WAIT_TIME=60 -NUM_SERVICES_WITH_HEALTH=3 -SERVICES_WITH_HEALTH="nbi ro kafka" +WAIT_TIME=180 # LCM healthcheck needs 140 senconds +SERVICES_WITH_HEALTH="nbi ro zookeeper lcm" +NUM_SERVICES_WITH_HEALTH=$(echo $SERVICES_WITH_HEALTH | wc -w) while getopts "w:s:n:c:" o; do case "${o}" in @@ -23,7 +23,7 @@ done time=0 -step=1 +step=2 while [ $time -le "$WAIT_TIME" ]; do if [ "$(docker ps | grep " ${STACK_NAME}_" | grep -i healthy | wc -l)" -ge "$NUM_SERVICES_WITH_HEALTH" ]; then exit 0 -- 2.25.1