blob: 341fd48136fa01bd2a0dfbadbc6fb2d0d87d078a [file] [log] [blame]
Yuli Shlosberge1209702017-09-24 17:43:28 +03001#!/bin/bash
2#
3# ============LICENSE_START=======================================================
4# ONAP CLAMP
5# ================================================================================
6# Copyright (C) 2017 AT&T Intellectual Property. All rights
7# reserved.
8# ================================================================================
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20# ============LICENSE_END============================================
21# ===================================================================
22# ECOMP is a trademark and service mark of AT&T Intellectual Property.
23#
24
25echo "This is ${WORKSPACE}/test/csit/scripts/vid/start_vid_containers.sh"
26
27
Sonsino, Ofir (os0695)57c02a62018-08-06 16:47:32 +030028RELEASE=vid:latest
Yuli Shlosberge1209702017-09-24 17:43:28 +030029CONFIG_PATH=${WORKSPACE}/data/clone/vid/lf_config
30
31export IP=`ifconfig eth0 | awk -F: '/inet addr/ {gsub(/ .*/,"",$2); print $2}'`
Sonsino, Ofir (os0695)57c02a62018-08-06 16:47:32 +030032export PREFIX='nexus3.onap.org:10001/onap'
Yuli Shlosberge1209702017-09-24 17:43:28 +030033
34#start Maria-DB
Sonsino, Ofir (os0695)63b55222018-08-29 15:22:24 +030035docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp_epsdk -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v ${CONFIG_PATH}/vid-my.cnf:/etc/mysql/my.cnf -v ${CONFIG_PATH}/vid-schema.sql:/docker-entrypoint-initdb.d/vid-schema.sql -v /var/lib/mysql -d mariadb:10
Yuli Shlosberge1209702017-09-24 17:43:28 +030036
37#start VID server
38
Sonsino, Ofir (os0695)57c02a62018-08-06 16:47:32 +030039docker run -e VID_MYSQL_DBNAME=vid_openecomp_epsdk -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d nexus3.onap.org:10001/onap/${RELEASE}
Yuli Shlosberge1209702017-09-24 17:43:28 +030040
41# WAIT 5 minutes maximum and test every 5 seconds if VID up using HealthCheck API
42
43TIME_OUT=1200
44INTERVAL=5
45TIME=0
46while [ "$TIME" -lt "$TIME_OUT" ]; do
47 response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:8080/vid/healthCheck); echo $response
48
49 if [ "$response" == "200" ]; then
50 echo VID and its database well started in $TIME seconds
51 break;
52 fi
53
54 echo Sleep: $INTERVAL seconds before testing if VID is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
55 sleep $INTERVAL
56 TIME=$(($TIME+$INTERVAL))
57done
58
59if [ "$TIME" -ge "$TIME_OUT" ]; then
60 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests...
61fi