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 |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 19 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 20 | LOCAL=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" |
shrek2000 | 0594c41 | 2020-01-30 14:52:49 +0200 | [diff] [blame] | 24 | CS_PORT=${CS_PORT:-9042} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 25 | |
| 26 | |
| 27 | # Java Options: |
Gitelman, Tal (tg851x) | 328388b | 2018-03-22 13:03:44 +0200 | [diff] [blame] | 28 | BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4000,server=y,suspend=n -Xmx1536m -Xms1536m" |
| 29 | 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] | 30 | ONBOARD_BE_JAVA_OPTIONS="-Xdebug -agentlib:jdwp=transport=dt_socket,address=4001,server=y,suspend=n -Xmx1g -Xms1g" |
Yuli Shlosberg | af70a20 | 2018-09-25 17:16:48 +0300 | [diff] [blame] | 31 | 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] | 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 { |
kaihlavi | 900985e | 2019-06-06 14:52:02 +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>] [ -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>] [ -h|--help ]" |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 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" |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 51 | echo "start dockers, pull from onap nexus according to release and simulator example: docker_run.sh -r 1.5-STAGING-latest -sim" |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 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 |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 62 | docker_ids=`docker ps -a | 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 |
| 81 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/ExtentReport |
| 82 | mkdir -p ${WORKSPACE}/data/logs/ONBOARD/SDC/ONBOARD-BE |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 83 | mkdir -p ${WORKSPACE}/data/logs/sdc-api-tests/target |
| 84 | mkdir -p ${WORKSPACE}/data/logs/sdc-ui-tests/ExtentReport |
| 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 |
andre.schmid | fa1db43 | 2019-10-29 17:18:22 +0000 | [diff] [blame] | 88 | echo "Creating dir '${WORKSPACE}/data/${SDC_CERT_DIR}'" |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 89 | mkdir -p ${WORKSPACE}/data/${SDC_CERT_DIR} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 90 | chmod -R 777 ${WORKSPACE}/data/logs |
Grinberg Moti | c3bda48 | 2017-02-23 11:24:34 +0200 | [diff] [blame] | 91 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 92 | # |
| 93 | |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 94 | |
Yuli Shlosberg | b4deec1 | 2018-02-25 20:24:44 +0200 | [diff] [blame] | 95 | function docker_logs { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 96 | docker logs $1 > ${WORKSPACE}/data/logs/docker_logs/$1_docker.log |
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 | # |
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 | |
| 101 | # |
| 102 | # Readiness Prob |
| 103 | # |
| 104 | |
| 105 | function ready_probe { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 106 | docker exec $1 /var/lib/ready-probe.sh > /dev/null 2>&1 |
| 107 | rc=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 108 | if [[ ${rc} == 0 ]]; then |
| 109 | echo DOCKER $1 start finished in $2 seconds |
| 110 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 111 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 112 | return ${FAILURE} |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 113 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 114 | # |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 115 | |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 116 | function ready_probe_jetty { |
| 117 | docker exec $1 /var/lib/jetty/ready-probe.sh > /dev/null 2>&1 |
| 118 | rc=$? |
| 119 | if [[ ${rc} == 0 ]]; then |
| 120 | echo DOCKER $1 start finished in $2 seconds |
| 121 | return ${SUCCESS} |
| 122 | fi |
| 123 | return ${FAILURE} |
| 124 | } |
| 125 | # |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 126 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 127 | function probe_docker { |
| 128 | MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"` |
| 129 | echo MATCH is -- ${MATCH} |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 130 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 131 | if [ -n "$MATCH" ] ; then |
| 132 | echo DOCKER start finished in $2 seconds |
| 133 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 134 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 135 | return ${FAILURE} |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 136 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 137 | # |
| 138 | |
kaihlavi | 02f4880 | 2019-07-30 19:23:52 +0300 | [diff] [blame] | 139 | function probe_test_docker { |
| 140 | # This expected logging should be output by startup.sh of the |
| 141 | # respective test docker container |
| 142 | MATCH=`docker logs --tail 30 $1 | grep "Startup completed successfully"` |
| 143 | echo MATCH is -- ${MATCH} |
| 144 | |
| 145 | if [ -n "$MATCH" ] ; then |
| 146 | echo TEST DOCKER start finished in $2 seconds |
| 147 | return ${SUCCESS} |
| 148 | fi |
| 149 | return ${FAILURE} |
| 150 | } |
| 151 | # |
| 152 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 153 | |
| 154 | function probe_es { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 155 | 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] | 156 | if [[ "$health_Check_http_code" -eq 200 ]] ; then |
| 157 | echo DOCKER start finished in $1 seconds |
| 158 | return ${SUCCESS} |
| 159 | fi |
| 160 | return ${FAILURE} |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 161 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 162 | # |
| 163 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 164 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 165 | function probe_sim { |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 166 | if lsof -Pi :8285 -sTCP:LISTEN -t >/dev/null ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 167 | echo "Already running" |
| 168 | return ${SUCCESS} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 169 | else |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 170 | echo "Not running" |
| 171 | return ${FAILURE} |
Michael Lando | 4b9b947 | 2018-06-02 19:14:05 +0300 | [diff] [blame] | 172 | fi |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 173 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 174 | # |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 175 | |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 176 | |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 177 | function monitor_docker { |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 178 | DOCKER_NAME=$1 |
| 179 | echo "Monitor ${DOCKER_NAME} Docker" |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 180 | sleep 5 |
| 181 | TIME_OUT=900 |
| 182 | INTERVAL=20 |
| 183 | TIME=0 |
Avi Ziv | c175a0d | 2018-03-15 13:21:44 +0200 | [diff] [blame] | 184 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 185 | while [ "$TIME" -lt "$TIME_OUT" ]; do |
| 186 | |
| 187 | case ${DOCKER_NAME} in |
| 188 | |
| 189 | sdc-cs) |
| 190 | ready_probe ${DOCKER_NAME} ${TIME} ; |
| 191 | status=$? ; |
| 192 | ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 193 | sdc-BE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 194 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 195 | status=$? ; |
| 196 | ;; |
| 197 | sdc-FE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 198 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 199 | status=$? ; |
| 200 | ;; |
| 201 | sdc-onboard-BE) |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 202 | ready_probe_jetty ${DOCKER_NAME} ${TIME} ; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 203 | status=$? ; |
| 204 | ;; |
kaihlavi | 02f4880 | 2019-07-30 19:23:52 +0300 | [diff] [blame] | 205 | sdc-api-tests) |
| 206 | probe_test_docker ${DOCKER_NAME} ${TIME}; |
| 207 | status=$? ; |
| 208 | ;; |
| 209 | sdc-ui-tests) |
| 210 | probe_test_docker ${DOCKER_NAME} ${TIME}; |
| 211 | status=$? ; |
| 212 | ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 213 | *) |
| 214 | probe_docker ${DOCKER_NAME} ${TIME}; |
| 215 | status=$? ; |
| 216 | ;; |
| 217 | |
| 218 | esac |
| 219 | |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 220 | if [[ ${status} == ${SUCCESS} ]] ; then |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 221 | break; |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 222 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 223 | |
| 224 | 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" |
| 225 | sleep ${INTERVAL} |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 226 | TIME=$(($TIME+$INTERVAL)) |
| 227 | done |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 228 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 229 | docker_logs ${DOCKER_NAME} |
Yuli Shlosberg | 36604c7 | 2018-02-25 16:03:45 +0200 | [diff] [blame] | 230 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 231 | if [ "$TIME" -ge "$TIME_OUT" ]; then |
| 232 | echo -e "\e[1;31mTIME OUT: DOCKER was NOT fully started in $TIME_OUT seconds... Could cause problems ...\e[0m" |
| 233 | fi |
Yuli Shlosberg | 5571a86 | 2017-10-03 18:18:51 +0300 | [diff] [blame] | 234 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 235 | # |
| 236 | |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 237 | # healthCheck script used the secure connection to send request (https is always turn on) |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 238 | function healthCheck { |
Yuli Shlosberg | 474996a | 2018-02-27 18:55:25 +0200 | [diff] [blame] | 239 | curl --noproxy "*" ${IP}:9200/_cluster/health?pretty=true |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 240 | |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 241 | echo "BE Health Check:" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 242 | curl -k --noproxy "*" https://${IP}:8443/sdc2/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 243 | |
| 244 | echo "" |
| 245 | echo "" |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 246 | echo "FE Health Check:" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 247 | curl -k --noproxy "*" https://${IP}:9443/sdc1/rest/healthCheck |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 248 | |
| 249 | |
| 250 | echo "" |
| 251 | echo "" |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 252 | healthCheck_http_code=$(curl -k --noproxy "*" -o /dev/null -w '%{http_code}' -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" https://${IP}:8443/sdc2/rest/v1/user/demo;) |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 253 | if [[ ${healthCheck_http_code} != 200 ]]; then |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 254 | echo "Error [${healthCheck_http_code}] while checking existence of user" |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 255 | return ${healthCheck_http_code} |
| 256 | fi |
kaihlavi | 900985e | 2019-06-06 14:52:02 +0300 | [diff] [blame] | 257 | echo "check user existence: OK" |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 258 | return ${healthCheck_http_code} |
| 259 | } |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 260 | # |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 261 | |
Tal Gitelman | e224d0b | 2017-10-17 15:24:25 +0300 | [diff] [blame] | 262 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 263 | function command_exit_status { |
| 264 | status=$1 |
| 265 | docker=$2 |
| 266 | if [ "${status}" != "0" ] ; then |
| 267 | echo "[ ERROR ] Docker ${docker} run command exit with status [${status}]" |
| 268 | fi |
| 269 | } |
| 270 | # |
| 271 | |
| 272 | |
| 273 | # |
| 274 | # Run Containers |
| 275 | # |
| 276 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 277 | |
| 278 | #Cassandra |
| 279 | function sdc-cs { |
| 280 | DOCKER_NAME="sdc-cs" |
| 281 | echo "docker run sdc-cassandra..." |
| 282 | if [ ${LOCAL} = false ]; then |
| 283 | docker pull ${PREFIX}/sdc-cassandra:${RELEASE} |
| 284 | fi |
shrek2000 | 0594c41 | 2020-01-30 14:52:49 +0200 | [diff] [blame] | 285 | 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 ${CS_PORT}:${CS_PORT} ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 286 | command_exit_status $? ${DOCKER_NAME} |
| 287 | echo "please wait while CS is starting..." |
| 288 | monitor_docker ${DOCKER_NAME} |
| 289 | } |
| 290 | # |
| 291 | |
| 292 | |
| 293 | #Cassandra-init |
| 294 | function sdc-cs-init { |
| 295 | DOCKER_NAME="sdc-cs-init" |
| 296 | echo "docker run sdc-cassandra-init..." |
| 297 | if [ ${LOCAL} = false ]; then |
| 298 | docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE} |
| 299 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 300 | 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:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1 |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 301 | rc=$? |
| 302 | docker_logs ${DOCKER_NAME} |
| 303 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 304 | } |
| 305 | # |
| 306 | |
| 307 | |
| 308 | #Onboard Cassandra-init |
| 309 | function sdc-cs-onboard-init { |
| 310 | DOCKER_NAME="sdc-cs-onboard-init" |
| 311 | echo "docker run sdc-cs-onboard-init..." |
| 312 | if [ ${LOCAL} = false ]; then |
| 313 | docker pull ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} |
| 314 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 315 | docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env CS_HOST_PORT=${CS_PORT} --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:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/home/sdc/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 316 | rc=$? |
| 317 | docker_logs ${DOCKER_NAME} |
| 318 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 319 | } |
| 320 | # |
| 321 | |
| 322 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 323 | #Back-End |
| 324 | function sdc-BE { |
| 325 | DOCKER_NAME="sdc-BE" |
| 326 | echo "docker run sdc-backend..." |
| 327 | if [ ${LOCAL} = false ]; then |
| 328 | docker pull ${PREFIX}/sdc-backend:${RELEASE} |
| 329 | else |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 330 | ADDITIONAL_ARGUMENTS=${BE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 331 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 332 | 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/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:${JETTY_BASE}/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 333 | command_exit_status $? ${DOCKER_NAME} |
| 334 | echo "please wait while BE is starting..." |
| 335 | monitor_docker ${DOCKER_NAME} |
| 336 | } |
| 337 | # |
| 338 | |
| 339 | |
| 340 | # Back-End-Init |
| 341 | function sdc-BE-init { |
| 342 | DOCKER_NAME="sdc-BE-init" |
| 343 | echo "docker run sdc-backend-init..." |
| 344 | if [ ${LOCAL} = false ]; then |
| 345 | docker pull ${PREFIX}/sdc-backend-init:${RELEASE} |
| 346 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 347 | 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/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1 |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 348 | rc=$? |
| 349 | docker_logs ${DOCKER_NAME} |
| 350 | if [[ ${rc} != 0 ]]; then exit ${rc}; fi |
| 351 | } |
| 352 | # |
| 353 | |
| 354 | |
| 355 | # Onboard Back-End |
| 356 | function sdc-onboard-BE { |
| 357 | DOCKER_NAME="sdc-onboard-BE" |
| 358 | echo "docker run sdc-onboard-BE ..." |
| 359 | # TODO Check the dir_perms action . do we need it here ?? |
| 360 | # dir_perms |
| 361 | if [ ${LOCAL} = false ]; then |
| 362 | docker pull ${PREFIX}/sdc-onboard-backend:${RELEASE} |
| 363 | else |
| 364 | ADDITIONAL_ARGUMENTS=${ONBOARD_DEBUG_PORT} |
| 365 | fi |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 366 | 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}:${JETTY_BASE}/onap/cert --volume ${WORKSPACE}/data/logs/ONBOARD:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/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] | 367 | command_exit_status $? ${DOCKER_NAME} |
| 368 | echo "please wait while sdc-onboard-BE is starting..." |
| 369 | monitor_docker ${DOCKER_NAME} |
| 370 | } |
| 371 | # |
| 372 | |
| 373 | |
| 374 | # Front-End |
| 375 | function sdc-FE { |
| 376 | DOCKER_NAME="sdc-FE" |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 377 | IMAGE_NAME="${PREFIX}/sdc-frontend:${RELEASE}" |
| 378 | echo "Running container '${DOCKER_NAME}' based on '${IMAGE_NAME}' image..." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 379 | if [ ${LOCAL} = false ]; then |
| 380 | docker pull ${PREFIX}/sdc-frontend:${RELEASE} |
Tal Gitelman | ef4b94e | 2018-08-02 17:11:25 +0300 | [diff] [blame] | 381 | else |
| 382 | ADDITIONAL_ARGUMENTS=${FE_DEBUG_PORT} |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 383 | fi |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 384 | |
| 385 | PLUGIN_CONFIG_FILE="${WORKSPACE}/data/environments/plugins-configuration.yaml" |
| 386 | if [[ -f ${WORKSPACE}/data/environments/plugins-configuration.yaml ]]; then |
| 387 | PLUGINS_CONF_VOLUME_MOUNT="--volume ${PLUGIN_CONFIG_FILE}:${JETTY_BASE}/config/catalog-fe/plugins-configuration.yaml" |
| 388 | else |
| 389 | echo "INFO: '${PLUGIN_CONFIG_FILE}' not provided, ignoring..." |
| 390 | fi |
| 391 | |
| 392 | docker run \ |
| 393 | --detach \ |
| 394 | --name ${DOCKER_NAME} \ |
| 395 | --env HOST_IP=${IP} \ |
| 396 | --env ENVNAME="${DEP_ENV}" \ |
| 397 | --env JAVA_OPTIONS="${FE_JAVA_OPTIONS}" \ |
| 398 | --log-driver=json-file \ |
| 399 | --log-opt max-size=100m \ |
| 400 | --log-opt max-file=10 \ |
| 401 | --ulimit memlock=-1:-1 \ |
| 402 | --ulimit nofile=4096:100000 \ |
| 403 | --volume ${WORKSPACE}/data/logs/FE/:${JETTY_BASE}/logs \ |
MichaelMorris | a2abf6e | 2020-03-10 12:37:48 +0000 | [diff] [blame] | 404 | --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments \ |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 405 | ${LOCAL_TIME_MOUNT_CMD} \ |
| 406 | ${PLUGINS_CONF_VOLUME_MOUNT} \ |
| 407 | --publish 9443:9443 \ |
| 408 | --publish 8181:8181 \ |
| 409 | ${ADDITIONAL_ARGUMENTS} \ |
| 410 | ${IMAGE_NAME} |
| 411 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 412 | command_exit_status $? ${DOCKER_NAME} |
Dmitry Puzikov | 0574f88 | 2020-03-05 18:03:15 +0100 | [diff] [blame] | 413 | echo "Please wait while '${DOCKER_NAME}' container is starting..." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 414 | monitor_docker ${DOCKER_NAME} |
| 415 | } |
| 416 | # |
| 417 | |
| 418 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 419 | # apis-sanity |
| 420 | function sdc-api-tests { |
| 421 | if [[ ${RUN_API_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 422 | healthCheck |
| 423 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 424 | if [[ ${healthCheck_http_code} == 200 ]] ; then |
| 425 | echo "docker run sdc-api-tests..." |
| 426 | echo "Trigger sdc-api-tests docker, please wait..." |
| 427 | |
| 428 | if [ ${LOCAL} = false ]; then |
| 429 | docker pull ${PREFIX}/sdc-api-tests:${RELEASE} |
| 430 | fi |
| 431 | |
AndyWalshe | c1835f3 | 2019-04-25 11:20:38 +0000 | [diff] [blame] | 432 | 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 --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:/var/lib/tests/cert --publish 9560:9560 ${PREFIX}/sdc-api-tests:${RELEASE} echo "please wait while SDC-API-TESTS is starting....." |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 433 | monitor_docker sdc-api-tests |
| 434 | fi |
| 435 | fi |
| 436 | } |
| 437 | # |
| 438 | |
| 439 | |
| 440 | # ui-sanity |
| 441 | function sdc-ui-tests { |
| 442 | |
| 443 | if [[ ${RUN_UI_TESTS} = true ]] ; then |
Yuli Shlosberg | d0eaeca | 2018-07-19 17:54:15 +0300 | [diff] [blame] | 444 | healthCheck |
| 445 | healthCheck_http_code=$? |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 446 | if [[ ${healthCheck_http_code} == 200 ]]; then |
| 447 | echo "docker run sdc-ui-tets..." |
| 448 | echo "Trigger sdc-ui-tests docker, please wait..." |
| 449 | |
| 450 | if [ ${LOCAL} = false ]; then |
| 451 | docker pull ${PREFIX}/sdc-ui-tests:${RELEASE} |
| 452 | fi |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 453 | RUN_SIMULATOR=true; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 454 | sdc-sim |
| 455 | 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} |
| 456 | echo "please wait while SDC-UI-TESTS is starting....." |
| 457 | monitor_docker sdc-ui-tests |
| 458 | fi |
| 459 | fi |
| 460 | } |
| 461 | # |
| 462 | |
| 463 | |
| 464 | # SDC-Simulator |
| 465 | function sdc-sim { |
Lianhao Lu | 2616684 | 2018-09-07 10:42:10 +0800 | [diff] [blame] | 466 | if [ "${RUN_SIMULATOR}" == true ]; then |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 467 | echo "docker run sdc-webSimulator..." |
| 468 | if [ ${LOCAL} = false ]; then |
| 469 | docker pull ${PREFIX}/sdc-simulator:${RELEASE} |
| 470 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 471 | |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 472 | probe_sim |
| 473 | sim_stat=$? |
Michael Lando | b751c96 | 2018-08-20 11:34:04 +0300 | [diff] [blame] | 474 | if [ ${sim_stat} == 1 ]; then |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 475 | docker run \ |
| 476 | --detach \ |
| 477 | --name sdc-sim \ |
| 478 | --env FE_URL="${FE_URL}" \ |
| 479 | --env JAVA_OPTIONS="${SIM_JAVA_OPTIONS}" \ |
| 480 | --env ENVNAME="${DEP_ENV}" \ |
| 481 | ${LOCAL_TIME_MOUNT_CMD} \ |
andre.schmid | fa1db43 | 2019-10-29 17:18:22 +0000 | [diff] [blame] | 482 | --volume ${WORKSPACE}/data/logs/WS/:${JETTY_BASE}/logs \ |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 483 | --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \ |
| 484 | --publish 8285:8080 \ |
| 485 | --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE} |
| 486 | echo "please wait while SDC-WEB-SIMULATOR is starting....." |
| 487 | monitor_docker sdc-sim |
| 488 | fi |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 489 | fi |
| 490 | } |
| 491 | # |
| 492 | |
| 493 | |
| 494 | # |
| 495 | # Main |
| 496 | # |
| 497 | |
| 498 | # Handle command line arguments |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 499 | while [ $# -gt 0 ]; do |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 500 | case $1 in |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 501 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 502 | # -r | --release - The specific docker version to pull and deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 503 | -r | --release ) |
| 504 | shift 1 ; |
| 505 | RELEASE=$1; |
| 506 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 507 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 508 | # -e | --environment - The environment name you want to deploy |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 509 | -e | --environment ) |
| 510 | shift 1; |
| 511 | DEP_ENV=$1; |
| 512 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 513 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 514 | # -p | --port - The port from which to connect to the docker nexus |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 515 | -p | --port ) |
| 516 | shift 1 ; |
| 517 | PORT=$1; |
| 518 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 519 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 520 | # -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] | 521 | -l | --local ) |
| 522 | LOCAL=true; |
| 523 | shift 1;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 524 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 525 | # -ta - Use this for running the APIs sanity docker after all other dockers have been deployed |
| 526 | -ta ) |
| 527 | shift 1 ; |
| 528 | API_SUITE=$1; |
| 529 | RUN_API_TESTS=true; |
| 530 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 531 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 532 | # -tu - Use this for running the UI sanity docker after all other dockers have been deployed |
| 533 | -tu ) |
| 534 | shift 1 ; |
| 535 | UI_SUITE=$1; |
| 536 | RUN_UI_TESTS=true; |
| 537 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 538 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 539 | # -tad - Use this for running the DEFAULT suite of tests in APIs sanity docker after all other dockers have been deployed |
| 540 | -tad | -t ) |
| 541 | API_SUITE="onapApiSanity"; |
| 542 | RUN_API_TESTS=true; |
| 543 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 544 | |
Yuli Shlosberg | f59a225 | 2018-03-21 11:14:08 +0200 | [diff] [blame] | 545 | # -tud - Use this for running the DEFAULT suite of tests in UI sanity docker after all other dockers have been deployed |
| 546 | -tud ) |
| 547 | UI_SUITE="onapUiSanity"; |
| 548 | RUN_UI_TESTS=true; |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 549 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 550 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 551 | # -d | --docker - The init specified docker |
| 552 | -d | --docker ) |
| 553 | shift 1 ; |
| 554 | DOCKER=$1; |
| 555 | shift 1 ;; |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 556 | # -sim | --simulator run the simulator |
| 557 | -sim | --simulator ) |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 558 | RUN_SIMULATOR=true; |
| 559 | shift 1 ;; |
Michael Lando | dc856bb | 2018-08-13 13:27:52 +0300 | [diff] [blame] | 560 | # -sim | --simulator run the simulator |
| 561 | -u | --fe_url ) |
kaihlavi | b237271 | 2019-05-27 16:28:23 +0300 | [diff] [blame] | 562 | shift 1 ; |
| 563 | FE_URL=$1; |
| 564 | shift 1 ;; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 565 | |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 566 | # -h | --help - Display the help message with all the available run options |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 567 | -h | --help ) |
| 568 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 569 | exit ${SUCCESS};; |
| 570 | |
Yuli Shlosberg | 0566f58 | 2017-11-26 19:05:23 +0200 | [diff] [blame] | 571 | * ) |
| 572 | usage; |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 573 | exit ${FAILURE};; |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 574 | esac |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 575 | done |
| 576 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 577 | |
liang ding | d73c287 | 2018-09-27 19:07:02 -0700 | [diff] [blame] | 578 | #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] | 579 | [ -f ${WORKSPACE}/opt/config/env_name.txt ] && DEP_ENV=$(cat ${WORKSPACE}/opt/config/env_name.txt) || echo ${DEP_ENV} |
| 580 | [ -f ${WORKSPACE}/opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat ${WORKSPACE}/opt/config/nexus_username.txt) || NEXUS_USERNAME=release |
| 581 | [ -f ${WORKSPACE}/opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat ${WORKSPACE}/opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW |
| 582 | [ -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} |
| 583 | [ -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] | 584 | |
Areli, Fuss (af732p) | 062d4c1 | 2018-06-03 18:49:19 +0300 | [diff] [blame] | 585 | |
Yuli Shlosberg | d1bb2e5 | 2018-01-15 11:51:21 +0200 | [diff] [blame] | 586 | export IP=`ip route get 8.8.8.8 | awk '/src/{ print $7 }'` |
dekstroza | 8352006 | 2018-05-03 16:47:08 +0100 | [diff] [blame] | 587 | #If OSX, then use this to get IP |
| 588 | if [[ "$OSTYPE" == "darwin"* ]]; then |
| 589 | export IP=$(ipconfig getifaddr en0) |
| 590 | fi |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 591 | export PREFIX=${NEXUS_DOCKER_REPO}'/onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 592 | |
| 593 | if [ ${LOCAL} = true ]; then |
Idan Amit | db3d554 | 2017-12-07 11:33:32 +0200 | [diff] [blame] | 594 | PREFIX='onap' |
Idan Amit | c7f57ec | 2017-08-31 14:26:21 +0300 | [diff] [blame] | 595 | fi |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 596 | |
| 597 | echo "" |
| 598 | |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 599 | if [ -z "${DOCKER}" ]; then |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 600 | cleanup all |
| 601 | dir_perms |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 602 | sdc-cs |
| 603 | sdc-cs-init |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 604 | sdc-cs-onboard-init |
| 605 | sdc-onboard-BE |
| 606 | sdc-BE |
| 607 | sdc-BE-init |
| 608 | sdc-FE |
| 609 | healthCheck |
| 610 | sdc-sim |
| 611 | sdc-api-tests |
| 612 | sdc-ui-tests |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 613 | else |
k.kedron | 3643cc5 | 2019-08-28 15:01:51 +0200 | [diff] [blame] | 614 | cleanup ${DOCKER} |
| 615 | dir_perms |
| 616 | ${DOCKER} |
| 617 | healthCheck |
Yuli Shlosberg | 958c32d | 2018-02-15 12:04:46 +0200 | [diff] [blame] | 618 | fi |