Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2017 ZTE Corporation. |
| 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 | # Place the scripts in run order: |
| 18 | |
| 19 | # Download and start MySQL |
| 20 | docker pull postgres:9.5 |
| 21 | docker run --name postgres-holmes -p 5432:5432 -e POSTGRES_USER=holmes -e POSTGRES_PASSWORD=holmespwd -d postgres:9.5 |
| 22 | DB_IP=`get-instance-ip.sh postgres-holmes` |
| 23 | echo DB_IP=${DB_IP} |
| 24 | |
| 25 | #login to the onap nexus docker repo |
| 26 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 27 | |
| 28 | # Start MSB |
| 29 | docker run -d -p 8500:8500 --name msb_consul consul:0.9.3 |
| 30 | CONSUL_IP=`get-instance-ip.sh msb_consul` |
| 31 | echo CONSUL_IP=${CONSUL_IP} |
| 32 | docker run -d -p 10081:10081 -e CONSUL_IP=$CONSUL_IP --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery |
| 33 | DISCOVERY_IP=`get-instance-ip.sh msb_discovery` |
| 34 | echo DISCOVERY_IP=${DISCOVERY_IP} |
| 35 | docker run -d -p 80:80 -e CONSUL_IP=$CONSUL_IP -e SDCLIENT_IP=$DISCOVERY_IP --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway |
| 36 | MSB_IP=`get-instance-ip.sh msb_internal_apigateway` |
| 37 | echo MSB_IP=${MSB_IP} |
| 38 | |
| 39 | # Start rulemgt |
| 40 | source ${SCRIPTS}/holmes/rule-management/startup.sh i-rulemgt ${DB_IP} ${MSB_IP} 1 |
| 41 | RULEMGT_IP=`get-instance-ip.sh i-rulemgt` |
| 42 | echo RULEMGT_IP=${RULEMGT_IP} |
| 43 | |
| 44 | # Wait for initialization |
| 45 | for i in {1..20}; do |
| 46 | curl -sS -m 1 ${RULEMGT_IP}:9101 && curl -sS -m 1 ${MSB_IP}:80 && break |
| 47 | echo sleep $i |
| 48 | sleep $i |
| 49 | done |
| 50 | |
| 51 | # Start engine-d |
| 52 | source ${SCRIPTS}/holmes/engine-management/startup.sh i-engine-d ${DB_IP} ${MSB_IP} 1 |
| 53 | ENGINE_D_IP=`get-instance-ip.sh i-engine-d` |
| 54 | echo ENGINE_D_IP=${ENGINE_D_IP} |
| 55 | |
| 56 | |
| 57 | # Wait for initialization |
| 58 | for i in {1..10}; do |
| 59 | curl -sS -m 1 ${ENGINE_D_IP}:9102 && break |
| 60 | echo sleep $i |
| 61 | sleep $i |
| 62 | done |
| 63 | |
| 64 | echo sleep 30s for service registration |
| 65 | sleep 30 |
| 66 | |
| 67 | docker logs i-rulemgt |
| 68 | docker logs i-engine-d |
| 69 | |
| 70 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 71 | ROBOT_VARIABLES="-v MSB_IP:${MSB_IP} -v RULEMGT_IP:${RULEMGT_IP} -v ENGINE_D_IP:${ENGINE_D_IP}" |
| 72 | |