blob: b7d96d5c6233e62c1818a31f3c4cadd5da2f2df8 [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"
Gitelman, Tal (tg851x)328388b2018-03-22 13:03:44 +02007BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m"
8FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m -Xms256m"
Yuli Shlosbergf59a2252018-03-21 11:14:08 +02009SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m"
10API_TESTS_JAVA_OPTIONS="-Xmx512m -Xms512m"
11UI_TESTS_JAVA_OPTIONS="-Xmx1024m -Xms1024m"
Michael Lando451a3402017-02-19 10:28:42 +020012
Grinberg Motic3bda482017-02-23 11:24:34 +020013function usage {
Idan Amitdb3d5542017-12-07 11:33:32 +020014 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 +020015}
16
17
Grinberg Motic3bda482017-02-23 11:24:34 +020018function cleanup {
Idan Amitdb3d5542017-12-07 11:33:32 +020019 echo "performing old dockers cleanup"
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020020
21 if [ "$1" == "all" ] ; then
Michael Landoa5445102018-03-04 14:53:33 +020022 docker_ids=`docker ps -a | egrep -v "onap/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit" | awk '{print $1}'`
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020023 for X in ${docker_ids}
24 do
25 docker rm -f ${X}
26 done
27 else
28 echo "performing $1 docker cleanup"
29 tmp=`docker ps -a -q --filter="name=$1"`
Yuli Shlosberg474996a2018-02-27 18:55:25 +020030 if [[ ! -z "$tmp" ]]; then
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020031 docker rm -f ${tmp}
32 fi
33 fi
Grinberg Motic3bda482017-02-23 11:24:34 +020034}
35
36
37function dir_perms {
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +020038 mkdir -p ${WORKSPACE}/data/logs/BE/SDC/SDC-BE
39 mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE
Yuli Shlosbergf59a2252018-03-21 11:14:08 +020040 mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport
41 mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/target
42 mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport
43 mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/target
Yuli Shlosberg23cc7f52018-02-28 13:19:42 +020044 mkdir -p ${WORKSPACE}/data/logs/docker_logs
Yuli Shlosberge2eef602018-04-10 23:05:13 +030045 mkdir -p ${WORKSPACE}/data/logs/WS
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +020046 chmod -R 777 ${WORKSPACE}/data/logs
Grinberg Motic3bda482017-02-23 11:24:34 +020047}
Yuli Shlosberg36604c72018-02-25 16:03:45 +020048
Yuli Shlosbergb4deec12018-02-25 20:24:44 +020049function docker_logs {
50
Yuli Shlosberg23cc7f52018-02-28 13:19:42 +020051docker logs $1 > ${WORKSPACE}/data/logs/docker_logs/$1_docker.log
Yuli Shlosbergb4deec12018-02-25 20:24:44 +020052
53}
54
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020055function probe_cs {
Grinberg Motic3bda482017-02-23 11:24:34 +020056
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020057cs_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020058docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020059rc=$?
60if [[ $rc == 0 ]]; then
61 echo DOCKER start finished in $2 seconds
62 cs_stat=true
63fi
64
65}
66
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020067function probe_be {
68
69be_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020070docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020071rc=$?
72if [[ $rc == 200 ]]; then
73 echo DOCKER start finished in $2 seconds
74 be_stat=true
75fi
76
77}
78
79function probe_fe {
80
81fe_stat=false
Yuli Shlosberg5d0f58e2018-02-26 14:18:08 +020082docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020083rc=$?
84if [[ $rc == 200 ]]; then
85 echo DOCKER start finished in $2 seconds
86 fe_stat=true
87fi
88
89}
90
91function probe_es {
92
93es_stat=false
Yuli Shlosberg474996a2018-02-27 18:55:25 +020094health_Check_http_code=$(curl --noproxy "*" -o /dev/null -w '%{http_code}' http://${IP}:9200/_cluster/health?wait_for_status=yellow&timeout=120s)
Yuli Shlosberg958c32d2018-02-15 12:04:46 +020095if [[ "$health_Check_http_code" -eq 200 ]]
96 then
97 echo DOCKER start finished in $2 seconds
98 es_stat=true
99 fi
100
101}
102
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200103function probe_sim {
104
105if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then
106 echo "running"
107 sim_stat=true
108else
109 echo "not running"
110 sim_stat=false
111fi
112
113
114}
115
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200116function probe_docker {
117
118match_result=false
119MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"`
120echo MATCH is -- $MATCH
121
122if [ -n "$MATCH" ]; then
123 echo DOCKER start finished in $2 seconds
124 match_result=true
125fi
126}
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300127function monitor_docker {
128
Idan Amitdb3d5542017-12-07 11:33:32 +0200129 echo monitor $1 Docker
130 sleep 5
131 TIME_OUT=900
132 INTERVAL=20
133 TIME=0
134 while [ "$TIME" -lt "$TIME_OUT" ]; do
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200135 if [ "$1" == "sdc-cs" ]; then
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200136 probe_cs $1 $TIME
137 if [[ $cs_stat == true ]]; then break; fi
138 elif [ "$1" == "sdc-es" ]; then
139 probe_es $1 $TIME
140 if [[ $es_stat == true ]]; then break; fi
141 elif [ "$1" == "sdc-BE" ]; then
142 probe_be $1 $TIME
143 if [[ $be_stat == true ]]; then break; fi
144 elif [ "$1" == "sdc-FE" ]; then
145 probe_fe $1 $TIME
146 if [[ $fe_stat == true ]]; then break; fi
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200147 else
148 probe_docker $1 $TIME
149 if [[ $match_result == true ]]; then break; fi
Idan Amitdb3d5542017-12-07 11:33:32 +0200150 fi
Idan Amitdb3d5542017-12-07 11:33:32 +0200151 echo Sleep: $INTERVAL seconds before testing if $1 DOCKER is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
152 sleep $INTERVAL
153 TIME=$(($TIME+$INTERVAL))
154 done
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300155
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200156 docker_logs $1
Yuli Shlosberg36604c72018-02-25 16:03:45 +0200157
Idan Amitdb3d5542017-12-07 11:33:32 +0200158 if [ "$TIME" -ge "$TIME_OUT" ]; then
159 echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m"
160 fi
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300161
162}
163
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200164function healthCheck {
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200165 curl --noproxy "*" ${IP}:9200/_cluster/health?pretty=true
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200166
167 echo "BE health-Check:"
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200168 curl --noproxy "*" http://${IP}:8080/sdc2/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200169
170 echo ""
171 echo ""
172 echo "FE health-Check:"
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200173 curl --noproxy "*" http://${IP}:8181/sdc1/rest/healthCheck
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200174
175
176 echo ""
177 echo ""
Yuli Shlosberg474996a2018-02-27 18:55:25 +0200178 healthCheck_http_code=$(curl --noproxy "*" -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 +0200179 if [[ ${healthCheck_http_code} != 200 ]]
180 then
181 echo "Error [${healthCheck_http_code}] while user existance check"
182 return ${healthCheck_http_code}
183 fi
184 echo "check user existance: OK"
185 return ${healthCheck_http_code}
186}
187
Grinberg Moti97246212017-02-21 19:30:31 +0200188RELEASE=latest
Idan Amitc7f57ec2017-08-31 14:26:21 +0300189LOCAL=false
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200190RUNTESTS=false
Tal Gitelman8e5fc512017-10-23 13:49:06 +0300191DEBUG_PORT="--publish 4000:4000"
Tal Gitelmane224d0b2017-10-17 15:24:25 +0300192
Idan Amitdb3d5542017-12-07 11:33:32 +0200193while [ $# -gt 0 ]; do
Michael Lando451a3402017-02-19 10:28:42 +0200194 case $1 in
Idan Amitdb3d5542017-12-07 11:33:32 +0200195 # -r | --release - The specific docker version to pull and deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200196 -r | --release )
197 shift 1 ;
198 RELEASE=$1;
199 shift 1;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200200 # -e | --environment - The environment name you want to deploy
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200201 -e | --environment )
202 shift 1;
203 DEP_ENV=$1;
204 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200205 # -p | --port - The port from which to connect to the docker nexus
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200206 -p | --port )
207 shift 1 ;
208 PORT=$1;
209 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200210 # -l | --local - Use this for deploying your local dockers without pulling them first
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200211 -l | --local )
212 LOCAL=true;
213 shift 1;;
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200214 # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed
215 -ta )
216 shift 1 ;
217 API_SUITE=$1;
218 RUN_API_TESTS=true;
219 shift 1 ;;
220 # -tu - Use this for running the UI sanity docker after all other dockers have been deployed
221 -tu )
222 shift 1 ;
223 UI_SUITE=$1;
224 RUN_UI_TESTS=true;
225 shift 1 ;;
226 # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed
227 -tad | -t )
228 API_SUITE="onapApiSanity";
229 RUN_API_TESTS=true;
230 shift 1 ;;
231 # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed
232 -tud )
233 UI_SUITE="onapUiSanity";
234 RUN_UI_TESTS=true;
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200235 shift 1 ;;
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200236 # -d | --docker - The init specified docker
237 -d | --docker )
238 shift 1 ;
239 DOCKER=$1;
240 shift 1 ;;
Idan Amitdb3d5542017-12-07 11:33:32 +0200241 # -h | --help - Display the help message with all the available run options
Yuli Shlosberg0566f582017-11-26 19:05:23 +0200242 -h | --help )
243 usage;
244 exit 0;;
245 * )
246 usage;
247 exit 1;;
Michael Lando451a3402017-02-19 10:28:42 +0200248 esac
Michael Lando451a3402017-02-19 10:28:42 +0200249done
250
Yuli Shlosberg3301bec2017-11-08 15:31:27 +0200251
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200252[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || echo ${DEP_ENV}
Yuli Shlosberg316bb252017-11-14 11:47:17 +0200253[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release
254[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
255[ -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 +0200256[ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
257
Yuli Shlosbergd1bb2e52018-01-15 11:51:21 +0200258export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'`
Idan Amitdb3d5542017-12-07 11:33:32 +0200259export PREFIX=${NEXUS_DOCKER_REPO}'/onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300260
261if [ ${LOCAL} = true ]; then
Idan Amitdb3d5542017-12-07 11:33:32 +0200262 PREFIX='onap'
Idan Amitc7f57ec2017-08-31 14:26:21 +0300263fi
Michael Lando451a3402017-02-19 10:28:42 +0200264
265echo ""
266
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200267
Michael Landoa5445102018-03-04 14:53:33 +0200268#Elastic-Search
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200269function sdc-es {
Michael Lando451a3402017-02-19 10:28:42 +0200270echo "docker run sdc-elasticsearch..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300271if [ ${LOCAL} = false ]; then
272 echo "pulling code"
273 docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE}
274fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200275docker 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 +0200276
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200277echo "please wait while ES is starting..."
278monitor_docker sdc-es
279}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200280
Michael Landoa5445102018-03-04 14:53:33 +0200281
282#Init-Elastic-Search
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200283function sdc-init-es {
Tal Gitelman38211c82018-01-24 17:59:53 +0200284echo "docker run sdc-init-elasticsearch..."
285if [ ${LOCAL} = false ]; then
286 echo "pulling code"
287 docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
288fi
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200289echo "Running sdc-init-es"
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200290docker 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
291rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200292docker_logs sdc-init-es
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200293if [[ $rc != 0 ]]; then exit $rc; fi
Tal Gitelmanf1927592018-01-29 17:24:56 +0200294
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200295}
Idan Amitc7f57ec2017-08-31 14:26:21 +0300296
Michael Landoa5445102018-03-04 14:53:33 +0200297#Cassandra
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200298function sdc-cs {
Idan Amitc7f57ec2017-08-31 14:26:21 +0300299echo "docker run sdc-cassandra..."
300if [ ${LOCAL} = false ]; then
301 docker pull ${PREFIX}/sdc-cassandra:${RELEASE}
302fi
Gitelman, Tal (tg851x)328388b2018-03-22 13:03:44 +0200303docker 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="1536M" --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 +0200304
Michael Lando451a3402017-02-19 10:28:42 +0200305
306echo "please wait while CS is starting..."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300307monitor_docker sdc-cs
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200308}
Michael Lando451a3402017-02-19 10:28:42 +0200309
Michael Landoa5445102018-03-04 14:53:33 +0200310#Cassandra-init
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200311function sdc-cs-init {
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200312echo "docker run sdc-cassandra-init..."
313if [ ${LOCAL} = false ]; then
314 docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}
315fi
316docker 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
317rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200318docker_logs sdc-cs-init
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200319if [[ $rc != 0 ]]; then exit $rc; fi
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200320}
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200321
Michael Landoa5445102018-03-04 14:53:33 +0200322#Kibana
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200323function sdc-kbn {
Michael Lando451a3402017-02-19 10:28:42 +0200324echo "docker run sdc-kibana..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300325if [ ${LOCAL} = false ]; then
326 docker pull ${PREFIX}/sdc-kibana:${RELEASE}
Gitelman, Tal (tg851x)6a1b82a2018-03-21 17:42:47 +0200327docker run --detach --name sdc-kbn --env ENVNAME="${DEP_ENV}" --env NODE_OPTIONS="--max-old-space-size=200" --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 +0300328fi
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200329
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200330}
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200331
Michael Landoa5445102018-03-04 14:53:33 +0200332#Back-End
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200333function sdc-BE {
Michael Lando451a3402017-02-19 10:28:42 +0200334echo "docker run sdc-backend..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300335if [ ${LOCAL} = false ]; then
336 docker pull ${PREFIX}/sdc-backend:${RELEASE}
Tal Gitelmane224d0b2017-10-17 15:24:25 +0300337else
Tal Gitelman8e5fc512017-10-23 13:49:06 +0300338 ADDITIONAL_ARGUMENTS=${DEBUG_PORT}
Idan Amitc7f57ec2017-08-31 14:26:21 +0300339fi
Areli, Fuss (af732p)9d525f52018-04-09 18:15:42 +0300340docker run --detach --name sdc-BE --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --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 +0200341
342echo "please wait while BE is starting..."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300343monitor_docker sdc-BE
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200344}
Michael Lando451a3402017-02-19 10:28:42 +0200345
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200346# Back-End-Init
Michael Landoa5445102018-03-04 14:53:33 +0200347function sdc-BE-init {
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200348echo "docker run sdc-backend-init..."
349if [ ${LOCAL} = false ]; then
350 docker pull ${PREFIX}/sdc-backend-init:${RELEASE}
351fi
352docker 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
353rc=$?
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200354docker_logs sdc-BE-init
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200355if [[ $rc != 0 ]]; then exit $rc; fi
356}
357
Michael Landoa5445102018-03-04 14:53:33 +0200358
359# Front-End
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200360function sdc-FE {
Michael Lando451a3402017-02-19 10:28:42 +0200361echo "docker run sdc-frontend..."
Idan Amitc7f57ec2017-08-31 14:26:21 +0300362if [ ${LOCAL} = false ]; then
363 docker pull ${PREFIX}/sdc-frontend:${RELEASE}
364fi
Yuli Shlosbergb4deec12018-02-25 20:24:44 +0200365docker 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 +0200366
367echo "please wait while FE is starting....."
Yuli Shlosberg5571a862017-10-03 18:18:51 +0300368monitor_docker sdc-FE
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200369}
Michael Lando451a3402017-02-19 10:28:42 +0200370
ml636r0649e652017-02-20 21:10:54 +0200371
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200372# apis-sanity
373function sdc-api-tests {
374healthCheck
375if [[ (${RUN_API_TESTS} = true) && (${healthCheck_http_code} == 200) ]]; then
376 echo "docker run sdc-api-tests..."
377 echo "Triger sdc-api-tests docker, please wait..."
Yuli Shlosberg0875ce02018-01-25 13:53:36 +0200378
Yuli Shlosberg9dde9262017-09-12 14:11:48 +0300379 if [ ${LOCAL} = false ]; then
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200380 docker pull ${PREFIX}/sdc-api-tests:${RELEASE}
Yuli Shlosberg9dde9262017-09-12 14:11:48 +0300381 fi
Yuli Shlosberg316bb252017-11-14 11:47:17 +0200382
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200383docker run --detach --name sdc-api-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${API_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${API_SUITE} --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-api-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/logs/sdc-api-tests/outputCsar:/var/lib/tests/outputCsar --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9560:9560 ${PREFIX}/sdc-api-tests:${RELEASE} echo "please wait while SDC-API-TESTS is starting....."
384monitor_docker sdc-api-tests
385
386fi
387}
388
389# ui-sanity
390function sdc-ui-tests {
391healthCheck
392if [[ (${RUN_UI_TESTS} = true) && (${healthCheck_http_code} == 200) ]]; then
393 echo "docker run sdc-ui-tets..."
394 echo "Triger sdc-ui-tests docker, please wait..."
395
396 if [ ${LOCAL} = false ]; then
397 docker pull ${PREFIX}/sdc-ui-tests:${RELEASE}
398 fi
399
400sdc-sim
401docker run --detach --name sdc-ui-tests --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${UI_TESTS_JAVA_OPTIONS}" --env SUITE_NAME=${UI_SUITE} --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-ui-tests/target:/var/lib/tests/target --volume ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport:/var/lib/tests/ExtentReport --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5901:5901 --publish 6901:6901 ${PREFIX}/sdc-ui-tests:${RELEASE}
402echo "please wait while SDC-UI-TESTS is starting....."
403monitor_docker sdc-ui-tests
404
405fi
406}
407
408
409# SDC-Simulator
410function sdc-sim {
411echo "docker run sdc-webSimulator..."
412if [ ${LOCAL} = false ]; then
Yuli Shlosberg98369b12018-04-10 19:36:24 +0300413 docker pull ${PREFIX}/sdc-simulator:${RELEASE}
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200414fi
415
416probe_sim
417if [ sim_stat=false ]; then
418
Yuli Shlosberge2eef602018-04-10 23:05:13 +0300419docker run --detach --name sdc-sim --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" --env ENVNAME="${DEP_ENV}" --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/logs/WS/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8285:8080 --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE}
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200420echo "please wait while SDC-WEB-SIMULATOR is starting....."
421monitor_docker sdc-sim
Yuli Shlosberg137cf5c2018-01-15 17:32:30 +0200422
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200423fi
424}
425
426if [ -z "${DOCKER}" ]; then
427 cleanup all
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200428 dir_perms
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200429 sdc-es
430 sdc-init-es
431 sdc-cs
432 sdc-cs-init
Gitelman, Tal (tg851x)19c9bda2018-03-19 19:07:30 +0200433# sdc-kbn
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200434 sdc-BE
435 sdc-BE-init
436 sdc-FE
Yuli Shlosberge07a5162018-02-26 10:11:10 +0200437 healthCheck
Yuli Shlosbergf59a2252018-03-21 11:14:08 +0200438 sdc-api-tests
439 sdc-ui-tests
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200440else
441 cleanup ${DOCKER}
svishnev0b698c42018-03-08 15:50:44 +0200442 dir_perms
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200443 ${DOCKER}
Yuli Shlosberge07a5162018-02-26 10:11:10 +0200444 healthCheck
Yuli Shlosberg958c32d2018-02-15 12:04:46 +0200445fi