blob: 71854048e2a8317b3a70efc6aa66876542319b51 [file] [log] [blame]
Victor Morales89ce3212017-06-16 18:32:48 -05001#!/bin/bash
2
3set -o xtrace
4
Victor Moralesdd074802017-07-26 16:06:35 -05005source /var/onap/functions
6source /var/onap/asserts
7
8# clone_all_policy_repos() - Function that clones Policy source repo.
9function 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.
18function 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 Morales89ce3212017-06-16 18:32:48 -050026# install_policy() - Function that clones and installs the Policy services from source code
27function install_policy {
28 local src_folder=/opt/policy
Victor Moralesdd074802017-07-26 16:06:35 -050029
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 Morales89ce3212017-06-16 18:32:48 -050051 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
60function init_policy {
Victor Morales89ce3212017-06-16 18:32:48 -050061 install_policy
62}