Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 3 | source /var/onap/functions |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 4 | |
Victor Morales | dcfa2cf | 2017-08-30 19:12:14 -0500 | [diff] [blame] | 5 | policy_src_folder=$git_src_folder/policy |
Victor Morales | f6c0bf1 | 2017-10-27 11:08:04 -0700 | [diff] [blame] | 6 | policy_repos=("policy/api" "policy/common" "policy/docker" \ |
| 7 | "policy/drools-applications" "policy/drools-pdp" "policy/engine" \ |
| 8 | "policy/gui" "policy/pap" "policy/pdp") |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 9 | |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 10 | # _build_policy_images() - Function that build Policy docker images from source code |
| 11 | function _build_policy_images { |
Victor Morales | dcfa2cf | 2017-08-30 19:12:14 -0500 | [diff] [blame] | 12 | compile_src $policy_src_folder/docker |
| 13 | pushd $policy_src_folder/docker |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 14 | install_maven |
| 15 | mvn prepare-package |
| 16 | cp -r target/policy-pe/* policy-pe/ |
| 17 | cp -r target/policy-drools/* policy-drools |
| 18 | install_docker |
| 19 | bash docker_verify.sh |
| 20 | popd |
| 21 | } |
| 22 | |
| 23 | # get_policy_images() - Function that retrieves Policy docker images |
| 24 | function get_policy_images { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 25 | if [[ "$build_image" == "True" ]]; then |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 26 | _build_policy_images |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 27 | else |
| 28 | pull_onap_image policy/policy-db onap/policy/policy-db:latest |
| 29 | pull_onap_image policy/policy-pe onap/policy/policy-pe:latest |
| 30 | pull_onap_image policy/policy-drools onap/policy/policy-drools:latest |
| 31 | pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest |
| 32 | fi |
Victor Morales | 9651265 | 2017-08-16 13:44:28 -0500 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | # install_policy() - Function that clones and installs the Policy services from source code |
| 36 | function install_policy { |
Victor Morales | dcfa2cf | 2017-08-30 19:12:14 -0500 | [diff] [blame] | 37 | pushd $policy_src_folder/docker |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 38 | chmod +x config/drools/drools-tweaks.sh |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 39 | echo $IP_ADDRESS > config/pe/ip_addr.txt |
| 40 | install_docker_compose |
| 41 | /opt/docker/docker-compose up -d |
| 42 | popd |
| 43 | } |
| 44 | |
| 45 | # init_policy() - Function that initialize Policy services |
| 46 | function init_policy { |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 47 | if [[ "$clone_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 48 | clone_repos "policy" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 49 | if [[ "$compile_repo" == "True" ]]; then |
Victor Morales | f1f1ba5 | 2017-11-20 16:38:28 -0800 | [diff] [blame] | 50 | compile_repos "policy" |
Idan Amit | 1690e08 | 2017-08-20 08:58:14 +0300 | [diff] [blame] | 51 | fi |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 52 | fi |
| 53 | |
Victor Morales | 6a91997 | 2017-09-28 18:29:54 -0700 | [diff] [blame] | 54 | if [[ "$skip_get_images" == "False" ]]; then |
| 55 | get_policy_images |
| 56 | if [[ "$skip_install" == "False" ]]; then |
| 57 | install_policy |
| 58 | fi |
| 59 | fi |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 60 | } |