blob: 8da834051b74d38487fb6295e1258d4024d104d7 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/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
Gary Wu13111e92018-09-27 11:31:33 -070025echo "This is ${WORKSPACE}/scripts/clamp/start_clamp_containers.sh"
Gary Wu9abb61c2018-09-27 10:38:50 -070026
27# start Clamp and MariaDB containers with docker compose and configuration from clamp/extra/docker/clamp/docker-compose.yml
28docker-compose up -d
29
30# WAIT 5 minutes maximum and test every 5 seconds if Clamp up using HealthCheck API
31TIME_OUT=600
32INTERVAL=5
33TIME=0
34while [ "$TIME" -lt "$TIME_OUT" ]; do
35 response=$(curl --write-out '%{http_code}' --silent --output /dev/null -vk --key config/org.onap.clamp.keyfile https://localhost:8443/restservices/clds/v1/healthcheck); echo $response
36
37 if [ "$response" == "200" ]; then
38 echo Clamp and its database well started in $TIME seconds
39 break;
40 fi
41
42 echo Sleep: $INTERVAL seconds before testing if Clamp is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
43 sleep $INTERVAL
44 TIME=$(($TIME+$INTERVAL))
45done
46
47if [ "$TIME" -ge "$TIME_OUT" ]; then
48 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests...
49 exit 1;
50fi
51
eh552t08dc6ff2019-03-12 10:51:43 +010052sleep 30
Gary Wu9abb61c2018-09-27 10:38:50 -070053