Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -o xtrace |
| 4 | |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 5 | source /var/onap/functions |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 6 | |
| 7 | src_folder=$git_src_folder/policy |
| 8 | policy_repos=("api" "common" "docker" "drools-applications" "drools-pdp" "engine" "gui" "pap" "pdp") |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 9 | |
| 10 | # clone_all_policy_repos() - Function that clones Policy source repo. |
| 11 | function clone_all_policy_repos { |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 12 | for dirc in ${aai_repos[@]}; do |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 13 | clone_repo policy/$dirc $src_folder/$dirc |
| 14 | done |
| 15 | } |
| 16 | |
| 17 | # # compile_all_policy_repos() - Function that compiles Policy source repo. |
| 18 | function compile_all_policy_repos { |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 19 | for dirc in ${aai_repos[@]}; do |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 20 | compile_src $src_folder/$dirc |
| 21 | done |
| 22 | } |
| 23 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 24 | # install_policy() - Function that clones and installs the Policy services from source code |
| 25 | function install_policy { |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 26 | if [[ "$build_image" == "True" ]]; then |
| 27 | compile_src $src_folder/docker |
| 28 | install_docker |
| 29 | pushd $src_folder/docker |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 30 | install_maven |
| 31 | mvn prepare-package |
| 32 | cp -r target/policy-pe/* policy-pe/ |
| 33 | cp -r target/policy-drools/* policy-drools |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame] | 34 | bash docker_verify.sh |
| 35 | for image in os nexus db base drools pe; do |
| 36 | asserts_image onap/policy/policy-$image |
| 37 | done |
| 38 | popd |
| 39 | else |
| 40 | pull_onap_image policy/policy-db onap/policy/policy-db:latest |
| 41 | pull_onap_image policy/policy-pe onap/policy/policy-pe:latest |
| 42 | pull_onap_image policy/policy-drools onap/policy/policy-drools:latest |
| 43 | pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest |
| 44 | fi |
| 45 | pushd $src_folder/docker |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 46 | chmod +x config/drools/drools-tweaks.sh |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 47 | echo $IP_ADDRESS > config/pe/ip_addr.txt |
| 48 | install_docker_compose |
| 49 | /opt/docker/docker-compose up -d |
| 50 | popd |
| 51 | } |
| 52 | |
| 53 | # init_policy() - Function that initialize Policy services |
| 54 | function init_policy { |
Victor Morales | 165f3e3 | 2017-08-08 16:24:05 -0500 | [diff] [blame] | 55 | clone_all_policy_repos |
| 56 | if [[ "$compile_repo" == "True" ]]; then |
| 57 | compile_all_policy_repos |
| 58 | fi |
| 59 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 60 | install_policy |
| 61 | } |