2 #############################################################################
4 # Copyright (c) 2018 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 NETWORK="config_default"
22 echo "Cleaning up any previously deployed cludify manager and registrator"
23 docker stop registrator cloudify-manager
24 docker rm registrator cloudify-manager
26 echo "Launching registrator on dockerhost"
28 --network=${NETWORK} \
30 -e EXTERNAL_IP={{ dcae_ip_addr }} \
31 -e CONSUL_HOST=consul \
32 -v /var/run/docker.sock:/tmp/docker.sock \
33 onapdcae/registrator:v7
38 rm -rf scripts-in-container
39 mkdir scripts-in-container
40 cat > scripts-in-container/install-plugins.sh << EOL
42 source /cfy42/bin/activate
43 pip install pip==9.0.3
44 cfy profiles use 127.0.0.1 -u admin -p admin -t default_tenant
47 ./build-plugins.sh https://nexus.onap.org/service/local/repositories/raw/content/org.onap.dcaegen2.platform.plugins/R4 https://nexus.onap.org/service/local/repositories/raw/content/org.onap.ccsdk.platform.plugins/releases
48 for wagon in ./wagons/*.wgn; do cfy plugins upload \$wagon ; done
52 #wget -O scripts-in-container/build-plugins.sh https://git.onap.org/dcaegen2/deployments/plain/k8s-bootstrap-container/build-plugins.sh
53 cat > scripts-in-container/build-plugins.sh << EOL
56 # Pull plugin archives from repos
58 # $1 is the DCAE repo URL
59 # $2 is the CCSDK repo URL
60 # (This script runs at Docker image build time)
65 # For DCAE, we get zips of the archives and build wagons
68 relationshipplugin/1.0.0/relationshipplugin-1.0.0.tgz
69 dcaepolicyplugin/2.3.0/dcaepolicyplugin-2.3.0.tgz
70 dockerplugin/3.2.1/dockerplugin-3.2.1.tgz \
73 # For CCSDK, we pull down the wagon files directly
76 plugins/pgaas-1.1.0-py27-none-any.wgn
77 plugins/sshkeyshare-1.0.0-py27-none-any.wgn
80 # Build a set of wagon files from archives in a repo
82 # $2 -- list of paths to archive files in the repo
86 # Could just do wagon create with the archive URL as source,
87 # but can't use a requirements file with that approach
89 target=$(basename ${plugin})
90 curl -Ss $1/${plugin} > ${target}
91 tar zxvf ${target} --strip-components=2 -C work
92 wagon create -t tar.gz -o ${DEST} -r work/requirements.txt --validate ./work
97 # Copy a set of wagons from a repo
99 # $2 -- list of paths to wagons in the repo
100 function get_wagons {
103 target=$(basename ${wagon})
104 curl -Ss $1/${wagon} > ${DEST}/${target}
109 build $1 "${DCAEPLUGINFILES}"
110 get_wagons $2 "${CCSDKPLUGINFILES}"
113 chmod 777 scripts-in-container/*
115 echo "Launching Cloudify Manager container"
117 --network="${NETWORK}" \
118 --name cloudify-manager \
119 --restart unless-stopped \
120 -v /sys/fs/cgroup:/sys/fs/cgroup:ro \
121 -v /opt/app/config/scripts-in-container:/tmp/bin \
125 --security-opt seccomp:unconfined \
126 --cap-add SYS_ADMIN \
127 --label "SERVICE_80_NAME=cloudify_manager" \
128 --label "SERVICE_80_CHECK_TCP=true" \
129 --label "SERVICE_80_CHECK_INTERVAL=15s" \
130 --label "SERVICE_80_CHECK_INITIAL_STATUS=passing" \
131 {{ nexus_docker_repo }}/onap/org.onap.dcaegen2.deployments.cm-container:{{ dcae_docker_cm }}
133 echo "Cloudify Manager deployed, waiting for completion"
134 while ! nc -z localhost 80; do sleep 1; done
136 echo "Upload plugins to Cloudify Manager"
138 # run as detached because this script is intended to be run in background
139 docker exec -itd cloudify-manager /tmp/bin/install-plugins.sh
141 echo "Cloudify Manager setup complete"