Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 3 | # |
| 4 | # Constants: |
| 5 | # |
| 6 | |
| 7 | WORKSPACE="${WORKSPACE:-}" |
| 8 | SUCCESS=0 |
| 9 | FAILURE=1 |
| 10 | |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 11 | CS_PASSWORD="onap123#@!" |
| 12 | SDC_USER="asdc_user" |
| 13 | SDC_PASSWORD="Aa1234%^!" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 14 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 15 | JETTY_BASE="/var/lib/jetty" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 16 | |
| 17 | RELEASE=latest |
| 18 | LOCAL=false |
| 19 | RUNTESTS=false |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 20 | BE_DEBUG_PORT="--publish 4000:4000" |
| 21 | FE_DEBUG_PORT="--publish 6000:6000" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 22 | ONBOARD_DEBUG_PORT="--publish 4001:4000" |
| 23 | |
| 24 | |
| 25 | # Java Options: |
Gitelman, Tal (tg851x) | 328388b | 2018-03-22 13:03:44 +0200 | [diff] [blame] | 26 | BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m" |
| 27 | FE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=6000,server=y,suspend=n -Xmx256m -Xms256m" |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 28 | ONBOARD_BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g" |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 29 | DCAE_BE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-be/logback-spring.xml" |
| 30 | DCAE_FE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-fe/logback-spring.xml" |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 31 | SIM_JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m" |
| 32 | API_TESTS_JAVA_OPTIONS="-Xmx512m -Xms512m" |
| 33 | UI_TESTS_JAVA_OPTIONS="-Xmx1024m -Xms1024m" |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 34 | #Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there. |
| 35 | LOCAL_TIME_MOUNT_CMD="--volume /etc/localtime:/etc/localtime:ro" |
| 36 | # If os is OSX, unset this, so /etc/localtime is not mounted, otherwise leave it be |
| 37 | if [[ "$OSTYPE" == "darwin"* ]]; then |
| 38 | LOCAL_TIME_MOUNT_CMD="" |
| 39 | fi |
| 40 | |
| 41 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 42 | # |
| 43 | # Functions: |
| 44 | # |
| 45 | |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 46 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 47 | function usage { |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 48 | 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>] [ -sim|--simulator <Run-with-simulator>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -ta <run api tests with the supplied test suit>] [ -tu <run ui tests with the supplied test suit>] [ -tad <run api tests with the default test suit>] [ -tu <run ui tests with the default test suit>] [ -dcae|--dcae <Run-with-DCAE>][ -h|--help ]" |
| 49 | echo "start dockers built locally example: docker_run.sh -l" |
| 50 | echo "start dockers built locally and simulator example: docker_run.sh -l -sim" |
| 51 | echo "start dockers, pull from onap nexus according to release and simulator example: docker_run.sh -r 1.3-STAGING-latest -sim" |
| 52 | echo "start dockers built locally and run api tests docker example: docker_run.sh -l -tad" |
| 53 | echo "start dockers built locally and run only the catalog be example: docker_run.sh -l -d sdc-BE " |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 54 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 55 | # |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 56 | |
| 57 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 58 | function cleanup { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 59 | echo "Performing old dockers cleanup" |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 60 | |
| 61 | if [ "$1" == "all" ] ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 62 | docker_ids=`docker ps -a | egrep -v "onap/sdc-simulator" | egrep "ecomp-nexus:${PORT}/sdc|sdc|Exit}|dcae" | awk '{print $1}'` |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 63 | for X in ${docker_ids} |
| 64 | do |
| 65 | docker rm -f ${X} |
| 66 | done |
| 67 | else |
| 68 | echo "performing $1 docker cleanup" |
| 69 | tmp=`docker ps -a -q --filter="name=$1"` |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 70 | if [[ ! -z "$tmp" ]]; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 71 | docker rm -f ${tmp} |
| 72 | fi |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 73 | fi |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 74 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 75 | # |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 76 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 77 | |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 78 | function dir_perms { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 79 | mkdir -p ${WORKSPACE}/data/logs/BE/SDC/SDC-BE |
| 80 | mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 81 | |
| 82 | mkdir -p ${WORKSPACE}/data/logs/DCAE-BE/DCAE |
| 83 | mkdir -p ${WORKSPACE}/data/logs/DCAE-FE/DCAE |
| 84 | |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 85 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport |
| 86 | mkdir -p ${WORKSPACE}/data/logs/ONBOARD/SDC/ONBOARD-BE |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 87 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/target |
| 88 | mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 89 | mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/target |
| 90 | mkdir -p ${WORKSPACE}/data/logs/docker_logs |
| 91 | mkdir -p ${WORKSPACE}/data/logs/WS |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 92 | chmod -R 777 ${WORKSPACE}/data/logs |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 93 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 94 | # |
| 95 | |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 96 | |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 97 | function docker_logs { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 98 | docker logs $1 > ${WORKSPACE}/data/logs/docker_logs/$1_docker.log |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 99 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 100 | # |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 101 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 102 | |
| 103 | # |
| 104 | # Readiness Prob |
| 105 | # |
| 106 | |
| 107 | function ready_probe { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 108 | docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1 |
| 109 | rc=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 110 | if [[ ${rc} == 0 ]]; then |
| 111 | echo DOCKER $1 start finished in $2 seconds |
| 112 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 113 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 114 | return ${FAILURE} |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 115 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 116 | # |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 117 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 118 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 119 | function probe_docker { |
| 120 | MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"` |
| 121 | echo MATCH is -- ${MATCH} |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 122 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 123 | if [ -n "$MATCH" ] ; then |
| 124 | echo DOCKER start finished in $2 seconds |
| 125 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 126 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 127 | return ${FAILURE} |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 128 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 129 | # |
| 130 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 131 | |
| 132 | function probe_es { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 133 | health_Check_http_code=$(curl --noproxy "*" -o /dev/null -w '%{http_code}' http://${IP}:9200/_cluster/health?wait_for_status=yellow&timeout=120s) |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 134 | if [[ "$health_Check_http_code" -eq 200 ]] ; then |
| 135 | echo DOCKER start finished in $1 seconds |
| 136 | return ${SUCCESS} |
| 137 | fi |
| 138 | return ${FAILURE} |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 139 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 140 | # |
| 141 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 142 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 143 | function probe_sim { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 144 | if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 145 | echo "Already running" |
| 146 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 147 | else |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 148 | echo "Not running" |
| 149 | return ${FAILURE} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 150 | fi |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 151 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 152 | # |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 153 | |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 154 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 155 | function probe_dcae_be { |
| 156 | health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8082/dcae/conf/composition) |
| 157 | if [[ "${health_check_http_code}" -eq 200 ]] ; then |
| 158 | echo DOCKER start finished in $1 seconds |
| 159 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 160 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 161 | return ${FAILURE} |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 162 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 163 | # |
| 164 | |
| 165 | function probe_dcae_fe { |
| 166 | health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8183/dcaed/healthCheck) |
| 167 | if [[ "${health_check_http_code}" -eq 200 ]] ; then |
| 168 | echo DOCKER start finished in $1 seconds |
| 169 | return ${SUCCESS} |
| 170 | fi |
| 171 | return ${FAILURE} |
| 172 | } |
| 173 | # |
| 174 | |
| 175 | |
| 176 | # Not applicable for current release. Return Success in any case |
| 177 | function probe_dcae_tools { |
| 178 | health_check_http_code=$(curl -i -o /dev/null -w '%{http_code}' http://${IP}:8082/dcae/getResourcesByMonitoringTemplateCategory) |
| 179 | if [[ "${health_check_http_code}" -eq 200 ]] ; then |
| 180 | echo DOCKER start finished in $1 seconds |
| 181 | return ${SUCCESS} |
| 182 | fi |
| 183 | return ${SUCCESS} |
| 184 | } |
| 185 | # |
| 186 | |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 187 | # check simulator status |
| 188 | function probe_sim { |
| 189 | if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then |
| 190 | echo "running" |
| 191 | sim_stat=true |
| 192 | else |
| 193 | echo "not running" |
| 194 | sim_stat=false |
| 195 | fi |
| 196 | } |
| 197 | # |
| 198 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 199 | |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 200 | function monitor_docker { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 201 | DOCKER_NAME=$1 |
| 202 | echo "Monitor ${DOCKER_NAME} Docker" |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 203 | sleep 5 |
| 204 | TIME_OUT=900 |
| 205 | INTERVAL=20 |
| 206 | TIME=0 |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 207 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 208 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 209 | |
| 210 | case ${DOCKER_NAME} in |
| 211 | |
| 212 | sdc-cs) |
| 213 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 214 | status=$? ; |
| 215 | ;; |
| 216 | sdc-es) |
| 217 | probe_es ${TIME} ; |
| 218 | status=$? ; |
| 219 | ;; |
| 220 | sdc-BE) |
| 221 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 222 | status=$? ; |
| 223 | ;; |
| 224 | sdc-FE) |
| 225 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 226 | status=$? ; |
| 227 | ;; |
| 228 | sdc-onboard-BE) |
| 229 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 230 | status=$? ; |
| 231 | ;; |
| 232 | dcae-be) |
| 233 | probe_dcae_be ${TIME} ; |
| 234 | status=$? ; |
| 235 | ;; |
| 236 | dcae-fe) |
| 237 | probe_dcae_fe ${TIME} ; |
| 238 | status=$? ; |
| 239 | ;; |
| 240 | dcae-tools) |
| 241 | probe_dcae_tools ; |
| 242 | status=$? ; |
| 243 | ;; |
| 244 | *) |
| 245 | probe_docker ${DOCKER_NAME} ${TIME}; |
| 246 | status=$? ; |
| 247 | ;; |
| 248 | |
| 249 | esac |
| 250 | |
| 251 | if [ ${status} == ${SUCCESS} ] ; then |
| 252 | break; |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 253 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 254 | |
| 255 | echo "Sleep: ${INTERVAL} seconds before testing if ${DOCKER_NAME} DOCKER is up. Total wait time up now is: ${TIME} seconds. Timeout is: ${TIME_OUT} seconds" |
| 256 | sleep ${INTERVAL} |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 257 | TIME=$(($TIME+$INTERVAL)) |
| 258 | done |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 259 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 260 | docker_logs ${DOCKER_NAME} |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 261 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 262 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
| 263 | echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m" |
| 264 | fi |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 265 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 266 | # |
| 267 | |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 268 | |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 269 | function healthCheck { |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 270 | curl --noproxy "*" ${IP}:9200/_cluster/health?pretty=true |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 271 | |
| 272 | echo "BE health-Check:" |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 273 | curl --noproxy "*" http://${IP}:8080/sdc2/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 274 | |
| 275 | echo "" |
| 276 | echo "" |
| 277 | echo "FE health-Check:" |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 278 | curl --noproxy "*" http://${IP}:8181/sdc1/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 279 | |
| 280 | |
| 281 | echo "" |
| 282 | echo "" |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 283 | 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;) |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 284 | if [[ ${healthCheck_http_code} != 200 ]]; then |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 285 | echo "Error [${healthCheck_http_code}] while user existance check" |
| 286 | return ${healthCheck_http_code} |
| 287 | fi |
| 288 | echo "check user existance: OK" |
| 289 | return ${healthCheck_http_code} |
| 290 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 291 | # |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 292 | |
Tal Gitelman | e224d0b | 2017-10-17 15:24:25 +0300 | [diff] [blame] | 293 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 294 | function command_exit_status { |
| 295 | status=$1 |
| 296 | docker=$2 |
| 297 | if [ "${status}" != "0" ] ; then |
| 298 | echo "[ ERROR ] Docker ${docker} run command exit with status [${status}]" |
| 299 | fi |
| 300 | } |
| 301 | # |
| 302 | |
| 303 | |
| 304 | # |
| 305 | # Run Containers |
| 306 | # |
| 307 | |
| 308 | #Elastic-Search |
| 309 | function sdc-es { |
| 310 | DOCKER_NAME="sdc-es" |
| 311 | echo "docker run sdc-elasticsearch..." |
| 312 | if [ ${LOCAL} = false ]; then |
| 313 | echo "pulling code" |
| 314 | docker pull ${PREFIX}/sdc-elasticsearch:${RELEASE} |
| 315 | fi |
| 316 | docker run -dit --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --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 |
| 317 | command_exit_status $? ${DOCKER_NAME} |
| 318 | echo "please wait while ES is starting..." |
| 319 | monitor_docker ${DOCKER_NAME} |
| 320 | } |
| 321 | # |
| 322 | |
| 323 | |
| 324 | #Init-Elastic-Search |
| 325 | function sdc-init-es { |
| 326 | DOCKER_NAME="sdc-init-es" |
| 327 | echo "docker run sdc-init-elasticsearch..." |
| 328 | if [ ${LOCAL} = false ]; then |
| 329 | echo "pulling code" |
| 330 | docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE} |
| 331 | fi |
| 332 | echo "Running sdc-init-es" |
| 333 | docker run --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE} > /dev/null 2>&1 |
| 334 | rc=$? |
| 335 | docker_logs ${DOCKER_NAME} |
| 336 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 337 | } |
| 338 | # |
| 339 | |
| 340 | |
| 341 | #Cassandra |
| 342 | function sdc-cs { |
| 343 | DOCKER_NAME="sdc-cs" |
| 344 | echo "docker run sdc-cassandra..." |
| 345 | if [ ${LOCAL} = false ]; then |
| 346 | docker pull ${PREFIX}/sdc-cassandra:${RELEASE} |
| 347 | fi |
| 348 | docker run -dit --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --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 |
| 349 | command_exit_status $? ${DOCKER_NAME} |
| 350 | echo "please wait while CS is starting..." |
| 351 | monitor_docker ${DOCKER_NAME} |
| 352 | } |
| 353 | # |
| 354 | |
| 355 | |
| 356 | #Cassandra-init |
| 357 | function sdc-cs-init { |
| 358 | DOCKER_NAME="sdc-cs-init" |
| 359 | echo "docker run sdc-cassandra-init..." |
| 360 | if [ ${LOCAL} = false ]; then |
| 361 | docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE} |
| 362 | fi |
| 363 | docker run --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --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 |
| 364 | rc=$? |
| 365 | docker_logs ${DOCKER_NAME} |
| 366 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 367 | } |
| 368 | # |
| 369 | |
| 370 | |
| 371 | #Onboard Cassandra-init |
| 372 | function sdc-cs-onboard-init { |
| 373 | DOCKER_NAME="sdc-cs-onboard-init" |
| 374 | echo "docker run sdc-cs-onboard-init..." |
| 375 | if [ ${LOCAL} = false ]; then |
| 376 | docker pull ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} |
| 377 | fi |
| 378 | docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --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 ${LOCAL_TIME_MOUNT_CMD} --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-onboard-cassandra-init:${RELEASE} |
| 379 | rc=$? |
| 380 | docker_logs ${DOCKER_NAME} |
| 381 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 382 | } |
| 383 | # |
| 384 | |
| 385 | |
| 386 | #Kibana |
| 387 | function sdc-kbn { |
| 388 | DOCKER_NAME="sdc-kbn" |
| 389 | echo "docker run sdc-kibana..." |
| 390 | if [ ${LOCAL} = false ]; then |
| 391 | docker pull ${PREFIX}/sdc-kibana:${RELEASE} |
| 392 | docker run --detach --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 5601:5601 ${PREFIX}/sdc-kibana:${RELEASE} |
| 393 | command_exit_status $? ${DOCKER_NAME} |
| 394 | fi |
| 395 | } |
| 396 | # |
| 397 | |
| 398 | |
| 399 | #Back-End |
| 400 | function sdc-BE { |
| 401 | DOCKER_NAME="sdc-BE" |
| 402 | echo "docker run sdc-backend..." |
| 403 | if [ ${LOCAL} = false ]; then |
| 404 | docker pull ${PREFIX}/sdc-backend:${RELEASE} |
| 405 | else |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 406 | ADDITIONAL_ARGUMENTS=${BE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 407 | fi |
| 408 | docker run --detach --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --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} |
| 409 | command_exit_status $? ${DOCKER_NAME} |
| 410 | echo "please wait while BE is starting..." |
| 411 | monitor_docker ${DOCKER_NAME} |
| 412 | } |
| 413 | # |
| 414 | |
| 415 | |
| 416 | # Back-End-Init |
| 417 | function sdc-BE-init { |
| 418 | DOCKER_NAME="sdc-BE-init" |
| 419 | echo "docker run sdc-backend-init..." |
| 420 | if [ ${LOCAL} = false ]; then |
| 421 | docker pull ${PREFIX}/sdc-backend-init:${RELEASE} |
| 422 | fi |
| 423 | docker run --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --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 |
| 424 | rc=$? |
| 425 | docker_logs ${DOCKER_NAME} |
| 426 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 427 | } |
| 428 | # |
| 429 | |
| 430 | |
| 431 | # Onboard Back-End |
| 432 | function sdc-onboard-BE { |
| 433 | DOCKER_NAME="sdc-onboard-BE" |
| 434 | echo "docker run sdc-onboard-BE ..." |
| 435 | # TODO Check the dir_perms action . do we need it here ?? |
| 436 | # dir_perms |
| 437 | if [ ${LOCAL} = false ]; then |
| 438 | docker pull ${PREFIX}/sdc-onboard-backend:${RELEASE} |
| 439 | else |
| 440 | ADDITIONAL_ARGUMENTS=${ONBOARD_DEBUG_PORT} |
| 441 | fi |
| 442 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env SDC_CLUSTER_NAME="SDC-CS-${DEP_ENV}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env JAVA_OPTIONS="${ONBOARD_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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/ONBOARD:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8445:8445 --publish 8081:8081 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-onboard-backend:${RELEASE} |
| 443 | command_exit_status $? ${DOCKER_NAME} |
| 444 | echo "please wait while sdc-onboard-BE is starting..." |
| 445 | monitor_docker ${DOCKER_NAME} |
| 446 | } |
| 447 | # |
| 448 | |
| 449 | |
| 450 | # Front-End |
| 451 | function sdc-FE { |
| 452 | DOCKER_NAME="sdc-FE" |
| 453 | echo "docker run sdc-frontend..." |
| 454 | if [ ${LOCAL} = false ]; then |
| 455 | docker pull ${PREFIX}/sdc-frontend:${RELEASE} |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 456 | else |
| 457 | ADDITIONAL_ARGUMENTS=${FE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 458 | fi |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 459 | docker run --detach --name ${DOCKER_NAME} --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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9443:9443 --publish 8181:8181 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-frontend:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 460 | command_exit_status $? ${DOCKER_NAME} |
| 461 | echo "please wait while FE is starting....." |
| 462 | monitor_docker ${DOCKER_NAME} |
| 463 | } |
| 464 | # |
| 465 | |
| 466 | |
| 467 | # DCAE BackEnd |
| 468 | function dcae-be { |
| 469 | if [ ! ${DCAE_ENABLE} ] ; then |
| 470 | return |
| 471 | fi |
| 472 | DOCKER_NAME="dcae-be" |
| 473 | echo "docker run ${DOCKER_NAME}..." |
| 474 | if [ ${LOCAL} = false ]; then |
| 475 | docker pull ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 476 | fi |
| 477 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/DCAE-BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-be/chef-solo/environments --publish 8444:8444 --publish 8082:8082 ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 478 | command_exit_status $? ${DOCKER_NAME} |
| 479 | echo "please wait while ${DOCKER_NAME^^} is starting....." |
| 480 | monitor_docker ${DOCKER_NAME} |
| 481 | } |
| 482 | # |
| 483 | |
| 484 | |
| 485 | # DCAE Configuration |
| 486 | function dcae-tools { |
| 487 | if [ ! ${DCAE_ENABLE} ] ; then |
| 488 | return |
| 489 | fi |
| 490 | DOCKER_NAME="dcae-tools" |
| 491 | echo "docker run ${DOCKER_NAME}..." |
| 492 | if [ ${LOCAL} = false ]; then |
| 493 | docker pull ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 494 | fi |
| 495 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-tools/chef-solo/environments ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 496 | command_exit_status $? ${DOCKER_NAME} |
| 497 | echo "please wait while ${DOCKER_NAME^^} is starting....." |
| 498 | monitor_docker ${DOCKER_NAME} |
| 499 | |
| 500 | } |
| 501 | # |
| 502 | |
| 503 | |
| 504 | # DCAE FrontEnd |
| 505 | function dcae-fe { |
| 506 | if [ ! ${DCAE_ENABLE} ] ; then |
| 507 | return |
| 508 | fi |
| 509 | DOCKER_NAME="dcae-fe" |
| 510 | echo "docker run ${DOCKER_NAME}..." |
| 511 | if [ ${LOCAL} = false ]; then |
| 512 | docker pull ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 513 | fi |
| 514 | docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_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 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/DCAE-FE/:/var/lib/jetty/logs --volume ${WORKSPACE}/data/environments:/var/opt/dcae-fe/chef-solo/environments/ --publish 9444:9444 --publish 8183:8183 ${PREFIX}/${DOCKER_NAME}:${RELEASE} |
| 515 | command_exit_status $? ${DOCKER_NAME} |
| 516 | echo "please wait while ${DOCKER_NAME^^} is starting....." |
| 517 | monitor_docker ${DOCKER_NAME} |
| 518 | |
| 519 | } |
| 520 | # |
| 521 | |
| 522 | |
| 523 | # apis-sanity |
| 524 | function sdc-api-tests { |
| 525 | if [[ ${RUN_API_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 526 | healthCheck |
| 527 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 528 | if [[ ${healthCheck_http_code} == 200 ]] ; then |
| 529 | echo "docker run sdc-api-tests..." |
| 530 | echo "Trigger sdc-api-tests docker, please wait..." |
| 531 | |
| 532 | if [ ${LOCAL} = false ]; then |
| 533 | docker pull ${PREFIX}/sdc-api-tests:${RELEASE} |
| 534 | fi |
| 535 | |
| 536 | docker 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 ${LOCAL_TIME_MOUNT_CMD} --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....." |
| 537 | monitor_docker sdc-api-tests |
| 538 | fi |
| 539 | fi |
| 540 | } |
| 541 | # |
| 542 | |
| 543 | |
| 544 | # ui-sanity |
| 545 | function sdc-ui-tests { |
| 546 | |
| 547 | if [[ ${RUN_UI_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 548 | healthCheck |
| 549 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 550 | if [[ ${healthCheck_http_code} == 200 ]]; then |
| 551 | echo "docker run sdc-ui-tets..." |
| 552 | echo "Trigger sdc-ui-tests docker, please wait..." |
| 553 | |
| 554 | if [ ${LOCAL} = false ]; then |
| 555 | docker pull ${PREFIX}/sdc-ui-tests:${RELEASE} |
| 556 | fi |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 557 | RUN_SIMULATOR=true; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 558 | sdc-sim |
| 559 | docker 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 ${LOCAL_TIME_MOUNT_CMD} --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} |
| 560 | echo "please wait while SDC-UI-TESTS is starting....." |
| 561 | monitor_docker sdc-ui-tests |
| 562 | fi |
| 563 | fi |
| 564 | } |
| 565 | # |
| 566 | |
| 567 | |
| 568 | # SDC-Simulator |
| 569 | function sdc-sim { |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 570 | if [ ${RUN_SIMULATOR} = true ]; then |
| 571 | echo "docker run sdc-webSimulator..." |
| 572 | if [ ${LOCAL} = false ]; then |
| 573 | docker pull ${PREFIX}/sdc-simulator:${RELEASE} |
| 574 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 575 | |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 576 | probe_sim |
| 577 | sim_stat=$? |
| 578 | if [ sim_stat=1 ]; then |
| 579 | docker run \ |
| 580 | --detach \ |
| 581 | --name sdc-sim \ |
| 582 | --env FE_URL="${FE_URL}" \ |
| 583 | --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" \ |
| 584 | --env ENVNAME="${DEP_ENV}" \ |
| 585 | ${LOCAL_TIME_MOUNT_CMD} \ |
| 586 | --volume ${WORKSPACE}/data/logs/WS/:/var/lib/jetty/logs \ |
| 587 | --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \ |
| 588 | --publish 8285:8080 \ |
| 589 | --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE} |
| 590 | echo "please wait while SDC-WEB-SIMULATOR is starting....." |
| 591 | monitor_docker sdc-sim |
| 592 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 593 | fi |
| 594 | } |
| 595 | # |
| 596 | |
| 597 | |
| 598 | # |
| 599 | # Main |
| 600 | # |
| 601 | |
| 602 | # Handle command line arguments |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 603 | while [ $# -gt 0 ]; do |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 604 | case $1 in |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 605 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 606 | # -r | --release - The specific docker version to pull and deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 607 | -r | --release ) |
| 608 | shift 1 ; |
| 609 | RELEASE=$1; |
| 610 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 611 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 612 | # -e | --environment - The environment name you want to deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 613 | -e | --environment ) |
| 614 | shift 1; |
| 615 | DEP_ENV=$1; |
| 616 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 617 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 618 | # -p | --port - The port from which to connect to the docker nexus |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 619 | -p | --port ) |
| 620 | shift 1 ; |
| 621 | PORT=$1; |
| 622 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 623 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 624 | # -l | --local - Use this for deploying your local dockers without pulling them first |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 625 | -l | --local ) |
| 626 | LOCAL=true; |
| 627 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 628 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 629 | # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed |
| 630 | -ta ) |
| 631 | shift 1 ; |
| 632 | API_SUITE=$1; |
| 633 | RUN_API_TESTS=true; |
| 634 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 635 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 636 | # -tu - Use this for running the UI sanity docker after all other dockers have been deployed |
| 637 | -tu ) |
| 638 | shift 1 ; |
| 639 | UI_SUITE=$1; |
| 640 | RUN_UI_TESTS=true; |
| 641 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 642 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 643 | # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed |
| 644 | -tad | -t ) |
| 645 | API_SUITE="onapApiSanity"; |
| 646 | RUN_API_TESTS=true; |
| 647 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 648 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 649 | # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed |
| 650 | -tud ) |
| 651 | UI_SUITE="onapUiSanity"; |
| 652 | RUN_UI_TESTS=true; |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 653 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 654 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 655 | # -d | --docker - The init specified docker |
| 656 | -d | --docker ) |
| 657 | shift 1 ; |
| 658 | DOCKER=$1; |
| 659 | shift 1 ;; |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 660 | # -sim | --simulator run the simulator |
| 661 | -sim | --simulator ) |
| 662 | RUN_SIMULATOR=true; |
| 663 | shift 1 ;; |
| 664 | # -sim | --simulator run the simulator |
| 665 | -u | --fe_url ) |
| 666 | shift 1 ; |
| 667 | FE_URL=$1; |
| 668 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 669 | # -dcae | --dcae - Use this to deploy DCAE upon SDC |
| 670 | -dcae | --dcae ) |
| 671 | shift 1 ; |
| 672 | DCAE_ENABLE='True';; |
| 673 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 674 | # -h | --help - Display the help message with all the available run options |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 675 | -h | --help ) |
| 676 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 677 | exit ${SUCCESS};; |
| 678 | |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 679 | * ) |
| 680 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 681 | exit ${FAILURE};; |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 682 | esac |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 683 | done |
| 684 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 685 | |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 686 | #Prefix those with WORKSPACE so it can be set to something other then /opt |
| 687 | [ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || echo ${DEP_ENV} |
| 688 | [ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release |
| 689 | [ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW |
| 690 | [ -f ${WORKSPACE}/opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat ${WORKSPACE}/opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=nexus3.onap.org:${PORT} |
| 691 | [ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 692 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 693 | |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 694 | export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'` |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 695 | #If OSX, then use this to get IP |
| 696 | if [[ "$OSTYPE" == "darwin"* ]]; then |
| 697 | export IP=$(ipconfig getifaddr en0) |
| 698 | fi |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 699 | export PREFIX=${NEXUS_DOCKER_REPO}'/onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 700 | |
| 701 | if [ ${LOCAL} = true ]; then |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 702 | PREFIX='onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 703 | fi |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 704 | |
| 705 | echo "" |
| 706 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 707 | if [ -z "${DOCKER}" ]; then |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 708 | cleanup all |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 709 | dir_perms |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 710 | sdc-es |
| 711 | sdc-init-es |
| 712 | sdc-cs |
| 713 | sdc-cs-init |
Gitelman, Tal (tg851x) | 19c9bda | 2018-03-19 19:07:30 +0200 | [diff] [blame] | 714 | # sdc-kbn |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 715 | sdc-cs-onboard-init |
| 716 | sdc-onboard-BE |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 717 | sdc-BE |
| 718 | sdc-BE-init |
| 719 | sdc-FE |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 720 | dcae-be |
| 721 | dcae-tools |
| 722 | dcae-fe |
| 723 | healthCheck |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 724 | sdc-sim |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 725 | sdc-api-tests |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 726 | sdc-ui-tests |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 727 | else |
| 728 | cleanup ${DOCKER} |
svishnev | 0b698c4 | 2018-03-08 15:50:44 +0200 | [diff] [blame] | 729 | dir_perms |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 730 | ${DOCKER} |
Yuli Shlosberg | e07a516 | 2018-02-26 10:11:10 +0200 | [diff] [blame] | 731 | healthCheck |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 732 | fi |