blob: 25efddddc6e9577fa5e0b94219e199ce74e2a9e0 [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 Moralesf8730f52018-03-02 13:24:33 -080061 pushd ${src_folders[dcae]}/demo/startup/controller
Victor Morales80ef0a42017-08-21 19:17:07 -050062 if [[ "$build_image" == "True" ]]; then
63 dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
64 sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
65 sed -i "s|MTU|$MTU|g" docker-compose.yml
Victor Morales96fe3882018-03-02 14:08:39 -080066 run_docker_compose .
Victor Morales80ef0a42017-08-21 19:17:07 -050067 else
68 bash init.sh
69 install_package make
70 make up
71 fi
72 popd
Victor Morales9d205bc2017-12-01 17:52:07 -080073 # 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 -050074}
Victor Moralesdd074802017-07-26 16:06:35 -050075
Victor Morales80ef0a42017-08-21 19:17:07 -050076# init_dcae() - Function that initialize DCAE Controller services
77function init_dcae {
Idan Amit1690e082017-08-20 08:58:14 +030078 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080079 clone_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030080 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080081 compile_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030082 fi
Victor Moralesdd074802017-07-26 16:06:35 -050083 fi
84
Victor Morales80ef0a42017-08-21 19:17:07 -050085 _create_config_file
Victor Morales6a919972017-09-28 18:29:54 -070086 if [[ "$skip_get_images" == "False" ]]; then
87 get_dcae_images
88 if [[ "$skip_install" == "False" ]]; then
89 install_dcae
90 fi
91 fi
Victor Morales89ce3212017-06-16 18:32:48 -050092}