Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 3 | source /var/onap/functions |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 4 | |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 5 | # _create_config_file() - Creates a configuration yaml file for the controller |
| 6 | function _create_config_file { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 7 | cat > ${src_folders[dcae]}/controller/config.yaml << EOL |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 8 | ZONE: $dcae_zone |
| 9 | STATE: $dcae_state |
| 10 | DCAE-VERSION: $artifacts_version |
| 11 | HORIZON-URL: https://mycloud.rackspace.com/cloud/$tenant_id |
| 12 | KEYSTONE-URL: https://identity.api.rackspacecloud.com/v2.0 |
| 13 | OPENSTACK-TENANT-ID: $tenant_id |
| 14 | OPENSTACK-TENANT-NAME: OPEN-ECOMP |
| 15 | OPENSTACK-REGION: $openstack_region |
| 16 | OPENSTACK-PRIVATE-NETWORK: $openstack_private_network_name |
| 17 | OPENSTACK-USER: $openstack_user |
| 18 | OPENSTACK-PASSWORD: $openstack_password |
| 19 | OPENSTACK-KEYNAME: ${key_name}${rand_str}_dcae |
| 20 | OPENSTACK-PUBKEY: $pub_key |
| 21 | |
| 22 | NEXUS-URL-ROOT: $nexus_repo_root |
| 23 | NEXUS-USER: $nexus_username |
| 24 | NEXUS-PASSWORD: $nexus_password |
| 25 | NEXUS-URL-SNAPSHOTS: $nexus_url_snapshots |
| 26 | NEXUS-RAWURL: $nexus_repo |
| 27 | |
| 28 | DOCKER-REGISTRY: $nexus_docker_repo |
| 29 | |
| 30 | GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git |
| 31 | EOL |
| 32 | } |
| 33 | |
Victor Morales | 10d21db | 2017-08-23 13:26:09 -0500 | [diff] [blame] | 34 | # _build_dcae_images() Function that builds DCAE docker images from source code. |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 35 | function _build_dcae_images { |
| 36 | if [[ "$compile_repo" != "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 37 | compile_repos "dcae" |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 38 | fi |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 39 | build_docker_image ${src_folders[dcae]}/dmaapbc openecomp/dcae-dmaapbc |
| 40 | build_docker_image ${src_folders[dcae]}/orch-dispatcher dcae/orch-dispatcher |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 41 | |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 42 | pushd ${src_folders[dcae]}/demo |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 43 | bash dcae-demo-controller/src/main/docker-build/build.sh |
| 44 | popd |
| 45 | |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 46 | build_docker_image ${src_folders[dcae]}/dcae-inventory |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | # get_dcae_images() - Function that retrieves or builds DCAE docker images. |
| 50 | function 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 Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 58 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 59 | # install_dcae() - Function that clones and installs the DCAE controller services from source code |
| 60 | function install_dcae { |
Victor Morales | f8730f5 | 2018-03-02 13:24:33 -0800 | [diff] [blame] | 61 | pushd ${src_folders[dcae]}/demo/startup/controller |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 62 | 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 Morales | 96fe388 | 2018-03-02 14:08:39 -0800 | [diff] [blame] | 66 | run_docker_compose . |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 67 | else |
| 68 | bash init.sh |
| 69 | install_package make |
| 70 | make up |
| 71 | fi |
| 72 | popd |
Victor Morales | 9d205bc | 2017-12-01 17:52:07 -0800 | [diff] [blame] | 73 | # 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 Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 74 | } |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 75 | |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 76 | # init_dcae() - Function that initialize DCAE Controller services |
| 77 | function init_dcae { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 78 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 79 | clone_repos "dcae" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 80 | if [[ "$compile_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 81 | compile_repos "dcae" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 82 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 83 | fi |
| 84 | |
Victor Morales | 80ef0a4 | 2017-08-21 19:17:07 -0500 | [diff] [blame] | 85 | _create_config_file |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 86 | if [[ "$skip_get_images" == "False" ]]; then |
| 87 | get_dcae_images |
| 88 | if [[ "$skip_install" == "False" ]]; then |
| 89 | install_dcae |
| 90 | fi |
| 91 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 92 | } |