blob: d6ebd8200802749854bc3f41338484bf7d6eca5e [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Morales89ce3212017-06-16 18:32:48 -05003source /var/onap/functions
Victor Morales89ce3212017-06-16 18:32:48 -05004
Victor Morales80ef0a42017-08-21 19:17:07 -05005# _create_config_file() - Creates a configuration yaml file for the controller
6function _create_config_file {
Victor Moralesf8730f52018-03-02 13:24:33 -08007 cat > ${src_folders[dcae]}/controller/config.yaml << EOL
Victor Morales89ce3212017-06-16 18:32:48 -05008ZONE: $dcae_zone
9STATE: $dcae_state
10DCAE-VERSION: $artifacts_version
11HORIZON-URL: https://mycloud.rackspace.com/cloud/$tenant_id
12KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0
13OPENSTACK-TENANT-ID: $tenant_id
14OPENSTACK-TENANT-NAME: OPEN-ECOMP
15OPENSTACK-REGION: $openstack_region
16OPENSTACK-PRIVATE-NETWORK: $openstack_private_network_name
17OPENSTACK-USER: $openstack_user
18OPENSTACK-PASSWORD: $openstack_password
19OPENSTACK-KEYNAME: ${key_name}${rand_str}_dcae
20OPENSTACK-PUBKEY: $pub_key
21
22NEXUS-URL-ROOT: $nexus_repo_root
23NEXUS-USER: $nexus_username
24NEXUS-PASSWORD: $nexus_password
25NEXUS-URL-SNAPSHOTS: $nexus_url_snapshots
26NEXUS-RAWURL: $nexus_repo
27
28DOCKER-REGISTRY: $nexus_docker_repo
29
30GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git
31EOL
32}
33
Victor Morales10d21db2017-08-23 13:26:09 -050034# _build_dcae_images() Function that builds DCAE docker images from source code.
Victor Morales80ef0a42017-08-21 19:17:07 -050035function _build_dcae_images {
36 if [[ "$compile_repo" != "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080037 compile_repos "dcae"
Victor Morales80ef0a42017-08-21 19:17:07 -050038 fi
Victor Moralesf8730f52018-03-02 13:24:33 -080039 build_docker_image ${src_folders[dcae]}/dmaapbc openecomp/dcae-dmaapbc
40 build_docker_image ${src_folders[dcae]}/orch-dispatcher dcae/orch-dispatcher
Victor Morales80ef0a42017-08-21 19:17:07 -050041
Victor Moralesf8730f52018-03-02 13:24:33 -080042 pushd ${src_folders[dcae]}/demo
Victor Morales80ef0a42017-08-21 19:17:07 -050043 bash dcae-demo-controller/src/main/docker-build/build.sh
44 popd
45
Victor Moralesf8730f52018-03-02 13:24:33 -080046 build_docker_image ${src_folders[dcae]}/dcae-inventory
Victor Morales80ef0a42017-08-21 19:17:07 -050047}
48
49# get_dcae_images() - Function that retrieves or builds DCAE docker images.
50function get_dcae_images {
51 if [[ "$build_image" == "True" ]]; then
52 _build_dcae_images
53 else
54 pull_openecomp_image dcae-dmaapbc openecomp/dcae-dmaapbc
55 pull_openecomp_image dcae-controller
56 fi
57}
Victor Moralesdd074802017-07-26 16:06:35 -050058
Victor Morales89ce3212017-06-16 18:32:48 -050059# install_dcae() - Function that clones and installs the DCAE controller services from source code
60function install_dcae {
Victor Morales89ce3212017-06-16 18:32:48 -050061 install_docker_compose
Victor Moralesf8730f52018-03-02 13:24:33 -080062 pushd ${src_folders[dcae]}/demo/startup/controller
Victor Morales80ef0a42017-08-21 19:17:07 -050063 if [[ "$build_image" == "True" ]]; then
64 dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
65 sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
66 sed -i "s|MTU|$MTU|g" docker-compose.yml
67 /opt/docker/docker-compose up -d
68 else
69 bash init.sh
70 install_package make
71 make up
72 fi
73 popd
Victor Morales9d205bc2017-12-01 17:52:07 -080074 # run_docker_image -p 8080:8080 -d -v <some local directory>/config.yml:/opt/config.yml --name dcae-inventory <docker registry>/dcae-inventory:<version>
Victor Morales80ef0a42017-08-21 19:17:07 -050075}
Victor Moralesdd074802017-07-26 16:06:35 -050076
Victor Morales80ef0a42017-08-21 19:17:07 -050077# init_dcae() - Function that initialize DCAE Controller services
78function init_dcae {
Idan Amit1690e082017-08-20 08:58:14 +030079 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080080 clone_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030081 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080082 compile_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030083 fi
Victor Moralesdd074802017-07-26 16:06:35 -050084 fi
85
Victor Morales80ef0a42017-08-21 19:17:07 -050086 _create_config_file
Victor Morales6a919972017-09-28 18:29:54 -070087 if [[ "$skip_get_images" == "False" ]]; then
88 get_dcae_images
89 if [[ "$skip_install" == "False" ]]; then
90 install_dcae
91 fi
92 fi
Victor Morales89ce3212017-06-16 18:32:48 -050093}