From: Lusheng Ji Date: Wed, 4 Apr 2018 21:25:06 +0000 (-0400) Subject: Imporve dcae2 init scripts X-Git-Tag: v1.2.0~97^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=8533616f90d28b89be5bb3598cb87e98ca51fe2e;p=demo.git Imporve dcae2 init scripts Issue-ID: DCAEGEN2-206 Change-Id: I7e60806369eef5a816f6c5c686f1061debc833ee Signed-off-by: Lusheng Ji --- diff --git a/boot/dcae2_install.sh b/boot/dcae2_install.sh index b59f06f2..3446b6c2 100755 --- a/boot/dcae2_install.sh +++ b/boot/dcae2_install.sh @@ -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 && \ diff --git a/boot/dcae2_vm_init.sh b/boot/dcae2_vm_init.sh index 581c0bf1..ac6713d0 100755 --- a/boot/dcae2_vm_init.sh +++ b/boot/dcae2_vm_init.sh @@ -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