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