Imporve dcae2 init scripts 85/41085/2
authorLusheng Ji <lji@research.att.com>
Wed, 4 Apr 2018 21:25:06 +0000 (17:25 -0400)
committerLusheng Ji <lji@research.att.com>
Wed, 4 Apr 2018 21:31:42 +0000 (21:31 +0000)
Issue-ID: DCAEGEN2-206
Change-Id: I7e60806369eef5a816f6c5c686f1061debc833ee
Signed-off-by: Lusheng Ji <lji@research.att.com>
boot/dcae2_install.sh
boot/dcae2_vm_init.sh

index b59f06f..3446b6c 100755 (executable)
@@ -139,7 +139,8 @@ if [ "$DEPLOYMENT_PROFILE" == "R2MVP" ]; then
   RELEASE_TAG='R2'
   rm -rf /opt/app/inputs-templates
   mkdir -p /opt/app/inputs-templates
-  wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/${DEPLOYMENT_PROFILE}/docker-compose.yaml
+  wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/${DEPLOYMENT_PROFILE}/docker-compose-1.yaml
+  wget -P /opt/app/inputs-templates https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/heat/${DEPLOYMENT_PROFILE}/docker-compose-2.yaml
 
   pip install --upgrade jinja2
   wget https://${URL_ROOT}/${REPO_DEPLOYMENTS}/${RELEASE_TAG}/scripts/detemplate-bpinputs.py && \
index 581c0bf..ac6713d 100755 (executable)
@@ -685,6 +685,58 @@ fi
 
 if [ "$DEPLOYMENT_PROFILE" == "R2MVP" ]; then
   cd /opt/app/config
-  /opt/docker/docker-compose up -d
+  /opt/docker/docker-compose -f docker-compose-1.yaml up -d
+  echo "Waiting for Consul to come up ready"
+  while ! nc -z localhost 8500; do sleep 1; done
+  echo "Waiting for DB to come up ready"
+  while ! nc -z localhost 5432; do sleep 1; done
+  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
+
+  NAME='config_binding_service'
+  PORT='10000'
+  ID=$(sudo docker ps |grep "$NAME" |cut -b1-12)
+  while [ -z "$ID" ]; do echo "Waiting for $NAME container to be deployed"; sleep 1; ID=$(sudo docker ps |grep "$NAME" |cut -b1-12); done
+  REG='{"ID": "'"$NAME"'0", "Name": "'"$NAME"'", "Address": "'"$NAME"'", "Port": '"$PORT"'}'
+  curl -v -X PUT -H "Content-Type: application/json" --data "${REG}" http://localhost:8500/v1/agent/service/register
+
+  sleep 5
+  echo "Now bring up DCAE service components"
+  /opt/docker/docker-compose -f docker-compose-2.yaml up -d
+
+  
+  NAME='ves'
+  PORT='8080'
+  echo "Registering for $NAME:$PORT"
+  ID=$(sudo docker ps |grep "$NAME" |cut -b1-12)
+  while [ -z "$ID" ]; do echo "Waiting for $NAME container to be deployed"; sleep 1; ID=$(sudo docker ps |grep "$NAME" |cut -b1-12); done
+  REG='{"ID": "'"$NAME"'", "Name": "'"$NAME"'", "Address": "'"$NAME"'", "Port": '"$PORT"'}'
+  curl -v -X PUT -H "Content-Type: application/json" --data "${REG}" http://localhost:8500/v1/agent/service/register
+
+  NAME='tca'
+  PORT='11011'
+  echo "Registering for $NAME:$PORT"
+  ID=$(sudo docker ps |grep "$NAME" |cut -b1-12)
+  while [ -z "$ID" ]; do echo "Waiting for $NAME container to be deployed"; sleep 1; ID=$(sudo docker ps |grep "$NAME" |cut -b1-12); done
+  REG='{"ID": "'"$NAME"'", "Name": "'"$NAME"'", "Address": "'"$NAME"'", "Port": '"$PORT"'}'
+  curl -v -X PUT -H "Content-Type: application/json" --data "${REG}" http://localhost:8500/v1/agent/service/register
+
+  NAME='hr'
+  PORT='9101'
+  echo "Registering for $NAME:$PORT"
+  ID=$(sudo docker ps |grep "$NAME" |cut -b1-12)
+  while [ -z "$ID" ]; do echo "Waiting for $NAME container to be deployed"; sleep 1; ID=$(sudo docker ps |grep "$NAME" |cut -b1-12); done
+  REG='{"ID": "'"$NAME"'", "Name": "'"$NAME"'", "Address": "'"$NAME"'", "Port": '"$PORT"'}'
+  curl -v -X PUT -H "Content-Type: application/json" --data "${REG}" http://localhost:8500/v1/agent/service/register
+
+  NAME='he'
+  PORT='9102'
+  echo "Registering for $NAME:$PORT"
+  ID=$(sudo docker ps |grep "$NAME" |cut -b1-12)
+  while [ -z "$ID" ]; do echo "Waiting for $NAME container to be deployed"; sleep 1; ID=$(sudo docker ps |grep "$NAME" |cut -b1-12); done
+  REG='{"ID": "'"$NAME"'", "Name": "'"$NAME"'", "Address": "'"$NAME"'", "Port": '"$PORT"'}'
+  curl -v -X PUT -H "Content-Type: application/json" --data "${REG}" http://localhost:8500/v1/agent/service/register
 fi