Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame^] | 20 | echo "Uninstall docker-py and reinstall docker." |
| 21 | pip uninstall -y docker-py |
| 22 | pip uninstall -y docker |
| 23 | pip install -U docker==2.7.0 |
| 24 | |
| 25 | # the directory of the script |
| 26 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 27 | echo ${DIR} |
| 28 | |
| 29 | # the temp directory used, within $DIR |
| 30 | # omit the -p parameter to create a temporal directory in the default location |
| 31 | WORK_DIR=`mktemp -d -p "$DIR"` |
| 32 | echo ${WORK_DIR} |
| 33 | |
| 34 | cd ${WORK_DIR} |
| 35 | |
| 36 | # check if tmp dir was created |
| 37 | if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then |
| 38 | echo "Could not create temp dir" |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | # bring down maven |
| 43 | mkdir maven |
| 44 | cd maven |
| 45 | curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz |
| 46 | tar -xzvf apache-maven-3.3.9-bin.tar.gz |
| 47 | ls -l |
| 48 | export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin |
| 49 | ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v |
| 50 | cd .. |
| 51 | |
| 52 | git clone http://gerrit.onap.org/r/oparent |
| 53 | git clone --depth 1 https://gerrit.onap.org/r/policy/models -b master |
| 54 | cd models/models-sim/models-sim-dmaap |
| 55 | ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn clean install -DskipTests --settings ${WORK_DIR}/oparent/settings.xml |
| 56 | bash ./src/main/package/docker/docker_build.sh |
| 57 | cd ${WORKSPACE} |
| 58 | rm -rf ${WORK_DIR} |
| 59 | sleep 3 |
| 60 | |
| 61 | # Adding this waiting container due to race condition between pap and mariadb |
| 62 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies |
| 63 | docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml up -d |
| 64 | |
| 65 | unset http_proxy https_proxy |
| 66 | |
| 67 | POLICY_API_IP=`get-instance-ip.sh policy-api` |
| 68 | MARIADB_IP=`get-instance-ip.sh mariadb` |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 69 | POLICY_PDPX_IP=`get-instance-ip.sh policy-xacml-pdp` |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame^] | 70 | DMAAP_IP=`get-instance-ip.sh dmaap-simulator` |
| 71 | POLICY_PAP_IP=`get-instance-ip.sh policy-pap` |
| 72 | |
| 73 | |
| 74 | echo PDP IP IS ${POLICY_PDPX_IP} |
| 75 | echo API IP IS ${POLICY_API_IP} |
| 76 | echo PAP IP IS ${POLICY_PAP_IP} |
| 77 | echo MARIADB IP IS ${MARIADB_IP} |
| 78 | echo DMAAP_IP IS ${DMAAP_IP} |
| 79 | |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 80 | # Wait for initialization |
| 81 | for i in {1..10}; do |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame^] | 82 | curl -sS ${MARIADB_IP}:3306 && break |
| 83 | echo sleep $i |
| 84 | sleep $i |
| 85 | done |
| 86 | for i in {1..10}; do |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 87 | curl -sS ${POLICY_PDPX_IP}:6969 && break |
| 88 | echo sleep $i |
| 89 | sleep $i |
| 90 | done |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame^] | 91 | for i in {1..10}; do |
| 92 | curl -sS ${DMAAP_IP}:3904 && break |
| 93 | echo sleep $i |
| 94 | sleep $i |
| 95 | done |
Michael Mokry | 88f4d47 | 2019-03-04 12:00:05 -0600 | [diff] [blame] | 96 | |
Michael Mokry | b4f6962 | 2019-05-13 13:09:17 -0500 | [diff] [blame^] | 97 | #Configure the database |
| 98 | docker exec -it mariadb chmod +x /docker-entrypoint-initdb.d/db.sh |
| 99 | docker exec -it mariadb /docker-entrypoint-initdb.d/db.sh |
| 100 | |
| 101 | ROBOT_VARIABLES="-v POLICY_PDPX_IP:${POLICY_PDPX_IP} -v POLICY_API_IP:${POLICY_API_IP} -v POLICY_PAP_IP:${POLICY_PAP_IP}" |