adding healthcheck to LCM 51/6751/9
authortierno <alfonso.tiernosepulveda@telefonica.com>
Wed, 24 Oct 2018 09:02:57 +0000 (11:02 +0200)
committertierno <alfonso.tiernosepulveda@telefonica.com>
Tue, 30 Oct 2018 21:23:43 +0000 (22:23 +0100)
Change-Id: I6bee107efe96003c2eb69a271df9db28ad896379
Signed-off-by: tierno <alfonso.tiernosepulveda@telefonica.com>
docker/LCM/Dockerfile
installers/osm_health.sh

index 46be58e..ce39bc5 100644 (file)
@@ -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"]
index 4625dc8..b8e24ad 100755 (executable)
@@ -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