aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-10-10 16:18:27 -0400
committerPamela Dragosh <pdragosh@research.att.com>2017-10-11 09:42:57 -0400
commitca15b920b57259eccc7dbaea5200f393d3f8bfe6 (patch)
tree9fef7238c992bcb75e0f1cc897ebd9cc98ac7d6e
parent31fb6c55623e8655b5c29b8848020bb84397ef1e (diff)
Add ability to turn off policy preload
You can now set environment variable to override whether or not the policies are pre-loaded by the engines during docker image startup. The README.md is updated with instructions. Each docker-compose has a different default set. The .env file is set to load policies by default to true. You can override by either changing this file or setting the environment: export PRELOAD_POLICIES=false Issue-ID: POLICY-304 Change-Id: Ia96788ac3b8d47814eea1046d96c4e3e4a0b9664 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
-rw-r--r--.env2
-rw-r--r--README.md15
-rwxr-xr-x[-rw-r--r--]config/pe/push-policies.sh6
-rw-r--r--docker-compose-integration.yml4
-rw-r--r--docker-compose.yml4
5 files changed, 29 insertions, 2 deletions
diff --git a/.env b/.env
new file mode 100644
index 00000000..0916ff2e
--- /dev/null
+++ b/.env
@@ -0,0 +1,2 @@
+PRELOAD_POLICIES=true
+
diff --git a/README.md b/README.md
index 662800c6..28936ca7 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,14 @@ To build it using Maven 3, first build 'policy/common', 'policy/engine', 'policy
target/policy-pe
target/policy-drools
+For example:
+docker build -t onap/policy/policy-os policy-os
+docker build -t onap/policy/policy-db policy-db
+docker build -t onap/policy/policy-nexus policy-nexus
+docker build -t onap/policy/policy-base policy-base
+docker build -t onap/policy/policy-pe target/policy-pe
+docker build -t onap/policy/policy-drools target/policy-drools
+
In addition, the 'config' directory contains configuration files that are read during the startup of the containers; this directory is referenced by the docker-compose.yml file.
If you want to call the docker-compose, the following needs to be setup before doing so:
@@ -19,3 +27,10 @@ If you want to call the docker-compose, the following needs to be setup before d
chmod +x config/drools/drools-tweaks.sh
IP_ADDRESS=$(ifconfig eth0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
echo $IP_ADDRESS > config/pe/ip_addr.txt
+
+If you do not want the policies pre-loaded, then set this environment variable to false:
+
+export PRELOAD_POLICIES=false
+
+It will override the settings in the .env file. Which is set to true.
+
diff --git a/config/pe/push-policies.sh b/config/pe/push-policies.sh
index 77f94c0f..d50706de 100644..100755
--- a/config/pe/push-policies.sh
+++ b/config/pe/push-policies.sh
@@ -12,6 +12,12 @@ sleep 2
curl -v --silent -X POST --header 'Content-Type: multipart/form-data' --header 'Accept: text/plain' --header 'ClientAuth: cHl0aG9uOnRlc3Q=' --header 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' --header 'Environment: TEST' -F "file=@cl-amsterdam-template.drl" -F "importParametersJson={\"serviceName\":\"ClosedLoopControlName\",\"serviceType\":\"BRMSPARAM\"}" 'http://pdp:8081/pdp/api/policyEngineImport'
+echo "PRELOAD_POLICIES is $PRELOAD_POLICIES"
+
+if [ "$PRELOAD_POLICIES" == "false" ]; then
+ exit 0
+fi
+
#########################################Create BRMS Param policies##########################################
echo "Create BRMSParam Operational Policies"
diff --git a/docker-compose-integration.yml b/docker-compose-integration.yml
index 5d1056c8..042971d2 100644
--- a/docker-compose-integration.yml
+++ b/docker-compose-integration.yml
@@ -1,4 +1,4 @@
-version: '2'
+version: '3'
services:
mariadb:
image: onap/policy/policy-db
@@ -12,6 +12,8 @@ services:
hostname: nexus
pap:
image: onap/policy/policy-pe
+ environment:
+ - PRELOAD_POLICIES=${PRELOAD_POLICIES}
container_name: pap
depends_on:
- mariadb
diff --git a/docker-compose.yml b/docker-compose.yml
index 2de9ffe5..6091dd93 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,4 +1,4 @@
-version: '2'
+version: '3'
networks:
default:
driver: bridge
@@ -17,6 +17,8 @@ services:
hostname: nexus
pap:
image: onap/policy/policy-pe
+ environment:
+ - PRELOAD_POLICIES=${PRELOAD_POLICIES}
container_name: pap
depends_on:
- mariadb