blob: b056ca1137e7f92f4397a5f1933598639c5f1ca4 [file] [log] [blame]
Lusheng Jic38ca2f2017-09-11 20:11:29 +00001#!/bin/bash
2#
3# ============LICENSE_START==========================================
4# ===================================================================
5# Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6# ===================================================================
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ============LICENSE_END============================================
19#
20# ECOMP and OpenECOMP are trademarks
21# and service marks of AT&T Intellectual Property.
22#
23
24# URLs for artifacts needed for installation
25DESIGTYPES={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/dnsdesig/dns_types.yaml
26DESIGPLUG={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/dnsdesig-1.0.0-py27-none-any.wgn
27SSHKEYTYPES={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/type_files/sshkeyshare/sshkey_types.yaml
28SSHKEYPLUG={{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/sshkeyshare-1.0.0-py27-none-any.wgn
29OSPLUGINZIP=https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/1.4.zip
Lusheng Jid92d4482017-09-21 05:42:28 +000030OSPLUGINWGN=https://github.com/cloudify-cosmo/cloudify-openstack-plugin/releases/download/2.2.0/cloudify_openstack_plugin-2.2.0-py27-none-linux_x86_64-centos-Core.wgn
31
Jack Lucasa3ff3762017-10-14 00:24:19 +000032PLATBPSRC={{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases }}/blueprints
33DOCKERBP=DockerBP.yaml
34CBSBP=config_binding_service.yaml
Jack Lucas53322ff2017-11-01 19:25:06 +000035PGBP=pgaas-onevm.yaml
Jack Lucasa3ff3762017-10-14 00:24:19 +000036CDAPBP=cdapbp7.yaml
37CDAPBROKERBP=cdap_broker.yaml
38INVBP=inventory.yaml
39DHBP=DeploymentHandler.yaml
40PHBP=policy_handler.yaml
Jack Lucas53322ff2017-11-01 19:25:06 +000041VESBP=ves.yaml
42TCABP=tca.yaml
43HRULESBP=holmes-rules.yaml
44HENGINEBP=holmes-engine.yaml
Jack Lucasa3ff3762017-10-14 00:24:19 +000045
46DOCKERBPURL="${PLATBPSRC}/${DOCKERBP}"
47CBSBPURL="${PLATBPSRC}/${CBSBP}"
Jack Lucas53322ff2017-11-01 19:25:06 +000048PGBPURL=${PLATBPSRC}/${PGBP}
Jack Lucasa3ff3762017-10-14 00:24:19 +000049CDAPBPURL="${PLATBPSRC}/${CDAPBP}"
50CDAPBROKERBPURL="${PLATBPSRC}/${CDAPBROKERBP}"
51INVBPURL="${PLATBPSRC}/${INVBP}"
52DHBPURL="${PLATBPSRC}/${DHBP}"
53PHBPURL="${PLATBPSRC}/${PHBP}"
Jack Lucas53322ff2017-11-01 19:25:06 +000054VESBPURL="${PLATBPSRC}/${VESBP}"
55TCABPURL="${PLATBPSRC}/${TCABP}"
56HRULESBPURL="${PLATBPSRC}/${HRULESBP}"
57HENGINEBPURL="${PLATBPSRC}/${HENGINEBP}"
Jack Lucasa3ff3762017-10-14 00:24:19 +000058
59LOCATIONID=$(printenv LOCATION)
Lusheng Jic38ca2f2017-09-11 20:11:29 +000060
61# Make sure ssh doesn't prompt for new host or choke on a new host with an IP it's seen before
62SSHOPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
63STARTDIR=$(pwd)
64
Lusheng Ji10388fd2017-10-20 16:14:38 -040065# clear out files for writing out floating IP addresses
66rm -f "$STARTDIR"/config/runtime.ip.consul
67rm -f "$STARTDIR"/config/runtime.ip.cm
68
69
Lusheng Jic38ca2f2017-09-11 20:11:29 +000070SSHUSER=centos
71PVTKEY=./config/key
72INPUTS=./config/inputs.yaml
73
Lusheng Jid92d4482017-09-21 05:42:28 +000074if [ "$LOCATION" = "" ]
Lusheng Jic38ca2f2017-09-11 20:11:29 +000075then
76 echo 'Environment variable LOCATION not set. Should be set to location ID for this installation.'
77 exit 1
78fi
79
80set -e
81set -x
82
83# Docker workaround for SSH key
84# In order for the container to be able to access the key when it's mounted from the Docker host,
85# the key file has to be world-readable. But ssh itself will not work with a private key that's world readable.
86# So we make a copy and change permissions on the copy.
87# NB -- the key on the Docker host has to be world-readable, which means that, from the host machine, you
88# can't use it with ssh. It needs to be a world-readable COPY.
89PVTKEY=./key600
90cp ./config/key ${PVTKEY}
91chmod 600 ${PVTKEY}
92
93# Create a virtual environment
94virtualenv dcaeinstall
95source dcaeinstall/bin/activate
96
97# Install Cloudify
98pip install cloudify==3.4.0
99
100# Install the Cloudify OpenStack plugin
101wget -qO- ${OSPLUGINZIP} > openstack.zip
102pip install openstack.zip
103
104# Spin up a VM
105
106# Get the Designate and SSH key type files and plugins
107mkdir types
108wget -qO- ${DESIGTYPES} > types/dns_types.yaml
109wget -qO- ${SSHKEYTYPES} > types/sshkey_types.yaml
110
111wget -O dnsdesig.wgn ${DESIGPLUG}
112wget -O sshkeyshare.wgn ${SSHKEYPLUG}
113
114wagon install -s dnsdesig.wgn
115wagon install -s sshkeyshare.wgn
116
117## Fix up the inputs file to get the private key locally
118sed -e "s#key_filename:.*#key_filename: $PVTKEY#" < ${INPUTS} > /tmp/local_inputs
119
120# Now install the VM
121# Don't exit on error after this point--keep container running so we can do uninstalls after a failure
122set +e
Lusheng Ji557c2cd2017-10-25 13:36:54 -0400123if wget -O /tmp/centos_vm.yaml {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases }}/blueprints/centos_vm.yaml; then
124 mv -f /tmp/centos_vm.yaml ./blueprints/
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000125 echo "Succeeded in getting the newest centos_vm.yaml"
126else
127 echo "Failed to update centos_vm.yaml, using default version"
Lusheng Ji557c2cd2017-10-25 13:36:54 -0400128 rm -f /tmp/centos_vm.yaml
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000129fi
130set -e
131cfy local init --install-plugins -p ./blueprints/centos_vm.yaml -i /tmp/local_inputs -i "datacenter=$LOCATION"
132cfy local execute -w install --task-retries=10
133PUBIP=$(cfy local outputs | grep -Po '"public_ip": "\K.*?(?=")')
134
Lusheng Ji3e6e3ad2017-11-20 14:06:52 -0500135# wait till the cloudify manager's sshd ready
136while ! nc -z -v -w5 ${PUBIP} 22; do echo "."; done
Lusheng Ji557c2cd2017-10-25 13:36:54 -0400137sleep 10
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000138
139echo "Installing Cloudify Manager on ${PUBIP}."
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000140PVTIP=$(ssh $SSHOPTS -i "$PVTKEY" "$SSHUSER"@"$PUBIP" 'echo PVTIP=`curl --silent http://169.254.169.254/2009-04-04/meta-data/local-ipv4`' | grep PVTIP | sed 's/PVTIP=//')
141if [ "$PVTIP" = "" ]
142then
Lusheng Ji3e6e3ad2017-11-20 14:06:52 -0500143 echo Cannot access specified machine at $PUBIP using supplied credentials
144 exit
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000145fi
146
147
148# Copy private key onto Cloudify Manager VM
149PVTKEYPATH=$(cat ${INPUTS} | grep "key_filename" | cut -d "'" -f2)
150PVTKEYNAME=$(basename $PVTKEYPATH)
151PVTKEYDIR=$(dirname $PVTKEYPATH)
152scp $SSHOPTS -i $PVTKEY $PVTKEY $SSHUSER@$PUBIP:/tmp/$PVTKEYNAME
153ssh -t $SSHOPTS -i $PVTKEY $SSHUSER@$PUBIP sudo mkdir -p $PVTKEYDIR
154ssh -t $SSHOPTS -i $PVTKEY $SSHUSER@$PUBIP sudo mv /tmp/$PVTKEYNAME $PVTKEYPATH
155
156ESMAGIC=$(uuidgen -r)
157WORKDIR=$HOME/cmtmp
158BSDIR=$WORKDIR/cmbootstrap
159PVTKEY2=$BSDIR/id_rsa.cfybootstrap
160TMPBASE=$WORKDIR/tmp
161TMPDIR=$TMPBASE/lib
162SRCS=$WORKDIR/srcs.tar
163TOOL=$WORKDIR/tool.py
164rm -rf $WORKDIR
165mkdir -p $BSDIR $TMPDIR/cloudify/wheels $TMPDIR/cloudify/sources $TMPDIR/manager
166chmod 700 $WORKDIR
167cp "$PVTKEY" $PVTKEY2
168cat >$TOOL <<!EOF
169#!/usr/local/bin/python
170#
171import yaml
172import sys
173bsdir = sys.argv[1]
174with open(bsdir + '/simple-manager-blueprint-inputs.yaml', 'r') as f:
175 inpyaml = yaml.load(f)
176with open(bsdir + '/simple-manager-blueprint.yaml', 'r') as f:
177 bpyaml = yaml.load(f)
178for param, value in bpyaml['inputs'].items():
179 if value.has_key('default') and not inpyaml.has_key(param):
180 inpyaml[param] = value['default']
181print inpyaml['manager_resources_package']
182!EOF
183
184#
185# Try to disable attempt to download virtualenv when not needed
186#
187ssh $SSHOPTS -t -i $PVTKEY2 $SSHUSER@$PUBIP 'sudo bash -xc "echo y; mkdir -p /root/.virtualenv; echo '"'"'[virtualenv]'"'"' >/root/.virtualenv/virtualenv.ini; echo no-download=true >>/root/.virtualenv/virtualenv.ini"'
188
189# Gather installation artifacts
190# from documentation, URL for manager blueprints archive
191BSURL=https://github.com/cloudify-cosmo/cloudify-manager-blueprints/archive/3.4.tar.gz
192BSFILE=$(basename $BSURL)
193
194umask 022
195wget -qO- $BSURL >$BSDIR/$BSFILE
196cd $BSDIR
197tar xzvf $BSFILE
198MRPURL=$(python $TOOL $BSDIR/cloudify-manager-blueprints-3.4)
199MRPFILE=$(basename $MRPURL)
200wget -qO- $MRPURL >$TMPDIR/cloudify/sources/$MRPFILE
201
202tar cf $SRCS -C $TMPDIR cloudify
203rm -rf $TMPBASE
204#
205# Load required package files onto VM
206#
207scp $SSHOPTS -i $PVTKEY2 $SRCS $SSHUSER@$PUBIP:/tmp/.
208ssh -t $SSHOPTS -i $PVTKEY2 $SSHUSER@$PUBIP 'sudo bash -xc "cd /opt; tar xf /tmp/srcs.tar; chown -R root:root /opt/cloudify /opt/manager; rm -rf /tmp/srcs.tar"'
209#
210# Install config file -- was done by DCAE controller. What now?
211#
212ssh $SSHOPTS -t -i $PVTKEY2 $SSHUSER@$PUBIP 'sudo bash -xc '"'"'mkdir -p /opt/dcae; if [ -f /tmp/cfy-config.txt ]; then cp /tmp/cfy-config.txt /opt/dcae/config.txt && chmod 644 /opt/dcae/config.txt; fi'"'"
213cd $WORKDIR
214
215#
216# Check for and set up https certificate information
217#
218rm -f $BSDIR/cloudify-manager-blueprints-3.4/resources/ssl/server.key $BSDIR/cloudify-manager-blueprints-3.4/resources/ssl/server.crt
219ssh -t $SSHOPTS -i $PVTKEY2 $SSHUSER@$PUBIP 'sudo bash -xc "openssl pkcs12 -in /opt/app/dcae-certificate/certificate.pkcs12 -passin file:/opt/app/dcae-certificate/.password -nodes -chain"' | awk 'BEGIN{x="/dev/null";}/-----BEGIN CERTIFICATE-----/{x="'$BSDIR'/cloudify-manager-blueprints-3.4/resources/ssl/server.crt";}/-----BEGIN PRIVATE KEY-----/{x="'$BSDIR'/cloudify-manager-blueprints-3.4/resources/ssl/server.key";}{print >x;}/-----END /{x="/dev/null";}'
220USESSL=false
221if [ -f $BSDIR/cloudify-manager-blueprints-3.4/resources/ssl/server.key -a -f $BSDIR/cloudify-manager-blueprints-3.4/resources/ssl/server.crt ]
222then
223 USESSL=true
224fi
225#
226# Set up configuration for the bootstrap
227#
228export CLOUDIFY_USERNAME=admin CLOUDIFY_PASSWORD=encc0fba9f6d618a1a51935b42342b17658
229cd $BSDIR/cloudify-manager-blueprints-3.4
230cp simple-manager-blueprint.yaml bootstrap-blueprint.yaml
231ed bootstrap-blueprint.yaml <<'!EOF'
232/^node_types:/-1a
233 plugin_resources:
234 description: >
235 Holds any archives that should be uploaded to the manager.
236 default: []
237 dsl_resources:
238 description: >
239 Holds a set of dsl required resources
240 default: []
241.
242/^ upload_resources:/a
243 plugin_resources: { get_input: plugin_resources }
244.
245w
246q
247!EOF
248
249sed <simple-manager-blueprint-inputs.yaml >bootstrap-inputs.yaml \
250 -e "s;.*public_ip: .*;public_ip: '$PUBIP';" \
251 -e "s;.*private_ip: .*;private_ip: '$PVTIP';" \
252 -e "s;.*ssh_user: .*;ssh_user: '$SSHUSER';" \
253 -e "s;.*ssh_key_filename: .*;ssh_key_filename: '$PVTKEY2';" \
254 -e "s;.*elasticsearch_java_opts: .*;elasticsearch_java_opts: '-Des.cluster.name=$ESMAGIC';" \
255 -e "/ssl_enabled: /s/.*/ssl_enabled: $USESSL/" \
256 -e "/security_enabled: /s/.*/security_enabled: $USESSL/" \
257 -e "/admin_password: /s/.*/admin_password: '$CLOUDIFY_PASSWORD'/" \
258 -e "/admin_username: /s/.*/admin_username: '$CLOUDIFY_USERNAME'/" \
259 -e "s;.*manager_resources_package: .*;manager_resources_package: 'http://169.254.169.254/nosuchthing/$MRPFILE';" \
260 -e "s;.*ignore_bootstrap_validations: .*;ignore_bootstrap_validations: true;" \
261
262# Add plugin resources
Jack Lucas1e353cb2017-10-11 21:10:08 +0000263# TODO Maintain plugin list as updates/additions occur
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000264cat >>bootstrap-inputs.yaml <<'!EOF'
265plugin_resources:
266 - 'http://repository.cloudifysource.org/org/cloudify3/wagons/cloudify-openstack-plugin/1.4/cloudify_openstack_plugin-1.4-py27-none-linux_x86_64-centos-Core.wgn'
267 - 'http://repository.cloudifysource.org/org/cloudify3/wagons/cloudify-fabric-plugin/1.4.1/cloudify_fabric_plugin-1.4.1-py27-none-linux_x86_64-centos-Core.wgn'
268 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/dnsdesig-1.0.0-py27-none-any.wgn'
269 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/sshkeyshare-1.0.0-py27-none-any.wgn'
Jack Lucas25745022017-10-20 18:39:00 +0000270 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_ccsdk_platform_plugins_releases }}/plugins/pgaas-1.0.0-py27-none-any.wgn'
Jack Lucas1e353cb2017-10-11 21:10:08 +0000271 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/plugins/cdapcloudify/cdapcloudify-14.2.5-py27-none-any.wgn'
272 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/plugins/dcaepolicyplugin/dcaepolicyplugin-1.0.0-py27-none-any.wgn'
273 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/plugins/dockerplugin/dockerplugin-2.4.0-py27-none-any.wgn'
274 - '{{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_plugins_releases }}/plugins/relationshipplugin/relationshipplugin-1.0.0-py27-none-any.wgn'
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000275!EOF
276#
277# And away we go
278#
279cfy init -r
280cfy bootstrap --install-plugins -p bootstrap-blueprint.yaml -i bootstrap-inputs.yaml
281rm -f resources/ssl/server.key
282
283# Install Consul VM via a blueprint
284cd $STARTDIR
285mkdir consul
286cd consul
287cfy init -r
288cfy use -t ${PUBIP}
289echo "Deploying Consul VM"
290
291set +e
Lusheng Ji557c2cd2017-10-25 13:36:54 -0400292if wget -O /tmp/consul_cluster.yaml {{ ONAPTEMPLATE_RAWREPOURL_org_onap_dcaegen2_platform_blueprints_releases }}/blueprints/consul_cluster.yaml; then
293 mv -f /tmp/consul_cluster.yaml ../blueprints/
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000294 echo "Succeeded in getting the newest consul_cluster.yaml"
295else
296 echo "Failed to update consul_cluster.yaml, using default version"
Lusheng Ji557c2cd2017-10-25 13:36:54 -0400297 rm -f /tmp/consul_cluster.yaml
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000298fi
299set -e
300cfy install -p ../blueprints/consul_cluster.yaml -d consul -i ../${INPUTS} -i "datacenter=$LOCATION"
301
302# Get the floating IP for one member of the cluster
303# Needed for instructing the Consul agent on CM host to join the cluster
304CONSULIP=$(cfy deployments outputs -d consul | grep -Po 'Value: \K.*')
305echo Consul deployed at $CONSULIP
306
307# Wait for Consul API to come up
308until curl http://$CONSULIP:8500/v1/agent/services
309do
310 echo Waiting for Consul API
311 sleep 60
312done
313
314# Wait for a leader to be elected
315until [[ "$(curl -Ss http://$CONSULIP:8500/v1/status/leader)" != '""' ]]
316do
317 echo Waiting for leader
318 sleep 30
319done
320
321# Instruct the client-mode Consul agent running on the CM to join the cluster
322curl http://$PUBIP:8500/v1/agent/join/$CONSULIP
323
324# Register Cloudify Manager in Consul via the local agent on CM host
325
326REGREQ="
327{
328 \"Name\" : \"cloudify_manager\",
329 \"ID\" : \"cloudify_manager\",
330 \"Tags\" : [\"http://${PUBIP}/api/v2.1\"],
331 \"Address\": \"${PUBIP}\",
332 \"Port\": 80,
333 \"Check\" : {
334 \"Name\" : \"cloudify_manager_health\",
335 \"Interval\" : \"300s\",
336 \"HTTP\" : \"http://${PUBIP}/api/v2.1/status\",
337 \"Status\" : \"passing\",
338 \"DeregisterCriticalServiceAfter\" : \"30m\"
339 }
340}
341"
342
343curl -X PUT -H 'Content-Type: application/json' --data-binary "$REGREQ" http://$PUBIP:8500/v1/agent/service/register
344# Make Consul address available to plugins on Cloudify Manager
345# TODO probably not necessary anymore
346ENVINI=$(mktemp)
347cat <<!EOF > $ENVINI
348[$LOCATION]
349CONSUL_HOST=$CONSULIP
350CONFIG_BINDING_SERVICE=config_binding_service
351!EOF
352scp $SSHOPTS -i ../$PVTKEY $ENVINI $SSHUSER@$PUBIP:/tmp/env.ini
353ssh -t $SSHOPTS -i ../$PVTKEY $SSHUSER@$PUBIP sudo mv /tmp/env.ini /opt/env.ini
354rm $ENVINI
355
Jack Lucasa3ff3762017-10-14 00:24:19 +0000356
357##### INSTALLATION OF PLATFORM COMPONENTS
358
359# Get component blueprints
360wget -P ./blueprints/docker/ ${DOCKERBPURL}
361wget -P ./blueprints/cbs/ ${CBSBPURL}
Jack Lucas53322ff2017-11-01 19:25:06 +0000362wget -P ./blueprints/pg/ ${PGBPURL}
Jack Lucasa3ff3762017-10-14 00:24:19 +0000363wget -P ./blueprints/cdap/ ${CDAPBPURL}
364wget -P ./blueprints/cdapbroker/ ${CDAPBROKERBPURL}
365wget -P ./blueprints/inv/ ${INVBPURL}
366wget -P ./blueprints/dh/ ${DHBPURL}
367wget -P ./blueprints/ph/ ${PHBPURL}
Jack Lucas53322ff2017-11-01 19:25:06 +0000368wget -P ./blueprints/ves/ ${VESBPURL}
369wget -P ./blueprints/tca/ ${TCABPURL}
370wget -P ./blueprints/hrules/ ${HRULESBPURL}
371wget -P ./blueprints/hengine/ ${HENGINEBPURL}
Jack Lucasa3ff3762017-10-14 00:24:19 +0000372
373
374# Set up the credentials for access to the Docker registry
375curl -X PUT -H "Content-Type: application/json" --data-binary '[{"username":"docker", "password":"docker", "registry": "nexus3.onap.org:10001"}]' http://${CONSULIP}:8500/v1/kv/docker_plugin/docker_logins
376
377# Install platform Docker host
378# Note we're still in the "consul" directory, which is init'ed for talking to CM
379
380set +e
381# Docker host for platform containers
382cfy install -v -p ./blueprints/docker/${DOCKERBP} -b DockerBP -d DockerPlatform -i ../${INPUTS} -i "registered_dockerhost_name=platform_dockerhost" -i "registrator_image=onapdcae/registrator:v7" -i "location_id=${LOCATION}" -i "node_name=dokp00" -i "target_datacenter=${LOCATION}"
383
384# Docker host for service containers
385cfy deployments create -b DockerBP -d DockerComponent -i ../${INPUTS} -i "registered_dockerhost_name=component_dockerhost" -i "location_id=${LOCATION}" -i "registrator_image=onapdcae/registrator:v7" -i "node_name=doks00" -i "target_datacenter=${LOCATION}"
386cfy executions start -d DockerComponent -w install
387
388# wait for the extended platform VMs settle
389#sleep 180
390
391
392# CDAP cluster
Jack Lucasaa8ed202017-11-01 20:00:55 +0000393cfy install -p ./blueprints/cdap/${CDAPBP} -b cdapbp7 -d cdap7 -i ../config/cdapinputs.yaml -i "location_id=${LOCATION}"
Jack Lucasa3ff3762017-10-14 00:24:19 +0000394
395# config binding service
396cfy install -p ./blueprints/cbs/${CBSBP} -b config_binding_service -d config_binding_service -i "location_id=${LOCATION}"
397
398
Jack Lucas53322ff2017-11-01 19:25:06 +0000399# Postgres
400cfy install -p ./blueprints/pg/${PGBP} -b pgaas -d pgaas -i ../${INPUTS}
401
402
Jack Lucasa3ff3762017-10-14 00:24:19 +0000403# Inventory
404cfy install -p ./blueprints/inv/${INVBP} -b PlatformServicesInventory -d PlatformServicesInventory -i "location_id=${LOCATION}" -i ../config/invinputs.yaml
405
406
407# Deployment Handler DH
408cat >../dhinputs <<EOL
409application_config:
410 cloudify:
411 protocol: "http"
412 inventory:
413 protocol: "http"
414EOL
415cfy install -p ./blueprints/dh/${DHBP} -b DeploymentHandlerBP -d DeploymentHandler -i "location_id=${LOCATION}" -i ../dhinputs
416
417
418# Policy Handler PH
419cfy install -p ./blueprints/ph/${PHBP} -b policy_handler_BP -d policy_handler -i 'policy_handler_image=nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.policy-handler:1.1-latest' -i "location_id=${LOCATION}" -i ../config/phinputs.yaml
420
421
Jack Lucas53b024f2017-10-19 13:36:15 +0000422# Wait for the CDAP cluster to be registered in Consul
423echo "Waiting for CDAP cluster to register"
424until curl -Ss http://${CONSULIP}:8500/v1/catalog/service/cdap | grep cdap
425do
426 echo -n .
427 sleep 30
428done
429echo "CDAP cluster registered"
430
431
Jack Lucasa3ff3762017-10-14 00:24:19 +0000432# CDAP Broker
Jack Lucas53b024f2017-10-19 13:36:15 +0000433cfy install -p ./blueprints/cdapbroker/${CDAPBROKERBP} -b cdapbroker -d cdapbroker -i "location_id=${LOCATION}"
Jack Lucasa3ff3762017-10-14 00:24:19 +0000434
435
Jack Lucas53322ff2017-11-01 19:25:06 +0000436# VES
437cfy install -p ./blueprints/ves/${VESBP} -b ves -d ves -i ../config/vesinput.yaml
438
439
440# TCA
441cfy install -p ./blueprints/tca/${TCABP} -b tca -d tca -i ../config/tcainputs.yaml
442
443# Holmes
444cfy install -p ./blueprints/hrules/${HRULESBP} -b hrules -d hrules -i ../config/hr-ip.yaml
445cfy install -p ./blueprints/hengine/${HENGINEBP} -b hengine -d hengine -i ../config/he-ip.yaml
446
447
Lusheng Ji10388fd2017-10-20 16:14:38 -0400448# write out IP addresses
449echo "$CONSULIP" > "$STARTDIR"/config/runtime.ip.consul
450echo "$PUBIP" > "$STARTDIR"/config/runtime.ip.cm
451
452
Jack Lucasa3ff3762017-10-14 00:24:19 +0000453# Keep the container up
Lusheng Jic37f51b2017-10-15 22:17:30 -0400454rm -f /tmp/ready_to_exit
455while [ ! -e /tmp/ready_to_exit ]
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000456do
Lusheng Jic37f51b2017-10-15 22:17:30 -0400457 sleep 30
Lusheng Jic38ca2f2017-09-11 20:11:29 +0000458done