aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Platania <platania@research.att.com>2018-05-12 12:09:22 -0400
committerMarco Platania <platania@research.att.com>2018-05-12 12:09:22 -0400
commit16b51aa5e929b680957725fab2cb18d87a99fb1d (patch)
tree5fbe49853f725749f506245c175ee7eaf51ef58b
parent13acacacf107b027be129f4ad4a28923443816d9 (diff)
Start SDNC containers after SDC
- Run Health Check against SDC before starting SDNC containers - Wait for 10 minutes, otherwise start SDNC anyways, even though UEB Listener may not be healthy Change-Id: Ia4933e671180c71d7ca07e385e728def9e152024 Issue-ID: INT-444 Signed-off-by: Marco Platania <platania@research.att.com>
-rw-r--r--boot/sdnc_install.sh2
-rw-r--r--boot/sdnc_vm_init.sh19
2 files changed, 19 insertions, 2 deletions
diff --git a/boot/sdnc_install.sh b/boot/sdnc_install.sh
index 3b5c5cfa..da39da5e 100644
--- a/boot/sdnc_install.sh
+++ b/boot/sdnc_install.sh
@@ -51,7 +51,7 @@ fi
echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
apt-get update
-apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make
+apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget openjdk-8-jdk git ntp ntpdate make jq
# Download scripts from Nexus
curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/sdnc_vm_init.sh -o /opt/sdnc_vm_init.sh
diff --git a/boot/sdnc_vm_init.sh b/boot/sdnc_vm_init.sh
index c681e1a5..a5236849 100644
--- a/boot/sdnc_vm_init.sh
+++ b/boot/sdnc_vm_init.sh
@@ -32,4 +32,21 @@ docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ueb-listener-image:$DOCKER_IMAGE_VERSION
docker pull $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION
docker tag $NEXUS_DOCKER_REPO/onap/sdnc-dmaap-listener-image:$DOCKER_IMAGE_VERSION onap/sdnc-dmaap-listener-image:latest
-/opt/docker/docker-compose up -d
+echo "Waiting for 10 minutes for SDC to start";
+RES=$(curl -s -X GET http://10.0.3.1:8080/sdc2/rest/healthCheck -H 'Accept: application/json' -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -H 'Postman-Token: ffeba4a6-82b6-44d8-87e6-8b510f1127fd' | jq '.componentsInfo[] | select(.healthCheckComponent == "BE") | .description')
+counter=0;
+while [[ $RES != "\"OK\"" ]]; do
+ sleep 10;
+ let counter=$counter+1
+ if [[ $counter -eq 60 ]]; then
+ break;
+ fi
+done
+
+if [[ $RES == "\"OK\"" ]]; then
+ echo "Starting SDNC containers"
+else
+ echo "Timeout expired before SDC BE health check passed. SDNC containers starting, but UEB Listener may not be healthy"
+fi
+
+/opt/docker/docker-compose up -d \ No newline at end of file