aboutsummaryrefslogtreecommitdiffstats
path: root/heat/ONAP/cloud-config/portal_vm_init.sh
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2018-08-03 07:56:14 -0700
committerGary Wu <gary.i.wu@huawei.com>2018-08-06 08:20:47 -0700
commitb9a2a29a9e1e93cd04bfa46f9ed66a2117ef56e5 (patch)
treebcf2b80a434326360f3ce1ec0d64110d5b09e1e8 /heat/ONAP/cloud-config/portal_vm_init.sh
parent16509432a21feb3f90bbf954ec4815c2bf7f0033 (diff)
Refactor ONAP HEAT template config, part 2
Change-Id: Ic4930654395ec9e9d57836733cd47e7a3b0bf972 Issue-ID: INT-605 Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'heat/ONAP/cloud-config/portal_vm_init.sh')
-rw-r--r--heat/ONAP/cloud-config/portal_vm_init.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/heat/ONAP/cloud-config/portal_vm_init.sh b/heat/ONAP/cloud-config/portal_vm_init.sh
new file mode 100644
index 00000000..17640058
--- /dev/null
+++ b/heat/ONAP/cloud-config/portal_vm_init.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# Starts docker containers for ONAP Portal in Rackspace.
+# Version for Amsterdam/R1 uses docker-compose.
+
+# be verbose
+set -x
+
+# Establish environment variables
+NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
+NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
+NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
+DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt)
+# Use "latest" to deploy snapshot images:
+# DOCKER_IMAGE_VERSION=latest
+CLI_DOCKER_VERSION=$(cat /opt/config/cli_docker_version.txt)
+CDR_IMAGE_VERSION=latest
+ZK_IMAGE_VERSION=3.4
+
+# Refresh configuration and scripts
+cd /opt/portal
+git pull
+cd deliveries
+
+# Get image names used below from docker-compose environment file
+source .env
+
+# Refresh images
+docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
+docker pull $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION
+docker pull $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION
+docker pull $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION
+docker pull $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION
+docker pull $ZK_IMG_NAME:$ZK_IMAGE_VERSION
+docker pull $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION
+docker pull $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION
+
+# Tag them as expected by docker-compose file
+docker tag $NEXUS_DOCKER_REPO/$DB_IMG_NAME:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG
+docker tag $NEXUS_DOCKER_REPO/$EP_IMG_NAME:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG
+docker tag $NEXUS_DOCKER_REPO/$SDK_IMG_NAME:$DOCKER_IMAGE_VERSION $SDK_IMG_NAME:$PORTAL_TAG
+docker tag $NEXUS_DOCKER_REPO/$CDR_IMG_NAME:$CDR_IMAGE_VERSION $CDR_IMG_NAME:$PORTAL_TAG
+docker tag $ZK_IMG_NAME:$ZK_IMAGE_VERSION $ZK_IMG_NAME:$PORTAL_TAG
+docker tag $NEXUS_DOCKER_REPO/$WMS_IMG_NAME:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG
+docker tag $NEXUS_DOCKER_REPO/$CLI_IMG_NAME:$CLI_DOCKER_VERSION $CLI_IMG_NAME:$PORTAL_TAG
+
+# Export variable for local logs directory, and create directory too
+# The leading "./" is required for docker-compose
+export LOGS_DIR=./logs
+mkdir -p $LOGS_DIR
+
+# Export variable for subdirectory with appropriate property files
+# The leading "./" is required for docker-compose
+export PROPS_DIR=./properties_simpledemo
+
+# docker-compose is not in /usr/bin
+/opt/docker/docker-compose down
+/opt/docker/docker-compose up -d \ No newline at end of file