summaryrefslogtreecommitdiffstats
path: root/boot/dcae2_vm_init.sh
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2017-10-20 18:22:38 -0400
committerLusheng Ji <lji@research.att.com>2017-10-22 20:18:59 -0400
commit8ddf3e163f1931907e20addb60a4c9af21e5e9c5 (patch)
treebf20e522d6fbc4f2d7b8e77e90d698755b03f66f /boot/dcae2_vm_init.sh
parentfa50c94f97973ef513d64c5352006f24f7229cfb (diff)
Add proxying healthcheck to consul etc
Changes are for: 1. Proxying healthcheck API call to Consul's health API using a Nginx container proxy. Also some code cleanup. 2. Add support for posting floating addresses to Designate DNS 3. Add addition parameters in heat for supporting spinning up DCAE in a separate OS/tenant (due to lack of Designate support in main Integration OS/tenant) Issue-Id: DCAEGEN2-127 Change-Id: Iac66eddbdd1dfadfc92bf2a1e372c6ad55bd0ab1 Signed-off-by: Lusheng Ji <lji@research.att.com>
Diffstat (limited to 'boot/dcae2_vm_init.sh')
-rw-r--r--boot/dcae2_vm_init.sh30
1 files changed, 27 insertions, 3 deletions
diff --git a/boot/dcae2_vm_init.sh b/boot/dcae2_vm_init.sh
index e27ba589..129a6d82 100644
--- a/boot/dcae2_vm_init.sh
+++ b/boot/dcae2_vm_init.sh
@@ -6,7 +6,31 @@ NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
DOCKER_VERSION=$(cat /opt/config/docker_version.txt)
ZONE=$(cat /opt/config/dcae_zone.txt)
-docker login -u $NEXUS_USER -p $NEXUS_PASSWORD $NEXUS_DOCKER_REPO
-docker pull $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
+
+rm -f /opt/config/runtime.ip.consul
+rm -f /opt/config/runtime.ip.cm
+
+
+docker login -u "$NEXUS_USER" -p "$NEXUS_PASSWORD" "$NEXUS_DOCKER_REPO"
+docker pull "$NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION"
#docker run -v /opt/config/priv_key:/opt/app/installer/config/key -v /opt/app/inputs.yaml:/opt/app/installer/config/inputs.yaml -e "LOCATION=$ZONE" $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
-docker run -d --name boot -v /opt/app/config:/opt/app/installer/config -e "LOCATION=$ZONE" $NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION
+docker run -d --name boot -v /opt/app/config:/opt/app/installer/config -e "LOCATION=$ZONE" "$NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION"
+
+
+# waiting for bootstrap to complete then starting nginx for proxying healthcheck calls
+while [ ! -f /opt/config/runtime.ip.consul ]; do sleep 30; done
+
+# start proxy for consul's health check
+CONSULIP=$(head -1 /opt/config/runtime.ip.consul | sed 's/[[:space:]]//g')
+echo "Consul is available at $CONSULIP"
+
+cat >./nginx.conf <<EOL
+server {
+ listen 80;
+ server_name dcae.simpledemo.onap.org;
+ location /healthcheck {
+ proxy_pass http://"${CONSULIP}":8500/v1/health/state/passing;
+ }
+}
+EOL
+sudo docker run --name dcae-proxy -p 80:80 -v "$(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf" -d nginx