Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Lusheng Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 2 | ############################################################################# |
| 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 Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 18 | |
| 19 | |
| 20 | NETWORK="config_default" |
| 21 | |
| 22 | echo "Cleaning up any previously deployed cludify manager and registrator" |
| 23 | docker stop registrator cloudify-manager |
| 24 | docker rm registrator cloudify-manager |
| 25 | |
| 26 | echo "Launching registrator on dockerhost" |
| 27 | docker 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 \ |
| 33 | onapdcae/registrator:v7 |
| 34 | |
Lusheng Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 35 | |
| 36 | |
| 37 | |
| 38 | rm -rf scripts-in-container |
| 39 | mkdir scripts-in-container |
| 40 | cat > scripts-in-container/install-plugins.sh << EOL |
| 41 | #!/bin/bash |
| 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 |
| 45 | cfy status |
| 46 | cd /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 |
| 48 | for wagon in ./wagons/*.wgn; do cfy plugins upload \$wagon ; done |
| 49 | deactivate |
| 50 | EOL |
| 51 | |
| 52 | wget -O scripts-in-container/build-plugins.sh https://git.onap.org/dcaegen2/deployments/plain/k8s-bootstrap-container/build-plugins.sh |
| 53 | chmod 777 scripts-in-container/* |
| 54 | |
| 55 | echo "Launching Cloudify Manager container" |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 56 | docker run -d \ |
| 57 | --network="${NETWORK}" \ |
| 58 | --name cloudify-manager \ |
| 59 | --restart unless-stopped \ |
| 60 | -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ |
Lusheng Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 61 | -v /opt/app/config/scripts-in-container:/tmp/bin \ |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 62 | -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 Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 71 | {{ nexus_docker_repo }}/onap/org.onap.dcaegen2.deployments.cm-container:{{ dcae_docker_cm }} |
| 72 | |
| 73 | echo "Cloudify Manager deployed, waiting for completion" |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 74 | while ! nc -z localhost 80; do sleep 1; done |
| 75 | |
Lusheng Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 76 | echo "Upload plugins to Cloudify Manager" |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 77 | |
Lusheng Ji | c5afcd0 | 2018-04-17 11:13:03 -0400 | [diff] [blame] | 78 | # run as detached because this script is intended to be run in background |
| 79 | docker exec -itd cloudify-manager /tmp/bin/install-plugins.sh |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 80 | |
Lusheng Ji | bd838e7 | 2018-04-16 21:27:17 -0400 | [diff] [blame] | 81 | echo "Cloudify Manager setup complete" |
Lusheng Ji | 819aa7f | 2018-04-16 02:24:39 -0400 | [diff] [blame] | 82 | |