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 |
| 6 | source /var/onap/asserts |
| 7 | |
| 8 | # clone_all_policy_repos() - Function that clones Policy source repo. |
| 9 | function clone_all_policy_repos { |
| 10 | local src_folder=/opt/policy |
| 11 | |
| 12 | for dirc in api common docker drools-applications drools-pdp engine gui pap pdp; do |
| 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 { |
| 19 | local src_folder=/opt/policy |
| 20 | |
| 21 | for dirc in api common docker drools-applications drools-pdp engine gui pap pdp; do |
| 22 | compile_src $src_folder/$dirc |
| 23 | done |
| 24 | } |
| 25 | |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 26 | # install_policy() - Function that clones and installs the Policy services from source code |
| 27 | function install_policy { |
| 28 | local src_folder=/opt/policy |
Victor Morales | dd07480 | 2017-07-26 16:06:35 -0500 | [diff] [blame^] | 29 | |
| 30 | clone_all_policy_repos |
| 31 | if [[ "$compile_repo" == "True" ]]; then |
| 32 | compile_all_policy_repos |
| 33 | fi |
| 34 | |
| 35 | if [[ "$build_image" == "True" ]]; then |
| 36 | compile_src $src_folder/docker |
| 37 | install_docker |
| 38 | pushd $src_folder/docker |
| 39 | bash docker_verify.sh |
| 40 | for image in os nexus db base drools pe; do |
| 41 | asserts_image onap/policy/policy-$image |
| 42 | done |
| 43 | popd |
| 44 | else |
| 45 | pull_onap_image policy/policy-db onap/policy/policy-db:latest |
| 46 | pull_onap_image policy/policy-pe onap/policy/policy-pe:latest |
| 47 | pull_onap_image policy/policy-drools onap/policy/policy-drools:latest |
| 48 | pull_onap_image policy/policy-nexus onap/policy/policy-nexus:latest |
| 49 | fi |
| 50 | pushd $src_folder/docker |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 51 | chmod +x config/drools/drools-tweaks.sh |
| 52 | IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2) |
| 53 | echo $IP_ADDRESS > config/pe/ip_addr.txt |
| 54 | install_docker_compose |
| 55 | /opt/docker/docker-compose up -d |
| 56 | popd |
| 57 | } |
| 58 | |
| 59 | # init_policy() - Function that initialize Policy services |
| 60 | function init_policy { |
Victor Morales | 89ce321 | 2017-06-16 18:32:48 -0500 | [diff] [blame] | 61 | install_policy |
| 62 | } |