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