[POLICY-66] healtcheck feature config and db prep 47/6547/2
authorJorge Hernandez <jh1730@att.com>
Wed, 2 Aug 2017 14:58:13 +0000 (09:58 -0500)
committerJorge Hernandez <jh1730@att.com>
Wed, 2 Aug 2017 15:25:43 +0000 (10:25 -0500)
initial commit pre-introduction of db support on per feature basis

Change-Id: Ie5aec06d38a84be849386fc76d8f1c804213c803
Signed-off-by: Jorge Hernandez <jh1730@att.com>
config/drools/base.conf
config/drools/drools-tweaks.sh
config/drools/feature-healthcheck.conf [new file with mode: 0644]
policy-drools/Dockerfile
policy-drools/docker-install.sh

index b8e0d0a..611e1f7 100644 (file)
@@ -1,14 +1,39 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP POLICY
+# ================================================================================
+# Copyright (C) 2017 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.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+
+# SYSTEM software configuration 
+
 POLICY_HOME=/opt/app/policy
 JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 KEYSTORE_PASSWD=PolicyR0ck$
 
+# Telemetry credentials
+
 ENGINE_MANAGEMENT_PORT=9696
 ENGINE_MANAGEMENT_HOST=localhost
 ENGINE_MANAGEMENT_USER=@1b3rt
-ENGINE_MANAGEMENT_PASSWORD=31nst@1n
+ENGINE_MANAGEMENT_PASSWORD=31nst31n
+
+# nexus repository
 
-# To use a Nexus repository for rules artifacts,
-# following properties must be uncommented and set:
 snapshotRepositoryID=policy-nexus-snapshots
 snapshotRepositoryUrl=http://nexus:8081/nexus/content/repositories/snapshots/
 releaseRepositoryID=policy-nexus-releases
@@ -16,6 +41,14 @@ releaseRepositoryUrl=http://nexus:8081/nexus/content/repositories/releases/
 repositoryUsername=admin
 repositoryPassword=admin123
 
+# Relational (SQL) DB access 
+
+SQL_HOST=mariadb
+SQL_USER=policy_user
+SQL_PASSWORD=policy_user
+
+# PDP-D DMaaP configuration channel
+
 PDPD_CONFIGURATION_TOPIC=PDPD-CONFIGURATION
 PDPD_CONFIGURATION_SERVERS=vm1.mr.simpledemo.openecomp.org
 PDPD_CONFIGURATION_API_KEY=
@@ -24,3 +57,23 @@ PDPD_CONFIGURATION_CONSUMER_GROUP=
 PDPD_CONFIGURATION_CONSUMER_INSTANCE=
 PDPD_CONFIGURATION_PARTITION_KEY=
 
+# PAP
+
+PAP_HOST=pap
+PAP_USERNAME=testpap
+PAP_PASSWORD=alpha123
+
+# PDP-X
+
+PDP_HOST=pdp
+PDP_USERNAME=testpdp
+PDP_PASSWORD=alpha123
+
+# DCAE DMaaP
+
+DCAE_TOPIC=unauthenticated.TCA_EVENT_OUTPUT
+DCAE_SERVERS=10.0.4.102
+
+# Open DMaaP
+
+DMAAP_SERVERS=vm1.mr.simpledemo.openecomp.org
index ab9f369..09d1341 100755 (executable)
@@ -1,29 +1,6 @@
 #! /bin/bash
 
-# changes for health check
 ${POLICY_HOME}/bin/features enable healthcheck
-sedArgs=("-i")
-while read var value ; do
-       if [[ "${var}" == "" ]] ; then
-               continue
-       fi
-       sedArgs+=("-e" "s@\${{${var}}}@${value}@g")
-done <<-EOF
-       PAP_HOST                pap
-       PAP_USERNAME    testpap
-       PAP_PASSWORD    alpha123
-       PDP_HOST                pdp
-       PDP_USERNAME    testpdp
-       PDP_PASSWORD    alpha123
-EOF
-
-# convert file
-sed "${sedArgs[@]}" ${POLICY_HOME}/config/*health*
-
-cat >>${POLICY_HOME}/config/*health* <<-'EOF'
-       http.server.services.HEALTHCHECK.userName=healthcheck
-       http.server.services.HEALTHCHECK.password=zb!XztG34
-EOF
 
 sed -i -e 's/DCAE-CL-EVENT/unauthenticated.TCA_EVENT_OUTPUT/' \
        -e '/TCA_EVENT_OUTPUT\.servers/s/servers=.*$/servers=10.0.4.102/' \
diff --git a/config/drools/feature-healthcheck.conf b/config/drools/feature-healthcheck.conf
new file mode 100644 (file)
index 0000000..3351b78
--- /dev/null
@@ -0,0 +1,2 @@
+HEALTHCHECK_USER=healthcheck
+HEALTHCHECK_PASSWORD=zb!XztG3
index 9ee0f48..a360b01 100644 (file)
@@ -1,12 +1,21 @@
 FROM onap/policy/policy-base
 
 RUN pip install http-prompt
-RUN mkdir -p /opt/app/policy /tmp/policy-install && chown policy /opt/app/policy /tmp/policy-install
+RUN mkdir -p /opt/app/policy/opt /tmp/policy-install && \
+    chown -R policy /opt/app/policy /tmp/policy-install
+
 WORKDIR /tmp/policy-install
 
 COPY install-drools.zip apps.zip docker-install.sh do-start.sh wait-for-port.sh ./
+ADD http://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/4.2.0/flyway-commandline-4.2.0.tar.gz /opt/app
 
-RUN unzip install-drools.zip && unzip apps.zip && rm install-drools.zip apps.zip && chown -R policy * && chmod +x *.sh
+RUN unzip install-drools.zip && \
+    unzip apps.zip && \
+    rm install-drools.zip apps.zip && \
+    chown -R policy * && \
+    chmod +x *.sh && \
+    ln -s /opt/app/flyway-4.2.0 /opt/app/flyway && \
+    ln -s /opt/app/flyway/flyway /usr/local/bin
 
 USER policy
 CMD ./do-start.sh
index 8bc85c8..281ace1 100644 (file)
@@ -814,8 +814,17 @@ function installFeatures
                        name="${name%-[0-9]*\.zip}"
                        mkdir -p "${FEATURES_HOME}/${name}" > /dev/null 2>&1
                        (cd "${FEATURES_HOME}/${name}"; jar xf ${SOURCE_DIR}/${feature})
+                       featureConf="feature-${name}.conf"
+                       if [[ -r "${featureConf}" ]]; then
+                               configure_component "${featureConf}" "${FEATURES_HOME}"
+                               cp "${featureConf}" "${POLICY_HOME}"/etc/profile.d
+                               echo "feature ${name} has been installed (configuration present)"
+                       else
+                               echo "feature ${name} has been installed (no configuration present)"
+                       fi
                done
                
+               echo "applying base configuration to features"
                configure_component "${BASE_CONF}" "${FEATURES_HOME}"
        else
                echo "error: aborting ${FEATURES_HOME} is not accessible"