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 | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 6 | source /var/onap/functions |
| 7 | |
| 8 | appc_src_folder=$git_src_folder/appc |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 9 | |
| 10 | # clone_all_appc_repos() - Function that clones APPC source repo. |
| 11 | function clone_all_appc_repos { |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 12 | clone_repo appc $appc_src_folder |
| 13 | clone_repo appc/deployment $appc_src_folder/deployment |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 14 | } |
| 15 | |
| 16 | # compile_all_appc_repos() - Function that compiles APPC source repo. |
| 17 | function compile_all_appc_repos { |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 18 | compile_src $appc_src_folder |
| 19 | compile_src $appc_src_folder/deployment |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 20 | } |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 21 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 22 | # _build_appc_images() - Function that creates APPC images from source code. |
| 23 | function _build_appc_images { |
| 24 | get_sdnc_images |
| 25 | build_docker_image $appc_src_folder/deployment/installation/appc docker |
| 26 | } |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 27 | |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 28 | # get_appc_images() - Function that gets or build APPC docker images |
| 29 | function get_appc_images { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 30 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 31 | _build_appc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 32 | else |
| 33 | pull_openecomp_image appc-image openecomp/appc-image:latest |
| 34 | pull_openecomp_image dgbuilder-sdnc-image openecomp/dgbuilder-sdnc-image:latest |
| 35 | fi |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | # install_appc() - Function that clones and installs the APPC services from source code |
| 39 | function install_appc { |
| 40 | pushd $appc_src_folder/deployment/docker-compose |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 41 | install_docker_compose |
| 42 | /opt/docker/docker-compose up -d |
| 43 | popd |
| 44 | } |
| 45 | |
| 46 | # init_appc() - Function that initialize APPC services |
| 47 | function init_appc { |
Victor Morales | 65deef2 | 2017-08-18 20:53:42 -0500 | [diff] [blame] | 48 | clone_all_appc_repos |
| 49 | if [[ "$compile_repo" == "True" ]]; then |
| 50 | compile_all_appc_repos |
| 51 | fi |
| 52 | |
| 53 | get_appc_images |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 54 | install_appc |
| 55 | } |