aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-01-04 14:43:44 -0600
committerJorge Hernandez <jorge.hernandez-herrero@att.com>2019-01-04 14:43:44 -0600
commit777131d706b8379c5fb30f8161902d0388eb96bf (patch)
treecca309d2b46d4772682afdb9fc0c4f0798a86869 /packages
parentd803757e8696a4383b57e0ee619687b820225550 (diff)
Add tooling for drools policy developers
This commit adds tooling to better support development activities for drools developers. 1. deploy artifacts to nexus or to local file repository on demand. It also allows to test on a single drools instance without the dependency on a nexus repo. 2. make installation configuration files conform to same convention (all upper case). Change-Id: Ia0a2fc25db2ef21b774a9eee4ed51d4b876a1993 Issue-ID: POLICY-1367 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'packages')
-rw-r--r--packages/base/src/files/etc/profile.d/env.sh20
-rwxr-xr-xpackages/base/src/files/m2/settings.xml43
-rwxr-xr-xpackages/base/src/files/m2/standalone-settings.xml7
-rw-r--r--packages/docker/src/main/docker/do-start.sh11
-rw-r--r--packages/docker/src/main/docker/docker-install.sh86
-rw-r--r--packages/install/src/files/base.conf63
6 files changed, 135 insertions, 95 deletions
diff --git a/packages/base/src/files/etc/profile.d/env.sh b/packages/base/src/files/etc/profile.d/env.sh
index 97076606..833064fe 100644
--- a/packages/base/src/files/etc/profile.d/env.sh
+++ b/packages/base/src/files/etc/profile.d/env.sh
@@ -1,3 +1,4 @@
+#!/usr/bin/env bash
###
# ============LICENSE_START=======================================================
# Base Package
@@ -18,15 +19,16 @@
# ============LICENSE_END=========================================================
###
-export POLICY_HOME=${{POLICY_HOME}}
-export POLICY_LOGS=${{POLICY_LOGS}}
-export JAVA_HOME=${{JAVA_HOME}}
-export ENGINE_MANAGEMENT_USER=${{ENGINE_MANAGEMENT_USER}}
-export ENGINE_MANAGEMENT_PASSWORD=${{ENGINE_MANAGEMENT_PASSWORD}}
-export ENGINE_MANAGEMENT_PORT=${{ENGINE_MANAGEMENT_PORT}}
-export ENGINE_MANAGEMENT_HOST=${{ENGINE_MANAGEMENT_HOST}}
+set -a
-for x in $POLICY_HOME/bin $JAVA_HOME/bin $HOME/bin ; do
+POLICY_HOME=${{POLICY_HOME}}
+
+source ${POLICY_HOME}/etc/build.info
+for c in ${POLICY_HOME}/etc/profile.d/*.conf ; do
+ source ${c}
+done
+
+for x in ${POLICY_HOME}/bin ${JAVA_HOME}/bin ${HOME}/bin ; do
if [ -d $x ] ; then
case ":$PATH:" in
*":$x:"*) :;; # already there
@@ -34,3 +36,5 @@ for x in $POLICY_HOME/bin $JAVA_HOME/bin $HOME/bin ; do
esac
fi
done
+
+set +a
diff --git a/packages/base/src/files/m2/settings.xml b/packages/base/src/files/m2/settings.xml
index 4ec22c1e..63ab214d 100755
--- a/packages/base/src/files/m2/settings.xml
+++ b/packages/base/src/files/m2/settings.xml
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
Base Package
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -26,13 +26,33 @@
<profiles>
+ <profile>
+ <id>policy-local</id>
+
+ <repositories>
+ <repository>
+ <id>file-repository</id>
+ <url>file:${user.home}/.m2/file-repository</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ </profile>
+
<profile>
<id>policy-releases</id>
<repositories>
<repository>
- <id>${{releaseRepositoryID}}</id>
- <url>${{releaseRepositoryUrl}}</url>
+ <id>${env.RELEASE_REPOSITORY_ID}</id>
+ <url>${env.RELEASE_REPOSITORY_URL}</url>
<releases>
<enabled>true</enabled>
</releases>
@@ -49,8 +69,8 @@
<repositories>
<repository>
- <id>${{snapshotRepositoryID}}</id>
- <url>${{snapshotRepositoryUrl}}</url>
+ <id>${env.SNAPSHOT_REPOSITORY_ID}</id>
+ <url>${env.SNAPSHOT_REPOSITORY_URL}</url>
<releases>
<enabled>false</enabled>
</releases>
@@ -126,6 +146,7 @@
</profiles>
<activeProfiles>
+ <activeProfile>policy-local</activeProfile>
<activeProfile>policy-releases</activeProfile>
<activeProfile>policy-snapshots</activeProfile>
<activeProfile>onap-releases</activeProfile>
@@ -135,14 +156,14 @@
<servers>
<server>
- <id>${{snapshotRepositoryID}}</id>
- <username>${{repositoryUsername}}</username>
- <password>${{repositoryPassword}}</password>
+ <id>${env.SNAPSHOT_REPOSITORY_ID}</id>
+ <username>${env.REPOSITORY_USERNAME}</username>
+ <password>${env.REPOSITORY_PASSWORD}</password>
</server>
<server>
- <id>${{releaseRepositoryID}}</id>
- <username>${{repositoryUsername}}</username>
- <password>${{repositoryPassword}}</password>
+ <id>${env.RELEASE_REPOSITORY_ID}</id>
+ <username>${env.REPOSITORY_USERNAME}</username>
+ <password>${env.REPOSITORY_PASSWORD}</password>
</server>
</servers>
diff --git a/packages/base/src/files/m2/standalone-settings.xml b/packages/base/src/files/m2/standalone-settings.xml
index 15e37ca1..63f2f92d 100755
--- a/packages/base/src/files/m2/standalone-settings.xml
+++ b/packages/base/src/files/m2/standalone-settings.xml
@@ -3,7 +3,7 @@
============LICENSE_START=======================================================
Base Package
================================================================================
- Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
================================================================================
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@
<repositories>
<repository>
- <id>${{fileRepoID}}</id>
- <url>${{fileRepoUrl}}</url>
+ <id>file-repository</id>
+ <url>file:${user.home}/.m2/file-repository</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
@@ -86,7 +86,6 @@
</profile>
<profile>
-
<id>onap-snapshots</id>
<repositories>
diff --git a/packages/docker/src/main/docker/do-start.sh b/packages/docker/src/main/docker/do-start.sh
index af7b3d9c..91402e62 100644
--- a/packages/docker/src/main/docker/do-start.sh
+++ b/packages/docker/src/main/docker/do-start.sh
@@ -3,7 +3,7 @@
# ============LICENSE_START=======================================================
#
# ================================================================================
-# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -50,11 +50,18 @@ else
unzip -o ${app}
done
+ feats=$(ls config/feature*.zip 2> /dev/null)
+ for feat in $feats
+ do
+ echo "Feature found: ${feat}"
+ cp ${feat} .
+ done
+
echo "docker install at ${PWD}"
./docker-install.sh
- . /opt/app/policy/etc/profile.d/env.sh
+ . ${POLICY_HOME}/etc/profile.d/env.sh
# allow user to override the key or/and the trust stores
diff --git a/packages/docker/src/main/docker/docker-install.sh b/packages/docker/src/main/docker/docker-install.sh
index 98560202..76f8fb27 100644
--- a/packages/docker/src/main/docker/docker-install.sh
+++ b/packages/docker/src/main/docker/docker-install.sh
@@ -199,39 +199,39 @@ function configure_settings() {
mkdir -p "${fileRepoUrl#file:}"
# The following parameters are also used outside of this function.
- # if snapshotRepositoryUrl and/or releaseRepositoryUrl is defined,
+ # if SNAPSHOT_REPOSITORY_URL and/or RELEASE_REPOSITORY_URL is defined,
# the corresponding ID and url will be updated below
releaseRepoID=${fileRepoID}
releaseRepoUrl=${fileRepoUrl}
snapshotRepoID=${fileRepoID}
snapshotRepoUrl=${fileRepoUrl}
- # if both snapshotRepositoryUrl and releaseRepositoryUrl are null,
+ # if both SNAPSHOT_REPOSITORY_URL and RELEASE_REPOSITORY_URL are null,
# use standalone-settings.xml that just defines the file-based repo.
# if only one of them is specified, use file-based repo for the other.
- if [[ -z "$snapshotRepositoryUrl" && -z $releaseRepositoryUrl ]]; then
- echo "snapshotRepositoryUrl and releaseRepositoryUrl properties not set, configuring settings.xml for standalone operation"
- mv $HOME_M2/standalone-settings.xml $HOME_M2/settings.xml
+ if [[ -z "${SNAPSHOT_REPOSITORY_URL}" && -z "${RELEASE_REPOSITORY_URL}" ]]; then
+ echo "SNAPSHOT_REPOSITORY_URL and RELEASE_REPOSITORY_URL properties not set, configuring settings.xml for standalone operation"
+ mv ${HOME_M2}/standalone-settings.xml ${HOME_M2}/settings.xml
else
rm $HOME_M2/standalone-settings.xml
- if [[ -n "${snapshotRepositoryUrl}" ]] ; then
- snapshotRepoID=${snapshotRepositoryID}
- snapshotRepoUrl=${snapshotRepositoryUrl}
+ if [[ -n "${SNAPSHOT_REPOSITORY_URL}" ]] ; then
+ snapshotRepoID=${SNAPSHOT_REPOSITORY_ID}
+ snapshotRepoUrl=${SNAPSHOT_REPOSITORY_URL}
fi
- if [[ -n "${releaseRepositoryUrl}" ]] ; then
- releaseRepoID=${releaseRepositoryID}
- releaseRepoUrl=${releaseRepositoryUrl}
+ if [[ -n "${RELEASE_REPOSITORY_URL}" ]] ; then
+ releaseRepoID=${RELEASE_REPOSITORY_ID}
+ releaseRepoUrl=${RELEASE_REPOSITORY_URL}
fi
fi
SED_LINE="sed -i"
- SED_LINE+=" -e 's!\${{snapshotRepositoryID}}!${snapshotRepoID}!g' "
- SED_LINE+=" -e 's!\${{snapshotRepositoryUrl}}!${snapshotRepoUrl}!g' "
- SED_LINE+=" -e 's!\${{releaseRepositoryID}}!${releaseRepoID}!g' "
- SED_LINE+=" -e 's!\${{releaseRepositoryUrl}}!${releaseRepoUrl}!g' "
- SED_LINE+=" -e 's!\${{repositoryUsername}}!${repositoryUsername}!g' "
- SED_LINE+=" -e 's!\${{repositoryPassword}}!${repositoryPassword}!g' "
+ SED_LINE+=" -e 's!\${{SNAPSHOT_REPOSITORY_ID}}!${snapshotRepoID}!g' "
+ SED_LINE+=" -e 's!\${{SNAPSHOT_REPOSITORY_URL}}!${snapshotRepoUrl}!g' "
+ SED_LINE+=" -e 's!\${{RELEASE_REPOSITORY_ID}}!${releaseRepoID}!g' "
+ SED_LINE+=" -e 's!\${{RELEASE_REPOSITORY_URL}}!${releaseRepoUrl}!g' "
+ SED_LINE+=" -e 's!\${{REPOSITORY_USERNAME}}!${REPOSITORY_USERNAME}!g' "
+ SED_LINE+=" -e 's!\${{REPOSITORY_PASSWORD}}!${REPOSITORY_PASSWORD}!g' "
SED_LINE+=" -e 's!\${{fileRepoID}}!${fileRepoID}!g' "
SED_LINE+=" -e 's!\${{fileRepoUrl}}!${fileRepoUrl}!g' "
@@ -364,7 +364,7 @@ function configure_base() {
echo "${PROFILE_LINE}" >> "${HOME}/.profile"
fi
- . "${POLICY_HOME}/etc/profile.d/env.sh"
+ source "${POLICY_HOME}/etc/profile.d/env.sh"
cat "${POLICY_HOME}"/etc/cron.d/* | crontab
}
@@ -445,17 +445,12 @@ function install_base() {
# Undo any changes in the $HOME directory if any
BASH_PROFILE_LINE=". ${POLICY_HOME}/etc/profile.d/env.sh"
-# PROFILE_LINE="ps -p \$\$ | grep -q bash || . ${POLICY_HOME}/etc/profile.d/env.sh"
-
+
# Note: using .bashrc instead of .bash_profile
if [[ -f ${HOME}/.bashrc ]]; then
- /bin/sed -i.bak "\:${BASH_PROFILE_LINE}:d" "${HOME}/.bashrc"
+ /bin/sed -i "\:${BASH_PROFILE_LINE}:d" "${HOME}/.bashrc"
fi
-
-# if [[ -f ${HOME}/.profile ]]; then
-# /bin/sed -i.bak "\:${PROFILE_LINE}:d" "${HOME}/.profile"
-# fi
-
+
tar -C ${POLICY_HOME} -xf ${BASE_TGZ} --no-same-owner
if [[ $? != 0 ]]; then
# this should not happened
@@ -471,14 +466,6 @@ function install_base() {
fi
fi
-# /bin/mkdir -p ${POLICY_HOME}/etc/ssl > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/etc/init.d > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/nagios/tmp > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/tmp > /dev/null 2>&1
-# /bin/mkdir -p ${POLICY_HOME}/var > /dev/null 2>&1
-
-# chmod -R 755 ${POLICY_HOME}/nagios > /dev/null 2>&1
-
if [[ -d $HOME_M2 ]]; then
echo "Renaming existing $HOME_M2 to $HOME/m2.$TIMESTAMP"
mv $HOME_M2 $HOME/m2.$TIMESTAMP
@@ -494,19 +481,16 @@ function install_base() {
exit 1
fi
fi
-
- configure_base
-
+
+ # base.conf properties may have characters with special meaning to bash,
+ # so wrap all the values in quotes in the profile.d version so it can
+ # be sourced into scripts that need the values. Also remove any blanks
+ # that may be present around the = sign.
# save ${BASE_CONF} in PDP-D installation
cp "${BASE_CONF}" "${POLICY_HOME}"/etc/profile.d
-
-# if ! create_keystore; then
-# echo "error: aborting base installation: creating keystore"
-# exit 1
-# fi
-
-# list_unexpanded_files ${POLICY_HOME}
+ sed -i -e "s/ *= */=/" -e "s/=\(.*$\)/='\1'/" ${POLICY_HOME}/etc/profile.d/base.conf
+ configure_base
}
function install_controller()
@@ -868,6 +852,7 @@ function installFeatures
if [[ -r "${featureConf}" ]]; then
configure_component "${featureConf}" "${FEATURES_HOME}"
cp "${featureConf}" "${POLICY_HOME}"/etc/profile.d
+ sed -i -e "s/ *= */=/" -e "s/=\(.*$\)/='\1'/" "${POLICY_HOME}/etc/profile.d/${featureConf}"
echo "feature ${name} has been installed (configuration present)"
else
echo "feature ${name} has been installed (no configuration present)"
@@ -903,15 +888,12 @@ function do_install()
installFeatures
installArtifacts
+ appInstallers=$(ls apps*installer 2> /dev/null)
+ for appInstaller in ${appInstallers}; do
+ echo "Executing application installer ${appInstaller} .."
+ source ${appInstaller}
+ done
- if [[ -f apps-controlloop-installer ]]; then
- # if exists, any customizations to the
- # base drools installation from the drools apps
- # is executed here
-
- ./apps-controlloop-installer
- fi
-
echo
echo "Installation complete"
echo "Please logoff and login again to update shell environment"
diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf
index dd9e7c56..bd5c5e88 100644
--- a/packages/install/src/files/base.conf
+++ b/packages/install/src/files/base.conf
@@ -22,33 +22,37 @@
POLICY_HOME=/opt/app/policy
POLICY_LOGS=/opt/app/policy/logs
-JAVA_HOME=/opt/jdk1.8.0_77
-M2_HOME=/opt/app/policy/3rdparty/apache-maven-3.3.1
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
KEYSTORE_PASSWD=Pol1cy_0nap
TRUSTSTORE_PASSWD=Pol1cy_0nap
# Telemetry credentials
-ENGINE_MANAGEMENT_PORT=9696
-ENGINE_MANAGEMENT_HOST=0.0.0.0
-ENGINE_MANAGEMENT_USER=
-ENGINE_MANAGEMENT_PASSWORD=
+TELEMETRY_PORT=9696
+TELEMETRY_HOST=0.0.0.0
+TELEMETRY_USER=
+TELEMETRY_PASSWORD=
# nexus repository
-# To use a Nexus repository for rules artifacts,
-# following properties must be uncommented and set:
-#repositoryID=policy-nexus
-#repositoryUrl=http://....(URL for the repository goes here)
-#repositoryUsername=(nexus username goes here)
-#repositoryPassword=(password goes here)
+SNAPSHOT_REPOSITORY_ID=
+SNAPSHOT_REPOSITORY_URL=
+RELEASE_REPOSITORY_ID=
+REPOSITORY_USERNAME=
+REPOSITORY_PASSWORD=
-# Relational (SQL) DB access
+# Relational (SQL) DB access
SQL_HOST=
SQL_USER=
SQL_PASSWORD=
+# AAF
+
+AAF=false
+AAF_NAMESPACE=org.onap.policy
+AAF_HOST=aaf-onap-test.osaaf.org
+
# PDP-D DMaaP configuration channel
PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION
@@ -59,11 +63,6 @@ PDPD_CONFIGURATION_CONSUMER_GROUP=
PDPD_CONFIGURATION_CONSUMER_INSTANCE=
PDPD_CONFIGURATION_PARTITION_KEY=
-# AAF
-
-AAF_NAMESPACE=org.onap.policy
-AAF_HOST=aaf-onap-test.osaaf.org
-
# PAP
PAP_HOST=
@@ -75,12 +74,40 @@ PAP_PASSWORD=
PDP_HOST=
PDP_USERNAME=
PDP_PASSWORD=
+PDP_CLIENT_USERNAME=
+PDP_CLIENT_PASSWORD=
+PDP_ENVIRONMENT=
# DCAE DMaaP
DCAE_TOPIC=
DCAE_SERVERS=
+DCAE_CONSUMER_GROUP=
# Open DMaaP
DMAAP_SERVERS=
+
+# AAI
+
+AAI_URL=
+AAI_USERNAME=
+AAI_PASSWORD=
+
+# MSO
+
+SO_URL=
+SO_USERNAME=
+SO_PASSWORD=
+
+# VFC
+
+VFC_URL=
+VFC_USERNAME=
+VFC_PASSWORD=
+
+# SDNC
+
+SDNC_URL=
+SDNC_USERNAME=
+SDNC_PASSWORD=