kishore | 328996f | 2017-09-08 17:15:42 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # Starts docker containers for ONAP Portal in Rackspace. |
| 3 | # Version for Amsterdam/R1 uses docker-compose. |
| 4 | |
| 5 | # be verbose |
| 6 | set -x |
| 7 | |
| 8 | # Establish environment variables |
| 9 | NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) |
| 10 | NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) |
| 11 | NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) |
| 12 | DOCKER_IMAGE_VERSION=$(cat /opt/config/docker_version.txt) |
| 13 | |
| 14 | # Refresh configuration and scripts |
| 15 | cd /opt/portal |
| 16 | git pull |
| 17 | cd deliveries |
| 18 | |
| 19 | # Get image names used below from docker-compose environment file |
| 20 | source .env |
| 21 | |
| 22 | # Copy property files |
| 23 | ETC=/PROJECT/OpenSource/UbuntuEP/etc |
| 24 | mkdir -p $ETC |
| 25 | cp -r properties_rackspace/* $ETC |
| 26 | |
| 27 | # Refresh images |
| 28 | docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
| 29 | docker pull $NEXUS_DOCKER_REPO/openecomp/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION |
| 30 | docker pull $NEXUS_DOCKER_REPO/openecomp/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION |
| 31 | docker pull $NEXUS_DOCKER_REPO/openecomp/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION |
| 32 | |
| 33 | # Tag them as expected by docker-compose file |
| 34 | docker tag $NEXUS_DOCKER_REPO/openecomp/${DB_IMG_NAME}:$DOCKER_IMAGE_VERSION $DB_IMG_NAME:$PORTAL_TAG |
| 35 | docker tag $NEXUS_DOCKER_REPO/openecomp/${EP_IMG_NAME}:$DOCKER_IMAGE_VERSION $EP_IMG_NAME:$PORTAL_TAG |
| 36 | docker tag $NEXUS_DOCKER_REPO/openecomp/${WMS_IMG_NAME}:$DOCKER_IMAGE_VERSION $WMS_IMG_NAME:$PORTAL_TAG |
| 37 | |
| 38 | # docker-compose is not in /usr/bin |
| 39 | /opt/docker/docker-compose down |
| 40 | /opt/docker/docker-compose up -d |