blob: 5f905b6ad9000e8c22df14d9a01ffb8ccbb5ee9e [file] [log] [blame]
Almog Laktivif0f635f2017-11-16 12:58:43 +02001#!/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/vvp/start_vvp_containers.sh"
26
27export IP=$HOST_IP
28export PREFIX='nexus3.onap.org:10001/openecomp/vvp'
29export RELEASE='latest'
30
31#start Engagement Manager pod:
Almog Laktivi9480f8a2017-11-23 14:09:16 +020032docker run \
33--detach \
34--entrypoint="" \
35--name vvp-engagementmgr \
36--env-file ${WORKSPACE}/data/environments/vvp_env.list \
37--log-driver=json-file \
38--log-opt max-size=100m \
39--log-opt max-file=10 \
40--ulimit memlock=-1:-1 \
41--memory 4g \
42--memory-swap=4g \
43--ulimit nofile=4096:100000 \
44--volume /etc/localtime:/etc/localtime:ro \
45--volume /opt/configmaps/settings:/opt/configmaps/settings/ \
46--publish 9090:80 ${PREFIX}/engagementmgr:${RELEASE}
Almog Laktivif0f635f2017-11-16 12:58:43 +020047
Almog Laktivi9480f8a2017-11-23 14:09:16 +020048docker cp /opt/configmaps/settings/uwsgi.ini vvp-engagementmgr:/srv/vvp/settings/
Almog Laktivif0f635f2017-11-16 12:58:43 +020049
50echo "please wait while Engagement Manager is starting..."
51echo ""
52c=60 # seconds to wait
53REWRITE="\e[25D\e[1A\e[K"
54while [ $c -gt 0 ]; do
55 c=$((c-1))
56 sleep 1
57 echo -e "${REWRITE}$c"
58done
59echo -e ""
60
Almog Laktivi9480f8a2017-11-23 14:09:16 +020061#run migration again:
62docker exec -d vvp-engagementmgr sh -c "python3 /srv/manage.py migrate"
63
64#run initial populate db again:
65docker exec -d vvp-engagementmgr sh -c "python3 /srv/manage.py initial_populate_db"
66
67
68echo "Will copy the generated DB sqlite3 file into the application directory in 30 seconds..."
69sleep 30
70#copy the generated DB sqlite3 file into the application directory:
71docker exec -d vvp-engagementmgr sh -c "cp emdb.db /srv/emdb.db -f"
72
Almog Laktivif0f635f2017-11-16 12:58:43 +020073TIME_OUT=600
74INTERVAL=5
75TIME=0
76while [ "$TIME" -lt "$TIME_OUT" ]; do
Almog Laktivi9480f8a2017-11-23 14:09:16 +020077 response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:9090/vvp/v1/engmgr/vendors); echo $response
Almog Laktivif0f635f2017-11-16 12:58:43 +020078
79 if [ "$response" == "200" ]; then
80 echo VVP-Engagement-Manager well started in $TIME seconds
81 break;
82 fi
83
84 echo Sleep: $INTERVAL seconds before testing if VVP-Engagement-Manager is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
85 sleep $INTERVAL
86 TIME=$(($TIME+$INTERVAL))
87done
88
89if [ "$TIME" -ge "$TIME_OUT" ]; then
90 echo TIME OUT: Docker containers not started in $TIME_OUT seconds... Could cause problems for tests...
Almog Laktivi9480f8a2017-11-23 14:09:16 +020091else
92 echo "Done starting vvp containers!"
93fi