blob: 9150b37daa651561acba49bac443a5e6271e8e3d [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 -05005dcae_src_folder=$git_src_folder/dcae
Victor Morales21404d72017-10-20 13:18:26 -07006dcae_repos=("dcae" "dcae/apod" "dcae/apod/analytics" "dcae/apod/buildtools"
7"dcae/apod/cdap" "dcae/collectors" "dcae/collectors/ves" "dcae/controller"
8"dcae/controller/analytics" "dcae/dcae-inventory" "dcae/demo"
9"dcae/demo/startup" "dcae/demo/startup/aaf" "dcae/demo/startup/controller"
10"dcae/demo/startup/message-router" "dcae/dmaapbc" "dcae/operation"
11"dcae/operation/utils" "dcae/orch-dispatcher" "dcae/pgaas" "dcae/utils" "dcae/utils/buildtools")
Victor Morales80ef0a42017-08-21 19:17:07 -050012
13# _create_config_file() - Creates a configuration yaml file for the controller
14function _create_config_file {
15 cat > $dcae_src_folder/controller/config.yaml << EOL
Victor Morales89ce3212017-06-16 18:32:48 -050016ZONE: $dcae_zone
17STATE: $dcae_state
18DCAE-VERSION: $artifacts_version
19HORIZON-URL: https://mycloud.rackspace.com/cloud/$tenant_id
20KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0
21OPENSTACK-TENANT-ID: $tenant_id
22OPENSTACK-TENANT-NAME: OPEN-ECOMP
23OPENSTACK-REGION: $openstack_region
24OPENSTACK-PRIVATE-NETWORK: $openstack_private_network_name
25OPENSTACK-USER: $openstack_user
26OPENSTACK-PASSWORD: $openstack_password
27OPENSTACK-KEYNAME: ${key_name}${rand_str}_dcae
28OPENSTACK-PUBKEY: $pub_key
29
30NEXUS-URL-ROOT: $nexus_repo_root
31NEXUS-USER: $nexus_username
32NEXUS-PASSWORD: $nexus_password
33NEXUS-URL-SNAPSHOTS: $nexus_url_snapshots
34NEXUS-RAWURL: $nexus_repo
35
36DOCKER-REGISTRY: $nexus_docker_repo
37
38GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git
39EOL
40}
41
Victor Morales10d21db2017-08-23 13:26:09 -050042# _build_dcae_images() Function that builds DCAE docker images from source code.
Victor Morales80ef0a42017-08-21 19:17:07 -050043function _build_dcae_images {
44 if [[ "$compile_repo" != "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080045 compile_repos "dcae"
Victor Morales80ef0a42017-08-21 19:17:07 -050046 fi
Victor Morales9d205bc2017-12-01 17:52:07 -080047 build_docker_image $dcae_src_folder/dmaapbc openecomp/dcae-dmaapbc
48 build_docker_image $dcae_src_folder/orch-dispatcher dcae/orch-dispatcher
Victor Morales80ef0a42017-08-21 19:17:07 -050049
50 pushd $dcae_src_folder/demo
51 bash dcae-demo-controller/src/main/docker-build/build.sh
52 popd
53
54 build_docker_image $dcae_src_folder/dcae-inventory
55}
56
57# get_dcae_images() - Function that retrieves or builds DCAE docker images.
58function get_dcae_images {
59 if [[ "$build_image" == "True" ]]; then
60 _build_dcae_images
61 else
62 pull_openecomp_image dcae-dmaapbc openecomp/dcae-dmaapbc
63 pull_openecomp_image dcae-controller
64 fi
65}
Victor Moralesdd074802017-07-26 16:06:35 -050066
Victor Morales89ce3212017-06-16 18:32:48 -050067# install_dcae() - Function that clones and installs the DCAE controller services from source code
68function install_dcae {
Victor Morales89ce3212017-06-16 18:32:48 -050069 install_docker_compose
Victor Morales80ef0a42017-08-21 19:17:07 -050070 pushd $dcae_src_folder/demo/startup/controller
71 if [[ "$build_image" == "True" ]]; then
72 dcae_image=`docker images | grep dcae-controller | awk '{print $1 ":" $2}'`
73 sed -i "s|DOCKER-REGISTRY/openecomp/dcae-controller:DCAE-VERSION|$dcae_image|g" docker-compose.yml
74 sed -i "s|MTU|$MTU|g" docker-compose.yml
75 /opt/docker/docker-compose up -d
76 else
77 bash init.sh
78 install_package make
79 make up
80 fi
81 popd
Victor Morales9d205bc2017-12-01 17:52:07 -080082 # 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 -050083}
Victor Moralesdd074802017-07-26 16:06:35 -050084
Victor Morales80ef0a42017-08-21 19:17:07 -050085# init_dcae() - Function that initialize DCAE Controller services
86function init_dcae {
Idan Amit1690e082017-08-20 08:58:14 +030087 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080088 clone_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030089 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080090 compile_repos "dcae"
Idan Amit1690e082017-08-20 08:58:14 +030091 fi
Victor Moralesdd074802017-07-26 16:06:35 -050092 fi
93
Victor Morales80ef0a42017-08-21 19:17:07 -050094 _create_config_file
Victor Morales6a919972017-09-28 18:29:54 -070095 if [[ "$skip_get_images" == "False" ]]; then
96 get_dcae_images
97 if [[ "$skip_install" == "False" ]]; then
98 install_dcae
99 fi
100 fi
Victor Morales89ce3212017-06-16 18:32:48 -0500101}