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