blob: cafc040cd809216498a98c460fb7aca459a84463 [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/vvp/start_vvp_containers.sh"
Gary Wu9abb61c2018-09-27 10:38:50 -070026
27export IP=$HOST_IP
28export PREFIX='nexus3.onap.org:10001/openecomp/vvp'
29export RELEASE='latest'
30
31#start Engagement Manager pod:
32docker 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}
47
48docker cp /opt/configmaps/settings/uwsgi.ini vvp-engagementmgr:/srv/vvp/settings/
49
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
61#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
73TIME_OUT=600
74INTERVAL=5
75TIME=0
76while [ "$TIME" -lt "$TIME_OUT" ]; do
77 response=$(curl --write-out '%{http_code}' --silent --output /dev/null http://localhost:9090/vvp/v1/engmgr/vendors); echo $response
78
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...
91else
92 echo "Done starting vvp containers!"
93fi