2 #############################################################################
4 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 #############################################################################
20 # prepare a curl command
21 # parameters: URL METHOD CURLOPTIONS EXTRA_HEADERS_AS_A_STRING AUTH_AS_USER:PASS DATA
22 assemble_curl_command()
26 local CURLOPTIONS="$3"
27 local EXTRA_HEADERS="$4"
31 if [ ! -z "$METHOD" ]; then
32 CMD="curl $CURLOPTIONS $METHOD"
34 CMD="curl $CURLOPTIONS -X GET"
36 if [ ! -z "$EXTRA_HEADERS" ]; then
37 CMD="$CMD $EXTRA_HEADERS"
39 if [ ! -z "$AUTH" ]; then
42 if [ ! -z "$DATA" ]; then
50 # Make a rest API call
51 # parameters: URL METHOD expected_response_code EXTRA_HEADERS_AS_A_STRING AUTH_AS_USER:PASS DATA
52 call_api_for_response_code()
54 local CURLOPTIONS='-kIso /dev/null -w "%{http_code}"'
56 $(assemble_curl_command "$1" "$2" "$CURLOPTIONS" "$4" "$5" "$6")
60 call_api_for_response_body()
62 local CURLOPTIONS='-ksb'
64 $(assemble_curl_command "$1" "$2" "$CURLOPTIONS" "$4" "$5" "$6")
68 call_api_for_response_header()
70 local CURLOPTIONS='-ks -o /dev/null -D -'
72 $(assemble_curl_command "$1" "$2" "$CURLOPTIONS" "$4" "$5" "$6")
76 call_api_for_verbose()
78 local CURLOPTIONS='-kIv'
80 $(assemble_curl_command "$1" "$2" "$CURLOPTIONS" "$4" "$5" "$6")
83 #local TFILE=$(mktemp /tmp/curlcmd.XXXXXXXXX)
90 # Wait till a web service API return specified response code
91 # parameters: URL METHOD EXPECTED_RESP_CODE EXTRA_HEADERS_AS_A_STRING AUTH_AS_USER:PASS DATA
96 ACTUALRESP=$(call_api_for_response_code "$1" "$2" "$3" "$4" "$5" "$6")
97 while [ "$ACTUALRESP" != "$RESP" ]; do
98 echo "RESP CODE $ACTUALRESP, not as expected RESP CODE $RESP @ $(date)."
100 ACTUALRESP=$(call_api_for_response_code "$1" "$2" "$3" "$4" "$5" "$6")
102 echo "RESP CODE $ACTUALRESP, matches with expected RESP CODE $RESP."
105 # Wait till a TCP port is open
106 # parameters: HOST PORT
111 while ! nc -z -w 1 "$DEST" "$PORT"; do
122 # wait till A&AI up and ready
124 AAIHOST=$(cat /opt/config/aai1_ip_addr.txt)
125 local AAIURL="https://$AAIHOST:8443/aai/v11/examples/cloud-regions"
126 local AAIMETHOD='-X GET'
128 local AAIHEADERS='-H "X-FromAppId: AAI-Temp-Tool" -H "X-TransactionId: AAI-Temp-Tool" -H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
129 local AAIAUTH='-u AAI:AAI'
131 echo "===> Waiting for A&AI to get ready for getting $AAIRESP from $AAIURL @ $(date)"
132 wait_for_api "$AAIURL" "$AAIMETHOD" "$AAIRESP" "$AAIHEADERS" "$AAIAUTH" "$AAIDATA"
133 echo "===> A&AI ready @ $(date)"
138 wait_for_multicloud_ready()
140 # wait till MultiCloud up and ready
142 MCHOST=$(cat /opt/config/openo_ip_addr.txt)
143 local MCURL="http://$MCHOST:9005/api/multicloud-titanium_cloud/v0/swagger.json"
144 local MCMETHOD='-X GET'
146 local MCHEADERS='-H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
149 echo "===> Waiting for MultiCloud to get ready for getting $MCRESP from $MCURL @ $(date)"
150 wait_for_api "$MCURL" "$MCMETHOD" "$MCRESP" "$MCHEADERS" "$MCAUTH" "$MCDATA"
151 echo "===> MultiCloud ready @ $(date)"
154 register_multicloud_pod25dns_with_aai()
156 # Register MultiCloud with A&AI
157 local CLOUD_OWNER='pod25dns'
158 local CLOUD_VERSION='titanium_cloud'
161 local CLOUD_IDENTITY_URL
162 local DNSAAS_SERVICE_URL
163 local DNSAAS_USERNAME='demo'
164 local DNSAAS_PASSWORD='onapdemo'
165 local DNSAAS_TENANT_ID
167 CLOUD_REGION="$(cat /opt/config/dnsaas_region.txt)"
168 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
169 MCIP="$(cat /opt/config/openo_ip_addr.txt)"
170 CLOUD_IDENTITY_URL="http://${MCIP}/api/multicloud-titanium_cloud/v0/${CLOUD_OWNER}_${CLOUD_REGION}/identity/v2.0"
173 DNSAAS_SERVICE_URL="$(cat /opt/config/dnsaas_keystone_url.txt)"
174 # a tenant of the same name must be set up on the Deisgnate providing OpenStack
175 DNSAAS_TENANT_NAME="$(cat /opt/config/dnsaas_tenant_name.txt)"
176 cat >"/tmp/${CLOUD_OWNER}_${CLOUD_REGION}.json" <<EOL
178 "cloud-owner" : "$CLOUD_OWNER",
179 "cloud-region-id" : "$CLOUD_REGION",
180 "cloud-region-version" : "$CLOUD_VERSION",
181 "cloud-type" : "$CLOUD_ENV",
182 "cloud-zone" : "cloud zone",
183 "complex-name" : "complex name2",
184 "identity-url": "$CLOUD_IDENTITY_URL",
185 "owner-defined-type" : "owner-defined-type",
186 "sriov-automation" : false,
187 "esr-system-info-list" : {
188 "esr-system-info" : [
190 "esr-system-info-id": "532ac032-e996-41f2-84ed-9c7a1766eb30",
191 "cloud-domain": "Default",
192 "default-tenant" : "$DNSAAS_TENANT_NAME",
193 "user-name" : "$DNSAAS_USERNAME",
194 "password" : "$DNSAAS_PASSWORD",
195 "service-url" : "$DNSAAS_SERVICE_URL",
196 "ssl-cacert": "example-ssl-cacert-val-75021",
197 "ssl-insecure": true,
198 "system-name": "example-system-name-val-29071",
199 "system-type": "VIM",
200 "ip-address": "example-ip-address-val-44432",
201 "port": "example-port-val-93235",
202 "type": "example-type-val-85255",
203 "protocal": "example-protocal-val-52954",
204 "vendor": "example-vendor-val-94515",
205 "version": "example-version-val-71880"
215 local REGMETHOD='-X PUT'
216 local REGHEADERS='-H "X-FromAppId: AAI-Temp-Tool" -H "X-TransactionId: AAI-Temp-Tool" -H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
218 local REGAUTH='-u AAI:AAI'
221 REGHOST="$(cat /opt/config/aai1_ip_addr.txt)"
222 REGURL="https://$REGHOST:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION"
223 REGDATA="-T /tmp/${CLOUD_OWNER}_${CLOUD_REGION}.json"
224 echo "Register MultiCloud with A&AI owner $CLOUD_OWNER"
225 RESP=$(call_api_for_response_code "$REGURL" "$REGMETHOD" "$REGRESP" "$REGHEADERS" "$REGAUTH" "$REGDATA")
226 echo "RESP CODE: $RESP"
230 register_multicloud_pod25_with_aai()
232 # Register MultiCloud with A&AI
233 local CLOUD_OWNER='pod25'
234 local CLOUD_VERSION='titanium_cloud'
236 local DNSAAS_CLOUD_REGION
239 local CLOUD_IDENTITY_URL
245 CLOUD_REGION="$(cat /opt/config/openstack_region.txt)"
246 DNSAAS_CLOUD_REGION="$(cat /opt/config/dnsaas_region.txt)"
247 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
248 MCIP="$(cat /opt/config/openo_ip_addr.txt)"
249 CLOUD_IDENTITY_URL="http://${MCIP}/api/multicloud-titanium_cloud/v0/${CLOUD_OWNER}_${CLOUD_REGION}/identity/v2.0"
250 KEYSTONE_URL="$(cat /opt/config/openstack_keystone_url.txt)"
251 if [[ "$KEYSTONE_URL" == */v3 ]]; then
253 elif [[ "$KEYSTONE_URL" == */v2.0 ]]; then
256 KEYSTONE_URL="${KEYSTONE_URL}/v3"
259 USERNAME="$(cat /opt/config/openstack_user.txt)"
260 PASSWORD="$(cat /opt/config/openstack_password.txt)"
261 TENANT_NAME="$(cat /opt/config/tenant_name.txt)"
262 cat >"/tmp/${CLOUD_OWNER}_${CLOUD_REGION}.json" <<EOL
264 "cloud-owner" : "$CLOUD_OWNER",
265 "cloud-region-id" : "$CLOUD_REGION",
266 "cloud-region-version" : "$CLOUD_VERSION",
267 "cloud-type" : "$CLOUD_ENV",
268 "cloud-zone" : "cloud zone",
269 "complex-name" : "complex name",
270 "identity-url": "$CLOUD_IDENTITY_URL",
271 "owner-defined-type" : "owner-defined-type",
272 "sriov-automation" : false,
273 "cloud-extra-info" : "{\"epa-caps\":{\"huge_page\":\"true\",\"cpu_pinning\":\"true\",\"cpu_thread_policy\":\"true\",\"numa_aware\":\"true\",\"sriov\":\"true\",\"dpdk_vswitch\":\"true\",\"rdt\":\"false\",\"numa_locality_pci\":\"true\"},\"dns-delegate\":{\"cloud-owner\":\"pod25dns\",\"cloud-region-id\":\"${DNSAAS_CLOUD_REGION}\"}}",
274 "esr-system-info-list" : {
275 "esr-system-info" : [
277 "esr-system-info-id": "432ac032-e996-41f2-84ed-9c7a1766eb29",
278 "cloud-domain": "Default",
279 "default-tenant" : "$TENANT_NAME",
280 "user-name" : "$USERNAME",
281 "password" : "$PASSWORD",
282 "service-url" : "$KEYSTONE_URL",
283 "ssl-cacert": "example-ssl-cacert-val-75021",
284 "ssl-insecure": true,
285 "system-name": "example-system-name-val-29070",
286 "system-type": "VIM",
287 "ip-address": "example-ip-address-val-44431",
288 "port": "example-port-val-93234",
289 "type": "example-type-val-85254",
290 "protocal": "example-protocal-val-52954",
291 "vendor": "example-vendor-val-94515",
292 "version": "example-version-val-71880"
301 local REGMETHOD='-X PUT'
302 local REGHEADERS='-H "X-FromAppId: AAI-Temp-Tool" -H "X-TransactionId: AAI-Temp-Tool" -H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
304 local REGAUTH='-u AAI:AAI'
307 REGHOST="$(cat /opt/config/aai1_ip_addr.txt)"
308 REGURL="https://$REGHOST:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$CLOUD_OWNER/$CLOUD_REGION"
309 REGDATA="-T /tmp/${CLOUD_OWNER}_${CLOUD_REGION}.json"
310 echo "Register MultiCloud with A&AI owner $CLOUD_OWNER"
311 RESP=$(call_api_for_response_code "$REGURL" "$REGMETHOD" "$REGRESP" "$REGHEADERS" "$REGAUTH" "$REGDATA")
312 echo "RESP CODE: $RESP"
317 verify_multicloud_registration()
319 local CLOUD_OWNER='pod25'
321 local CLOUD_VERSION='titanium_cloud'
325 local REGMETHOD='-X GET'
326 local REGHEADERS='-H "X-FromAppId: AAI-Temp-Tool" -H "X-TransactionId: AAI-Temp-Tool" -H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
328 local REGAUTH='-u AAI:AAI'
332 CLOUD_REGION="$(cat /opt/config/openstack_region.txt)"
333 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
334 REGHOST="$(cat /opt/config/aai1_ip_addr.txt)"
336 REGURL="https://$REGHOST:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/${CLOUD_OWNER}/${CLOUD_REGION}?depth=all"
337 # Verify MultiCloud with A&AI
338 RESPCODE=$(call_api_for_response_code "$REGURL" "$REGMETHOD" "$REGRESP" "$REGHEADERS" "$REGAUTH" "$REGDATA")
339 echo "Register MultiCloud with A&AI owner $CLOUD_OWNER verify response code: $RESPCODE"
341 CLOUD_OWNER='pod25dns'
342 REGURL="https://$REGHOST:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/${CLOUD_OWNER}/${CLOUD_REGION}?depth=all"
343 RESPCODE=$(call_api_for_response_code "$REGURL" "$REGMETHOD" "$REGRESP" "$REGHEADERS" "$REGAUTH" "$REGDATA")
344 echo "Register MultiCloud with A&AI owner $CLOUD_OWNER verify response code: $RESPCODE"
350 local CLOUD_OWNER='pod25'
352 local CLOUD_VERSION='titanium_cloud'
355 local DNSAAS_TENANT_NAME
358 local MCMETHOD='-X POST'
360 local MCHEADERS='-H "Content-Type: application/json" -H "Accept: application/json"'
364 ## export endpoint prefix
365 local MULTICLOUD_PLUGIN_ENDPOINT
367 CLOUD_REGION="$(cat /opt/config/openstack_region.txt)"
368 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
369 if [ -z "$1" ]; then DCAE_ZONE="$(cat /opt/config/dcae_zone.txt)"; else DCAE_ZONE="$1"; fi
370 DNSAAS_TENANT_NAME="$(cat /opt/config/dnsaas_tenant_name.txt)"
371 MCHOST=$(cat /opt/config/openo_ip_addr.txt)
372 MCURL="http://$MCHOST:9005/api/multicloud-titanium_cloud/v0/swagger.json"
374 MCDATA='-d "{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}"'
375 MULTICLOUD_PLUGIN_ENDPOINT=http://${MCHOST}/api/multicloud-titanium_cloud/v0/${CLOUD_OWNER}_${CLOUD_REGION}
378 # because all VM's use 10.0.100.1 as their first DNS server, the designate DNS server as seocnd, we need to use a
379 # domain outside of the first DNS server's domain
381 ZONENAME="${DCAE_ZONE}.dcaeg2.simpledemo.onap.org."
383 echo "===> Register DNS zone $ZONENAME under $DNSAAS_TENANT_NAME"
389 MCURL="${MULTICLOUD_PLUGIN_ENDPOINT}/identity/v3/auth/tokens"
390 echo "=====> Getting token from $MCURL"
391 #TOKEN=$(call_api_for_response_header "$MCURL" "$MCMETHOD" "$MCRESP" "$MCHEADERS" "$MCAUTH" "$MCDATA" | grep 'X-Subject-Token' | sed "s/^.*: //")
392 TOKEN=$(curl -v -s -H "Content-Type: application/json" -X POST -d "{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}" "${MCURL}" 2>&1 | grep X-Subject-Token | sed "s/^.*: //")
393 echo "Received Keystone token $TOKEN from $MCURL"
394 if [ -z "$TOKEN" ]; then
395 echo "Faile to acquire token for creating DNS zone. Exit"
400 echo "=====> Get current zone listing"
401 curl -sv -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones"
404 echo "=====> Creating zone $ZONENAME"
405 curl -sv -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X POST -d "{ \"name\": \"$ZONENAME\", \"email\": \"lji@research.att.com\"}" "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones"
407 ### query the zone with zone name
408 echo "=====> Querying zone $ZONENAME"
409 curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones?name=${ZONENAME}"
413 ZONEID=$(curl -v -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones?name=${ZONENAME}" |sed 's/^.*"id":"\([a-zA-Z0-9-]*\)",.*$/\1/')
414 echo "=====> After creation, zone $ZONENAME ID is $ZONEID"
416 ### query the zone with zone id
417 echo "=====> Querying zone $ZONENAME by ID $ZONEID"
418 curl -sv -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones/${ZONEID}"
424 local CLOUD_OWNER='pod25'
426 local CLOUD_VERSION='titanium_cloud'
429 local DNSAAS_TENANT_NAME
432 local MCMETHOD='-X GET'
434 local MCHEADERS='-H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
437 local MULTICLOUD_PLUGIN_ENDPOINT
439 CLOUD_REGION="$(cat /opt/config/openstack_region.txt)"
440 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
441 DCAE_ZONE="$(cat /opt/config/dcae_zone.txt)"
442 DNSAAS_TENANT_NAME="$(cat /opt/config/dnsaas_tenant_name.txt)"
443 MCHOST=$(cat /opt/config/openo_ip_addr.txt)
444 MCURL="http://$MCHOST:9005/api/multicloud-titanium_cloud/v0/swagger.json"
446 MCDATA='"{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}"'
447 MULTICLOUD_PLUGIN_ENDPOINT=http://${MCHOST}/api/multicloud-titanium_cloud/v0/${CLOUD_OWNER}_${CLOUD_REGION}
451 TOKEN=$(curl -v -s -H "Content-Type: application/json" -X POST -d "{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}" "${MULTICLOUD_PLUGIN_ENDPOINT}/identity/v3/auth/tokens" 2>&1 | grep X-Subject-Token | sed "s/^.*: //")
454 ZONENAME="$1.dcaeg2.simpledemo.onap.org."
456 ZONEID=$(curl -v -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones?name=${ZONENAME}" |sed 's/^.*"id":"\([a-zA-Z0-9-]*\)",.*$/\1/')
458 curl -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X DELETE "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones/${ZONEID}"
463 local CLOUD_OWNER='pod25'
465 local CLOUD_VERSION='titanium_cloud'
468 local DNSAAS_TENANT_NAME
471 local MCMETHOD='-X GET'
473 local MCHEADERS='-H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"'
476 local MULTICLOUD_PLUGIN_ENDPOINT
478 CLOUD_REGION="$(cat /opt/config/openstack_region.txt)"
479 CLOUD_ENV="$(cat /opt/config/cloud_env.txt)"
480 DCAE_ZONE="$(cat /opt/config/dcae_zone.txt)"
481 DNSAAS_TENANT_NAME="$(cat /opt/config/dnsaas_tenant_name.txt)"
482 MCHOST=$(cat /opt/config/openo_ip_addr.txt)
483 MCURL="http://$MCHOST:9005/api/multicloud-titanium_cloud/v0/swagger.json"
485 MCDATA='"{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}"'
486 MULTICLOUD_PLUGIN_ENDPOINT=http://${MCHOST}/api/multicloud-titanium_cloud/v0/${CLOUD_OWNER}_${CLOUD_REGION}
490 TOKEN=$(curl -v -s -H "Content-Type: application/json" -X POST -d "{\"auth\":{\"tenantName\": \"${DNSAAS_TENANT_NAME}\"}}" "${MULTICLOUD_PLUGIN_ENDPOINT}/identity/v3/auth/tokens" 2>&1 | grep X-Subject-Token | sed "s/^.*: //")
493 ZONENAME="$1.dcaeg2.simpledemo.onap.org."
495 ZONEID=$(curl -v -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones?name=${ZONENAME}" |sed 's/^.*"id":"\([a-zA-Z0-9-]*\)",.*$/\1/')
497 curl -v -s -H "Content-Type: application/json" -H "X-Auth-Token: $TOKEN" -X GET "${MULTICLOUD_PLUGIN_ENDPOINT}/dns-delegate/v2/zones/${ZONEID}/recordsets"
504 NEXUS_USER=$(cat /opt/config/nexus_username.txt)
505 NEXUS_PASSWORD=$(cat /opt/config/nexus_password.txt)
506 NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
507 DOCKER_VERSION=$(cat /opt/config/docker_version.txt)
508 # use rand_str as zone
509 ZONE=$(cat /opt/config/rand_str.txt)
510 MYFLOATIP=$(cat /opt/config/dcae_float_ip.txt)
511 MYLOCALIP=$(cat /opt/config/dcae_ip_addr.txt)
514 docker login -u "$NEXUS_USER" -p "$NEXUS_PASSWORD" "$NEXUS_DOCKER_REPO"
515 docker pull "$NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION" && docker pull nginx &
517 #########################################
518 # Wait for then register with A&AI
519 ########################################
521 DNSAAS_PROXYED=$(tr '[:upper:]' '[:lower:]' < /opt/config/dnsaas_config_enabled.txt)
522 if [ "$DNSAAS_PROXYED" == 'true' ]; then
523 echo "Using proxyed DNSaaS service, performing additional registration and configuration"
526 register_multicloud_pod25_with_aai
527 register_multicloud_pod25dns_with_aai
529 verify_multicloud_registration
531 wait_for_multicloud_ready
532 register_dns_zone "$ZONE"
533 echo "Registration and configuration for proxying DNSaaS completed."
535 echo "Using proxyed DNSaaS service, performing additional registration and configuration"
542 #########################################
543 # Start DCAE Bootstrap container
544 #########################################
546 chmod 777 /opt/app/config
547 rm -f /opt/config/runtime.ip.consul
548 rm -f /opt/config/runtime.ip.cm
551 docker login -u "$NEXUS_USER" -p "$NEXUS_PASSWORD" "$NEXUS_DOCKER_REPO"
552 docker pull "$NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION"
553 docker run -d --name boot -v /opt/app/config:/opt/app/installer/config -e "LOCATION=$ZONE" "$NEXUS_DOCKER_REPO/onap/org.onap.dcaegen2.deployments.bootstrap:$DOCKER_VERSION"
556 # waiting for bootstrap to complete then starting nginx for proxying healthcheck calls
557 echo "Waiting for Consul to become accessible"
558 while [ ! -f /opt/app/config/runtime.ip.consul ]; do echo "."; sleep 30; done
562 # start proxy for consul's health check
563 CONSULIP=$(head -1 /opt/app/config/runtime.ip.consul | sed 's/[[:space:]]//g')
564 echo "Consul is available at $CONSULIP"
566 cat >./nginx.conf <<EOL
569 server_name dcae.simpledemo.onap.org;
570 location /healthcheck {
571 proxy_pass http://${CONSULIP}:8500/v1/health/state/passing;
575 docker run --name dcae-proxy -p 8080:80 -v "$(pwd)/nginx.conf:/etc/nginx/conf.d/default.conf" -d nginx
576 echo "Healthcheck API available at http://${MYFLOATIP}:8080/healthcheck"
577 echo " or http://${MYLOCALIP}:8080/healthcheck"