Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
| 5 | source /var/onap/sdnc |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 6 | source /var/onap/asserts |
| 7 | |
| 8 | # clone_all_appc_repos() - Function that clones APPC source repo. |
| 9 | function clone_all_appc_repos { |
| 10 | local src_folder=/opt/appc |
| 11 | |
| 12 | clone_repo appc $src_folder |
| 13 | clone_repo appc/deployment $src_folder/deployment |
| 14 | } |
| 15 | |
| 16 | # compile_all_appc_repos() - Function that compiles APPC source repo. |
| 17 | function compile_all_appc_repos { |
| 18 | local src_folder=/opt/appc |
| 19 | |
| 20 | compile_src $src_folder |
| 21 | compile_src $src_folder/deployment |
| 22 | } |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 23 | |
| 24 | # install_appc() - Function that clones and installs the APPC services from source code |
| 25 | function install_appc { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 26 | install_package unzip |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 27 | local src_folder=/opt/appc |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 28 | |
| 29 | clone_all_appc_repos |
| 30 | if [[ "$compile_repo" == "True" ]]; then |
| 31 | compile_all_appc_repos |
| 32 | fi |
| 33 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 34 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 35 | clone_repo sdnc/oam /opt/sdnc/oam |
| 36 | build_sdnc_images /opt/sdnc/oam |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 37 | build_docker_image $src_folder/deployment/installation/appc docker |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 38 | asserts_image openecomp/appc-image |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 39 | else |
| 40 | pull_openecomp_image appc-image openecomp/appc-image:latest |
| 41 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 42 | fi |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 43 | pushd $src_folder/deployment |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 44 | install_docker_compose |
| 45 | /opt/docker/docker-compose up -d |
| 46 | popd |
| 47 | } |
| 48 | |
| 49 | # init_appc() - Function that initialize APPC services |
| 50 | function init_appc { |
| 51 | install_appc |
| 52 | } |