blob: 4ccf561032eb41d6ea0f799d5950e59ce259e7f4 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001#!/bin/bash
2
Yuli Shlosberg0875ce02018-01-25 13:53:36 +02003CS_PASSWORD="onap123#@!"
4SDC_USER="asdc_user"
5SDC_PASSWORD="Aa1234%^!"
Yuli Shlosberg958c32d2018-02-15 12:04:46 +02006JETTY_BASE="/var/lib/jetty"
7BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx2g -Xms2g"
8FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx512m -Xms512m"
9
Michael Lando451a3402017-02-19 10:28:42 +020010
Grinberg Motic3bda482017-02-23 11:24:34 +020011function usage {
Idan Amitdb3d5542017-12-07 11:33:32 +020012 echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -t|--runTests <Run-with-sanityDocker>] [ -h|--help ]"
Michael Lando451a3402017-02-19 10:28:42 +020013}
14
15
Grinberg Motic3bda482017-02-23 11:24:34 +020016function cleanup {
Idan Amitdb3d5542017-12-07 11:33:32 +020017 echo "performing old dockers cleanup"
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020018
19 if [ "$1" == "all" ] ; then
20 docker_ids=`docker ps -a | egrep -v "openecomp/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'`
21 for X in ${docker_ids}
22 do
23 docker rm -f ${X}
24 done
25 else
26 echo "performing $1 docker cleanup"
27 tmp=`docker ps -a -q --filter="name=$1"`
Yuli Shlosberg22651a42018-02-22 15:34:36 +020028 if [[ ! -z "$tmp" ]]; then
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020029 docker rm -f ${tmp}
30 fi
31 fi
Grinberg Motic3bda482017-02-23 11:24:34 +020032}
33
34
35function dir_perms {
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +020036 mkdir -p ${WORKSPACE}/data/logs/BE/SDC/SDC-BE
37 mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE
Yuli Shlosbergb4deec12018-02-25 20:24:44 +020038 mkdir -p ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport
39 mkdir -p ${WORKSPACE}/data/logs/sdc-sanity/target
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +020040 chmod -R 777 ${WORKSPACE}/data/logs
Grinberg Motic3bda482017-02-23 11:24:34 +020041}
Yuli Shlosberg36604c72018-02-25 16:03:45 +020042
Yuli Shlosbergb4deec12018-02-25 20:24:44 +020043function docker_logs {
44
45docker logs $1 > ${WORKSPACE}/data/logs/$1_docker.log
46
47}
48
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020049function probe_cs {
Grinberg Motic3bda482017-02-23 11:24:34 +020050
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020051cs_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020052docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020053rc=$?
54if [[ $rc == 0 ]]; then
55 echo DOCKER start finished in $2 seconds
56 cs_stat=true
57fi
58
59}
60
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020061function probe_be {
62
63be_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020064docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020065rc=$?
66if [[ $rc == 200 ]]; then
67 echo DOCKER start finished in $2 seconds
68 be_stat=true
69fi
70
71}
72
73function probe_fe {
74
75fe_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020076docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020077rc=$?
78if [[ $rc == 200 ]]; then
79 echo DOCKER start finished in $2 seconds
80 fe_stat=true
81fi
82
83}
84
85function probe_es {
86
87es_stat=false
Yuli Shlosberg22651a42018-02-22 15:34:36 +020088health_Check_http_code=$(curl -o /dev/null -w '%{http_code}' http://${IP}:9200/_cluster/health?wait_for_status=yellow&timeout=120s)
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020089if [[ "$health_Check_http_code" -eq 200 ]]
90 then
91 echo DOCKER start finished in $2 seconds
92 es_stat=true
93 fi
94
95}
96
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020097function probe_docker {
98
99match_result=false
100MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"`
101echo MATCH is -- $MATCH
102
103if [ -n "$MATCH" ]; then
104 echo DOCKER start finished in $2 seconds
105 match_result=true
106fi
107}
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300108function monitor_docker {
109
Idan Amitdb3d5542017-12-07 11:33:32 +0200110 echo monitor $1 Docker
111 sleep 5
112 TIME_OUT=900
113 INTERVAL=20
114 TIME=0
115 while [ "$TIME" -lt "$TIME_OUT" ]; do
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200116 if [ "$1" == "sdc-cs" ]; then
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200117 probe_cs $1 $TIME
118 if [[ $cs_stat == true ]]; then break; fi
119 elif [ "$1" == "sdc-es" ]; then
120 probe_es $1 $TIME
121 if [[ $es_stat == true ]]; then break; fi
122 elif [ "$1" == "sdc-BE" ]; then
123 probe_be $1 $TIME
124 if [[ $be_stat == true ]]; then break; fi
125 elif [ "$1" == "sdc-FE" ]; then
126 probe_fe $1 $TIME
127 if [[ $fe_stat == true ]]; then break; fi
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200128 else
129 probe_docker $1 $TIME
130 if [[ $match_result == true ]]; then break; fi
Idan Amitdb3d5542017-12-07 11:33:32 +0200131 fi
Idan Amitdb3d5542017-12-07 11:33:32 +0200132 echo Sleep: $INTERVAL seconds before testing if $1 DOCKER is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
133 sleep $INTERVAL
134 TIME=$(($TIME+$INTERVAL))
135 done
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300136
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200137 docker_logs $1
Yuli Shlosberg36604c72018-02-25 16:03:45 +0200138
Idan Amitdb3d5542017-12-07 11:33:32 +0200139 if [ "$TIME" -ge "$TIME_OUT" ]; then
140 echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m"
141 fi
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300142
143}
144
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200145function healthCheck {
Yuli Shlosberg22651a42018-02-22 15:34:36 +0200146 curl ${IP}:9200/_cluster/health?pretty=true
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200147
148 echo "BE health-Check:"
Yuli Shlosberg22651a42018-02-22 15:34:36 +0200149 curl http://${IP}:8080/sdc2/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200150
151 echo ""
152 echo ""
153 echo "FE health-Check:"
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200154 curl http://${IP}:8181/sdc1/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200155
156
157 echo ""
158 echo ""
Yuli Shlosberg22651a42018-02-22 15:34:36 +0200159 healthCheck_http_code=$(curl -o /dev/null -w '%{http_code}' -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" http://${IP}:8080/sdc2/rest/v1/user/demo;)
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200160 if [[ ${healthCheck_http_code} != 200 ]]
161 then
162 echo "Error [${healthCheck_http_code}] while user existance check"
163 return ${healthCheck_http_code}
164 fi
165 echo "check user existance: OK"
166 return ${healthCheck_http_code}
167}
168
Grinberg Moti97246212017-02-21 19:30:31 +0200169RELEASE=latest
Idan Amitc7f57ec2017-08-31 14:26:21 +0300170LOCAL=false
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200171RUNTESTS=false
Tal Gitelman8e5fc512017-10-23 13:49:06 +0300172DEBUG_PORT="--publish 4000:4000"
Tal Gitelmane224d0b2017-10-17 15:24:25 +0300173
Idan Amitdb3d5542017-12-07 11:33:32 +0200174while [ $# -gt 0 ]; do
Michael Lando451a3402017-02-19 10:28:42 +0200175 case $1 in
Idan Amitdb3d5542017-12-07 11:33:32 +0200176 # -r | --release - The specific docker version to pull and deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200177 -r | --release )
178 shift 1 ;
179 RELEASE=$1;
180 shift 1;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200181 # -e | --environment - The environment name you want to deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200182 -e | --environment )
183 shift 1;
184 DEP_ENV=$1;
185 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200186 # -p | --port - The port from which to connect to the docker nexus
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200187 -p | --port )
188 shift 1 ;
189 PORT=$1;
190 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200191 # -l | --local - Use this for deploying your local dockers without pulling them first
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200192 -l | --local )
193 LOCAL=true;
194 shift 1;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200195 # -t | --runTests - Use this for running the sanity tests docker after all other dockers have been deployed
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200196 -t | --runTests )
197 RUNTESTS=true;
198 shift 1 ;;
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200199 # -d | --docker - The init specified docker
200 -d | --docker )
201 shift 1 ;
202 DOCKER=$1;
203 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200204 # -h | --help - Display the help message with all the available run options
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200205 -h | --help )
206 usage;
207 exit 0;;
208 * )
209 usage;
210 exit 1;;
Michael Lando451a3402017-02-19 10:28:42 +0200211 esac
Michael Lando451a3402017-02-19 10:28:42 +0200212done
213
Yuli Shlosberg3301bec2017-11-08 15:31:27 +0200214
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200215[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || echo ${DEP_ENV}
Yuli Shlosberg316bb252017-11-14 11:47:17 +0200216[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release
217[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
218[ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT}
Michael Lando451a3402017-02-19 10:28:42 +0200219[ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
220
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200221export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
Idan Amitdb3d5542017-12-07 11:33:32 +0200222export PREFIX=${NEXUS_DOCKER_REPO}'/onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300223
224if [ ${LOCAL} = true ]; then
Idan Amitdb3d5542017-12-07 11:33:32 +0200225 PREFIX='onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300226fi
Michael Lando451a3402017-02-19 10:28:42 +0200227
228echo ""
229
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200230
231
232function sdc-es {
233
Michael Lando451a3402017-02-19 10:28:42 +0200234# Elastic-Search
235echo "docker run sdc-elasticsearch..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300236if [ ${LOCAL} = false ]; then
237 echo "pulling code"
238 docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE}
239fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200240docker run -dit --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --env ES_JAVA_OPTS="-Xms512m -Xmx512m" --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --env ES_HEAP_SIZE=1024M --volume ${WORKSPACE}/data/ES:/usr/share/elasticsearch/data --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9200:9200 --publish 9300:9300 ${PREFIX}/sdc-elasticsearch:${RELEASE} /bin/sh
Tal Gitelmanf1927592018-01-29 17:24:56 +0200241
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200242echo "please wait while ES is starting..."
243monitor_docker sdc-es
244}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200245
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200246function sdc-init-es {
Tal Gitelman38211c82018-01-24 17:59:53 +0200247# Init-Elastic-Search
248echo "docker run sdc-init-elasticsearch..."
249if [ ${LOCAL} = false ]; then
250 echo "pulling code"
251 docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
252fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200253docker run --name sdc-init-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE} > /dev/null 2>&1
254rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200255docker_logs sdc-init-es
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200256if [[ $rc != 0 ]]; then exit $rc; fi
Tal Gitelmanf1927592018-01-29 17:24:56 +0200257
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200258}
Idan Amitc7f57ec2017-08-31 14:26:21 +0300259
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200260function sdc-cs {
Tal Gitelman38211c82018-01-24 17:59:53 +0200261# Cassandra
Idan Amitc7f57ec2017-08-31 14:26:21 +0300262echo "docker run sdc-cassandra..."
263if [ ${LOCAL} = false ]; then
264 docker pull ${PREFIX}/sdc-cassandra:${RELEASE}
265fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200266docker run -dit --name sdc-cs --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env MAX_HEAP_SIZE="2024M" --env HEAP_NEWSIZE="512M" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200267
Michael Lando451a3402017-02-19 10:28:42 +0200268
269echo "please wait while CS is starting..."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300270monitor_docker sdc-cs
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200271}
Michael Lando451a3402017-02-19 10:28:42 +0200272
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200273function sdc-cs-init {
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200274# cassandra-init
275echo "docker run sdc-cassandra-init..."
276if [ ${LOCAL} = false ]; then
277 docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}
278fi
279docker run --name sdc-cs-init --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1
280rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200281docker_logs sdc-cs-init
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200282if [[ $rc != 0 ]]; then exit $rc; fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200283}
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200284
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200285function sdc-kbn {
Michael Lando451a3402017-02-19 10:28:42 +0200286# kibana
287echo "docker run sdc-kibana..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300288if [ ${LOCAL} = false ]; then
289 docker pull ${PREFIX}/sdc-kibana:${RELEASE}
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200290docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE}
Idan Amitc7f57ec2017-08-31 14:26:21 +0300291fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200292
293}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200294
295
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200296function sdc-BE {
Michael Lando451a3402017-02-19 10:28:42 +0200297
Grinberg Motic3bda482017-02-23 11:24:34 +0200298dir_perms
Michael Lando451a3402017-02-19 10:28:42 +0200299# Back-End
300echo "docker run sdc-backend..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300301if [ ${LOCAL} = false ]; then
302 docker pull ${PREFIX}/sdc-backend:${RELEASE}
Tal Gitelmane224d0b2017-10-17 15:24:25 +0300303else
Tal Gitelman8e5fc512017-10-23 13:49:06 +0300304 ADDITIONAL_ARGUMENTS=${DEBUG_PORT}
Idan Amitc7f57ec2017-08-31 14:26:21 +0300305fi
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200306docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE}
Michael Lando451a3402017-02-19 10:28:42 +0200307
308echo "please wait while BE is starting..."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300309monitor_docker sdc-BE
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200310}
Michael Lando451a3402017-02-19 10:28:42 +0200311
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200312function sdc-BE-init {
Michael Lando451a3402017-02-19 10:28:42 +0200313
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200314dir_perms
315# Back-End-Init
316echo "docker run sdc-backend-init..."
317if [ ${LOCAL} = false ]; then
318 docker pull ${PREFIX}/sdc-backend-init:${RELEASE}
319fi
320docker run --name sdc-BE-init --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1
321rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200322docker_logs sdc-BE-init
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200323if [[ $rc != 0 ]]; then exit $rc; fi
324}
325
326function sdc-FE {
327dir_perms
Michael Lando451a3402017-02-19 10:28:42 +0200328# Front-End
329echo "docker run sdc-frontend..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300330if [ ${LOCAL} = false ]; then
331 docker pull ${PREFIX}/sdc-frontend:${RELEASE}
332fi
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200333docker run --detach --name sdc-FE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${PREFIX}/sdc-frontend:${RELEASE}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200334
335echo "please wait while FE is starting....."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300336monitor_docker sdc-FE
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200337}
Michael Lando451a3402017-02-19 10:28:42 +0200338
ml636r0649e652017-02-20 21:10:54 +0200339
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200340
341function sdc-sanity {
Yuli Shlosberg9dde9262017-09-12 14:11:48 +0300342# sanityDocker
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200343if [[ (${RUNTESTS} = true) && (${healthCheck_http_code} == 200) ]]; then
Idan Amitdb3d5542017-12-07 11:33:32 +0200344 echo "docker run sdc-sanity..."
345 echo "Triger sanity docker, please wait..."
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200346
Yuli Shlosberg9dde9262017-09-12 14:11:48 +0300347 if [ ${LOCAL} = false ]; then
Idan Amitdb3d5542017-12-07 11:33:32 +0200348 docker pull ${PREFIX}/sdc-sanity:${RELEASE}
Yuli Shlosberg9dde9262017-09-12 14:11:48 +0300349 fi
Yuli Shlosberg316bb252017-11-14 11:47:17 +0200350
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200351docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/sdc-sanity/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-sanity/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-sanity/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-sanity:${RELEASE}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200352echo "please wait while SANITY is starting....."
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200353monitor_docker sdc-sanity
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200354
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200355fi
356}
357
358if [ -z "${DOCKER}" ]; then
359 cleanup all
360 sdc-es
361 sdc-init-es
362 sdc-cs
363 sdc-cs-init
364 sdc-kbn
365 sdc-BE
366 sdc-BE-init
367 sdc-FE
Yuli Shlosberge07a5162018-02-26 10:11:10 +0200368 healthCheck
Yuli Shlosberg523a3d12018-02-25 21:10:07 +0200369 sdc-sanity
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200370else
371 cleanup ${DOCKER}
372 ${DOCKER}
Yuli Shlosberge07a5162018-02-26 10:11:10 +0200373 healthCheck
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200374fi
375