VM start script improvements. 83/43383/2
authorLusheng Ji <lji@research.att.com>
Tue, 17 Apr 2018 15:30:11 +0000 (11:30 -0400)
committerLusheng Ji <lji@research.att.com>
Tue, 17 Apr 2018 15:32:47 +0000 (11:32 -0400)
1. improved vm_init script
2. enabled vm_init script at the end of install script
3. noting that now supporting more deployment profiles

Issue-ID: DCAEGEN2-434
Change-Id: I2bcbe1c79571dad5f6d8998f02eaf702efa5625e
Signed-off-by: Lusheng Ji <lji@research.att.com>
boot/dcae2_install.sh
boot/dcae2_vm_init.sh
heat/ONAP/onap_openstack.env

index ac3c3b5..372c25b 100755 (executable)
@@ -46,9 +46,7 @@ apt-get update
 apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget git ntp ntpdate python python-pip
 
 # Download scripts from Nexus
-if [ ! -e /opt/dcae2_vm_init.sh ]; then
 curl -k "$NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/dcae2_vm_init.sh" -o /opt/dcae2_vm_init.sh
-fi
 curl -k "$NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/dcae2_serv.sh" -o /opt/dcae2_serv.sh
 chmod +x /opt/dcae2_vm_init.sh
 chmod +x /opt/dcae2_serv.sh
@@ -108,4 +106,4 @@ chmod 777 /opt/app/config/key
 
 
 cd /opt
-#./dcae2_vm_init.sh
+./dcae2_vm_init.sh
index d26bb47..5fd2d66 100755 (executable)
@@ -718,7 +718,7 @@ if [[ $DEPLOYMENT_PROFILE == R2* ]]; then
   wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/docker-compose-4.yaml
   wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/register.sh
   wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/setup.sh
-  wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/build-plugins.sh
+  wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/teardown.sh
 
   pip install --upgrade jinja2
   wget https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/scripts/detemplate-bpinputs.py \
@@ -747,10 +747,11 @@ if [[ $DEPLOYMENT_PROFILE == R2* ]]; then
   echo "Waiting for CBS to come up ready"
   while ! nc -z localhost 10000; do sleep 1; done
   echo "All dependencies are up, proceed to the next phase"
-  sleep 5
+  sleep 30
 
   echo "Setup CloudifyManager and Registrator"
   ./setup.sh
+  sleep 10
   ./register.sh
 
   echo "Bring up DCAE MIN service components for R2 use cases"
@@ -801,6 +802,10 @@ docker run -d \
 -p ${HEALTHPORT}:80 \
 -v "$(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf" \
 -v "/tmp/healthcheck:/www/healthcheck" \
+--label "SERVICE_80_NAME=dcae-health" \
+--label "SERVICE_80_CHECK_HTTP=/healthcheck" \
+--label "SERVICE_80_CHECK_INTERVAL=15s" \
+--label "SERVICE_80_CHECK_INITIAL_STATUS=passing" \
  nginx
 
 echo "Healthcheck API available at http://${MYFLOATIP}:${HEALTHPORT}/healthcheck"
@@ -809,6 +814,7 @@ echo "                             http://${MYFLOATIP}:${HEALTHPORT}/R2MIN"
 echo "                             http://${MYFLOATIP}:${HEALTHPORT}/R2PLUS"
 
 # run forever for updating health status based on consul
+set +e
 while :
 do
   rm -rf /tmp/healthcheck/*
@@ -822,7 +828,8 @@ do
 
   SERVICES_JSON=$(echo "$SERVICES" | sed 's/\"$/\",/g' | sed '$ s/.$//')
 
-
+  echo "$(date): running healthy services:"
+  echo ">>> " $SERVICES
   PLT_CONSUL=$(echo "$SERVICES" |grep consul)
   PLT_CBS=$(echo "$SERVICES" |grep "config_binding_service")
   MVP_PG_HOLMES=$(echo "$SERVICES" |grep "pgHolmes")
@@ -844,21 +851,29 @@ do
   PLUS_TRAP=$(echo "$SERVICES" |grep "snmptrap")
 
   DATA="{\"healthy\" : \"$(date)\", \"healthy_services\": [${SERVICES_JSON}]}"
-  if [[ -n $PLT_CONSUL && -n $PLT_CBS && -n $MVP_PG_HOLMES && -n $MVP_VES && \
-        -n $MVP_TCA && -n $MVP_HR && -n $MVP_HE ]]; then
+  if [[ -n "$PLT_CONSUL" && -n "$PLT_CBS" && -n "$MVP_PG_HOLMES" && -n "$MVP_VES" && \
+        -n "$MVP_TCA" && -n "$MVP_HR" && -n "$MVP_HE" ]]; then
     echo "${DATA}" > /tmp/healthcheck/r2mvp_healthy.yaml
     echo "${DATA}" > /tmp/healthcheck/services.yaml
+    echo ">>>>>> enough services satisfying R2MIN service deployment"
+  else
+    echo ">>>>>> not enough services satisfying R2MIN service deployment"
   fi
 
-  if [[ -n $CONSUL && -n $CBS && -n $PLT_CM && -n $PLT_DH && \
-        -n $PLT_PH && -n $PLT_SCH && -n $PLT_INV && -n $PLT_PG_INVENTORY ]]; then
+  if [[ -n "$PLT_CONSUL" && -n "$PLT_CBS" && -n "$PLT_CM" && -n "$PLT_DH" && \
+        -n "$PLT_PH" && -n "$PLT_SCH" && -n "$PLT_INV" && -n "$PLT_PG_INVENTORY" ]]; then
+    echo ">>>>>> enough services satisfying R2 platform deployment"
     echo "${DATA}" > /tmp/healthcheck/r2_healthy.yaml
 
-    if [[ -n $PLUS_MHB && -n $PLUS_PRH && -n $PLUS_MPR && -n $PLUS_TRAP ]]; then
+    if [[ -n "$PLUS_MHB" && -n "$PLUS_PRH" && -n "$PLUS_MPR" && -n "$PLUS_TRAP" ]]; then
+      echo ">>>>>> enough services satisfying R2PLUS deployment"
       echo "${DATA}" > /tmp/healthcheck/r2plus_healthy.yaml
+    else
+      echo ">>>>>> not enough services satisfying R2PLUS service deployment"
     fi
+  else
+    echo ">>>>>> not enough services satisfying R2 platform or R2PLUS service deployment"
   fi
-
   sleep 60
 done
 
index 8ed1986..9e8cc3a 100644 (file)
@@ -100,7 +100,7 @@ parameters:
   #                         #
   ###########################
 
-  dcae_deployment_profile: PUT DCAE DEPLOYMENT PROFILE (R1 or R2MVP)
+  dcae_deployment_profile: PUT DCAE DEPLOYMENT PROFILE (R1, R2MVP, R2, or R2PLUS)
   dnsaas_config_enabled: PUT WHETHER TO USE PROXYED DESIGNATE
   dnsaas_region: PUT THE DESIGNATE PROVIDING OPENSTACK'S REGION HERE
   dnsaas_keystone_url: PUT THE DESIGNATE PROVIDING OPENSTACK'S KEYSTONE URL HERE
@@ -225,4 +225,4 @@ parameters:
   vnfsdk_repo: http://gerrit.onap.org/r/vnfsdk/refrepo.git
   music_repo: http://gerrit.onap.org/r/music.git
   nbi_repo: http://gerrit.onap.org/r/externalapi/nbi.git
-  aaf_repo: http://gerrit.onap.org/r/aaf/authz.git
\ No newline at end of file
+  aaf_repo: http://gerrit.onap.org/r/aaf/authz.git