blob: a51f5ae292ded8cd3eeda01c55299e1395cf2f5d [file] [log] [blame]
Lusheng Ji819aa7f2018-04-16 02:24:39 -04001#!/bin/bash
Lusheng Jibd838e72018-04-16 21:27:17 -04002#############################################################################
3#
4# Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
5#
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
10#
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.
16#
17#############################################################################
Lusheng Ji819aa7f2018-04-16 02:24:39 -040018
19
20NETWORK="config_default"
21
22echo "Cleaning up any previously deployed cludify manager and registrator"
23docker stop registrator cloudify-manager
24docker rm registrator cloudify-manager
25
26echo "Launching registrator on dockerhost"
27docker run -d \
28--network=${NETWORK} \
29--name=registrator \
30-e EXTERNAL_IP={{ dcae_ip_addr }} \
31-e CONSUL_HOST=consul \
32-v /var/run/docker.sock:/tmp/docker.sock \
33onapdcae/registrator:v7
34
Lusheng Jibd838e72018-04-16 21:27:17 -040035
36
37
38rm -rf scripts-in-container
39mkdir scripts-in-container
40cat > scripts-in-container/install-plugins.sh << EOL
41#!/bin/bash
42source /cfy42/bin/activate
43pip install pip==9.0.3
44cfy profiles use 127.0.0.1 -u admin -p admin -t default_tenant
45cfy status
46cd /tmp/bin
47./build-plugins.sh https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R2 https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/releases
48for wagon in ./wagons/*.wgn; do cfy plugins upload \$wagon ; done
49deactivate
50EOL
51
52wget -O scripts-in-container/build-plugins.sh https://git.onap.org/dcaegen2/deployments/plain/k8s-bootstrap-container/build-plugins.sh
53chmod 777 scripts-in-container/*
54
55echo "Launching Cloudify Manager container"
Lusheng Ji819aa7f2018-04-16 02:24:39 -040056docker run -d \
57--network="${NETWORK}" \
58--name cloudify-manager \
59--restart unless-stopped \
60-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
Lusheng Jibd838e72018-04-16 21:27:17 -040061-v /opt/app/config/scripts-in-container:/tmp/bin \
Lusheng Ji819aa7f2018-04-16 02:24:39 -040062-p 80:80 \
63--tmpfs /run \
64--tmpfs /run/lock \
65--security-opt seccomp:unconfined \
66--cap-add SYS_ADMIN \
67--label "SERVICE_80_NAME=cloudify_manager" \
68--label "SERVICE_80_CHECK_TCP=true" \
69--label "SERVICE_80_CHECK_INTERVAL=15s" \
70--label "SERVICE_80_CHECK_INITIAL_STATUS=passing" \
Lusheng Jibd838e72018-04-16 21:27:17 -040071{{ nexus_docker_repo }}/onap/org.onap.dcaegen2.deployments.cm-container:{{ dcae_docker_cm }}
72
73echo "Cloudify Manager deployed, waiting for completion"
Lusheng Ji819aa7f2018-04-16 02:24:39 -040074while ! nc -z localhost 80; do sleep 1; done
75
Lusheng Jibd838e72018-04-16 21:27:17 -040076echo "Upload plugins to Cloudify Manager"
Lusheng Ji819aa7f2018-04-16 02:24:39 -040077
Lusheng Jic5afcd02018-04-17 11:13:03 -040078# run as detached because this script is intended to be run in background
79docker exec -itd cloudify-manager /tmp/bin/install-plugins.sh
Lusheng Ji819aa7f2018-04-16 02:24:39 -040080
Lusheng Jibd838e72018-04-16 21:27:17 -040081echo "Cloudify Manager setup complete"
Lusheng Ji819aa7f2018-04-16 02:24:39 -040082