blob: 05ad32094d6b0e7186c90d0781614206d7404799 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
Victor Moralesdd074802017-07-26 16:06:35 -05003source /var/onap/functions
Victor Morales165f3e32017-08-08 16:24:05 -05004
Victor Moralesdcfa2cf2017-08-30 19:12:14 -05005policy_src_folder=$git_src_folder/policy
Victor Moralesf6c0bf12017-10-27 11:08:04 -07006policy_repos=("policy/api" "policy/common" "policy/docker" \
7"policy/drools-applications" "policy/drools-pdp" "policy/engine" \
8"policy/gui" "policy/pap" "policy/pdp")
Victor Moralesdd074802017-07-26 16:06:35 -05009
Victor Morales96512652017-08-16 13:44:28 -050010# _build_policy_images() - Function that build Policy docker images from source code
11function _build_policy_images {
Victor Moralesdcfa2cf2017-08-30 19:12:14 -050012 compile_src $policy_src_folder/docker
13 pushd $policy_src_folder/docker
Victor Morales96512652017-08-16 13:44:28 -050014 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
24function get_policy_images {
Victor Moralesdd074802017-07-26 16:06:35 -050025 if [[ "$build_image" == "True" ]]; then
Victor Morales96512652017-08-16 13:44:28 -050026 _build_policy_images
Victor Moralesdd074802017-07-26 16:06:35 -050027 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 Morales96512652017-08-16 13:44:28 -050033}
34
35# install_policy() - Function that clones and installs the Policy services from source code
36function install_policy {
Victor Moralesdcfa2cf2017-08-30 19:12:14 -050037 pushd $policy_src_folder/docker
Victor Morales89ce3212017-06-16 18:32:48 -050038 chmod +x config/drools/drools-tweaks.sh
Victor Morales89ce3212017-06-16 18:32:48 -050039 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
46function init_policy {
Idan Amit1690e082017-08-20 08:58:14 +030047 if [[ "$clone_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080048 clone_repos "policy"
Idan Amit1690e082017-08-20 08:58:14 +030049 if [[ "$compile_repo" == "True" ]]; then
Victor Moralesf1f1ba52017-11-20 16:38:28 -080050 compile_repos "policy"
Idan Amit1690e082017-08-20 08:58:14 +030051 fi
Victor Morales165f3e32017-08-08 16:24:05 -050052 fi
53
Victor Morales6a919972017-09-28 18:29:54 -070054 if [[ "$skip_get_images" == "False" ]]; then
55 get_policy_images
56 if [[ "$skip_install" == "False" ]]; then
57 install_policy
58 fi
59 fi
Victor Morales89ce3212017-06-16 18:32:48 -050060}