summaryrefslogtreecommitdiffstats
path: root/src/main/swm
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/swm')
-rw-r--r--src/main/swm/common/common.env21
-rw-r--r--src/main/swm/common/deinstall.env1
-rw-r--r--src/main/swm/common/deinstall_postproc.sh26
-rw-r--r--src/main/swm/common/deinstall_preproc.sh26
-rw-r--r--src/main/swm/common/install.env1
-rw-r--r--src/main/swm/common/install_postproc.sh26
-rw-r--r--src/main/swm/common/install_preproc.sh26
-rw-r--r--src/main/swm/common/localize.sh170
-rw-r--r--src/main/swm/deinstall/postproc/post_proc4
-rw-r--r--src/main/swm/deinstall/preproc/pre_proc8
-rw-r--r--src/main/swm/descriptor.xml46
-rw-r--r--src/main/swm/fallback/postproc/post_proc4
-rw-r--r--src/main/swm/fallback/preproc/pre_proc4
-rw-r--r--src/main/swm/initinst/postproc/post_proc6
-rw-r--r--src/main/swm/initinst/preproc/pre_proc6
-rw-r--r--src/main/swm/install/postproc/post_proc24
-rw-r--r--src/main/swm/install/preproc/pre_proc17
17 files changed, 416 insertions, 0 deletions
diff --git a/src/main/swm/common/common.env b/src/main/swm/common/common.env
new file mode 100644
index 0000000..e788212
--- /dev/null
+++ b/src/main/swm/common/common.env
@@ -0,0 +1,21 @@
+export ROOT_DIR=${INSTALL_ROOT}opt/app/workload/fe3c/cambria
+
+OS=`uname`
+
+if [ "${OS}" = "SunOS" ]; then
+ CURRENT_USER=`/usr/xpg4/bin/id -un`
+ CURRENT_GROUP=`/usr/xpg4/bin/id -gn`
+else
+ CURRENT_USER=`id -un`
+ CURRENT_GROUP=`id -gn`
+fi
+
+export CURRENT_USER CURRENT_GROUP
+
+# Fail - used to quickly exit with a rc and error message
+fail() {
+ rc=$1
+ shift;
+ echo "ERROR: $@"
+ exit $rc
+}
diff --git a/src/main/swm/common/deinstall.env b/src/main/swm/common/deinstall.env
new file mode 100644
index 0000000..43a8d00
--- /dev/null
+++ b/src/main/swm/common/deinstall.env
@@ -0,0 +1 @@
+. `dirname $0`/common.env
diff --git a/src/main/swm/common/deinstall_postproc.sh b/src/main/swm/common/deinstall_postproc.sh
new file mode 100644
index 0000000..51d1b4c
--- /dev/null
+++ b/src/main/swm/common/deinstall_postproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/deinstall.env
+
+exit 0
diff --git a/src/main/swm/common/deinstall_preproc.sh b/src/main/swm/common/deinstall_preproc.sh
new file mode 100644
index 0000000..51d1b4c
--- /dev/null
+++ b/src/main/swm/common/deinstall_preproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/deinstall.env
+
+exit 0
diff --git a/src/main/swm/common/install.env b/src/main/swm/common/install.env
new file mode 100644
index 0000000..6dbd12c
--- /dev/null
+++ b/src/main/swm/common/install.env
@@ -0,0 +1 @@
+#NOOP \ No newline at end of file
diff --git a/src/main/swm/common/install_postproc.sh b/src/main/swm/common/install_postproc.sh
new file mode 100644
index 0000000..4166481
--- /dev/null
+++ b/src/main/swm/common/install_postproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/install.env
+
+exit 0
diff --git a/src/main/swm/common/install_preproc.sh b/src/main/swm/common/install_preproc.sh
new file mode 100644
index 0000000..4166481
--- /dev/null
+++ b/src/main/swm/common/install_preproc.sh
@@ -0,0 +1,26 @@
+#!/bin/sh -x
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+
+. `dirname $0`/install.env
+
+exit 0
diff --git a/src/main/swm/common/localize.sh b/src/main/swm/common/localize.sh
new file mode 100644
index 0000000..c6aa5ed
--- /dev/null
+++ b/src/main/swm/common/localize.sh
@@ -0,0 +1,170 @@
+#!/bin/sh
+#*******************************************************************************
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright © 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=========================================================
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+#
+#*******************************************************************************
+FINAL_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties
+TEMPLATE_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi_template.properties
+BACKUP1_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties.bk.1
+BACKUP2_CONFIG_FILE=${ROOT_DIR}/etc/cambriaApi.properties.bk.2
+
+echo "Localizing the Cambria API Server configuration"
+
+if [ -z "${ELASTICSEARCH_NODES}" ]; then
+ echo "ERROR: ELASTICSEARCH_NODES must be set"; exit 1
+fi
+
+if [ -z "${ZOOKEEPER_ENSEMBLE}" ]; then
+ echo "ERROR: ZOOKEEPER_ENSEMBLE must be set"; exit 2
+fi
+
+if [ -z "${ZOOKEEPER_CLIENT_PORT}" ]; then
+ ZOOKEEPER_CLIENT_PORT=2181
+fi
+
+if [ -z "${CAMBRIA_SERVICE_PORT}" ]; then
+ CAMBRIA_SERVICE_PORT=3904
+fi
+
+if [ -z "${CAMBRIA_BROKER_TYPE}" ]; then
+ CAMBRIA_BROKER_TYPE=kafka
+fi
+
+if [ -z "${KAFKA_PORT}" ]; then
+ KAFKA_PORT=9092
+fi
+
+if [ -z "${KAFKA_BROKER_LIST}" ]; then
+ KAFKA_BROKER_LIST=localhost:${KAFKA_PORT}
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_CONFIG_FILE} ]; then
+ cp -f ${BACKUP1_CONFIG_FILE} ${BACKUP2_CONFIG_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_CONFIG_FILE} to ${BACKUP2_CONFIG_FILE}"
+ exit 5
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_CONFIG_FILE} ]; then
+ cp -f ${FINAL_CONFIG_FILE} ${BACKUP1_CONFIG_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_CONFIG_FILE} to ${BACKUP1_CONFIG_FILE}"
+ exit 6
+ }
+fi
+
+CAMBRIA_ZOOKEEPER_NODES=`echo ${ZOOKEEPER_ENSEMBLE} | sed -e "s/ /:${ZOOKEEPER_CLIENT_PORT},/g" | sed -e "s/$/:${ZOOKEEPER_CLIENT_PORT}/g"`
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's/${CAMBRIA_SERVICE_PORT}/'${CAMBRIA_SERVICE_PORT}'/g' \
+ -e 's/${CAMBRIA_BROKER_TYPE}/'${CAMBRIA_BROKER_TYPE}'/g' \
+ -e 's/${KAFKA_BROKER_LIST}/'${KAFKA_BROKER_LIST}'/g' \
+ -e 's/${CAMBRIA_ZOOKEEPER_NODES}/'${CAMBRIA_ZOOKEEPER_NODES}'/g' ${TEMPLATE_CONFIG_FILE} > ${FINAL_CONFIG_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_CONFIG_FILE} into ${FINAL_CONFIG_FILE}"
+ exit 7
+ }
+
+FINAL_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml
+TEMPLATE_LOG4J_FILE=${ROOT_DIR}/etc/log4j_template.xml
+BACKUP1_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml.bk.1
+BACKUP2_LOG4J_FILE=${ROOT_DIR}/etc/log4j.xml.bk.2
+
+if [ -z "${CAMBRIA_LOG_DIR}" ]; then
+ CAMBRIA_LOG_DIR=${ROOT_DIR}/logs
+fi
+
+if [ -z "${CAMBRIA_LOG_THRESHOLD}" ]; then
+ CAMBRIA_LOG_THRESHOLD="INFO"
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_LOG4J_FILE} ]; then
+ cp -f ${BACKUP1_LOG4J_FILE} ${BACKUP2_LOG4J_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_LOG4J_FILE} to ${BACKUP2_LOG4J_FILE}"
+ exit 8
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_LOG4J_FILE} ]; then
+ cp -f ${FINAL_LOG4J_FILE} ${BACKUP1_LOG4J_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_LOG4J_FILE} to ${BACKUP1_LOG4J_FILE}"
+ exit 9
+ }
+fi
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's/${CAMBRIA_LOG_THRESHOLD}/'${CAMBRIA_LOG_THRESHOLD}'/g' \
+ -e 's,${CAMBRIA_LOG_DIR},'${CAMBRIA_LOG_DIR}',g' ${TEMPLATE_LOG4J_FILE} > ${FINAL_LOG4J_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_LOG4J_FILE} into ${FINAL_LOG4J_FILE}"
+ exit 10
+ }
+
+FINAL_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf
+TEMPLATE_LOGSTASH_FILE=${ROOT_DIR}/etc/logstash_cambria_template.conf
+BACKUP1_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf.bk.1
+BACKUP2_LOGSTASH_FILE=${ROOT_DIR}/etc/messages.conf.bk.2
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF PREVIOUS BACKUP FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${BACKUP1_LOGSTASH_FILE} ]; then
+ cp -f ${BACKUP1_LOGSTASH_FILE} ${BACKUP2_LOGSTASH_FILE} || {
+ echo "ERROR: Could not copy ${BACKUP1_LOGSTASH_FILE} to ${BACKUP2_LOGSTASH_FILE}"
+ exit 11
+ }
+fi
+
+#------------------------------------------------------------------------
+#- MAKE A BACKUP OF CURRENT FILE, IF EXISTS
+#------------------------------------------------------------------------
+if [ -f ${FINAL_LOGSTASH_FILE} ]; then
+ cp -f ${FINAL_LOGSTASH_FILE} ${BACKUP1_LOGSTASH_FILE} || {
+ echo "ERROR: Could not copy ${FINAL_LOGSTASH_FILE} to ${BACKUP1_LOGSTASH_FILE}"
+ exit 12
+ }
+fi
+
+#------------------------------------------------------------------------
+#- PROCESS THE TEMPLATE
+#------------------------------------------------------------------------
+sed -e 's,${CAMBRIA_SERVER_LOG},'${CAMBRIA_LOG_DIR}/cambria.log',g' \
+ -e 's/${ELASTICSEARCH_NODES}/'${ELASTICSEARCH_NODES}'/g' ${TEMPLATE_LOGSTASH_FILE} > ${FINAL_LOGSTASH_FILE} || {
+ echo "ERROR: Could not process template file ${TEMPLATE_LOGSTASH_FILE} into ${FINAL_LOGSTASH_FILE}"
+ exit 13
+ }
+
+#------------------------------------------------------------------------
+#- CLEAN EXIT
+#------------------------------------------------------------------------
+echo "Localized Successfully."
+exit 0
diff --git a/src/main/swm/deinstall/postproc/post_proc b/src/main/swm/deinstall/postproc/post_proc
new file mode 100644
index 0000000..05021d5
--- /dev/null
+++ b/src/main/swm/deinstall/postproc/post_proc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#cd ../../common
+#exec sh -x ./deinstall_postproc.sh
diff --git a/src/main/swm/deinstall/preproc/pre_proc b/src/main/swm/deinstall/preproc/pre_proc
new file mode 100644
index 0000000..e27b41a
--- /dev/null
+++ b/src/main/swm/deinstall/preproc/pre_proc
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+#source /opt/app/datartr/dmaap1/setJavaHome.sh
+#cd /opt/app/datartr/dmaap1/tomcat_2/apache-tomcat-7.0.64/bin
+#exec sh -x ./startup.sh
+
+#cd ../../common
+#exec sh -x ./deinstall_preproc.sh
diff --git a/src/main/swm/descriptor.xml b/src/main/swm/descriptor.xml
new file mode 100644
index 0000000..2ef3c94
--- /dev/null
+++ b/src/main/swm/descriptor.xml
@@ -0,0 +1,46 @@
+<!--
+ ============LICENSE_START=======================================================
+ org.onap.dmaap
+ ================================================================================
+ Copyright © 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=========================================================
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+
+ -->
+<descriptor xmlns="http://aft.att.com/swm/descriptor" version="1">
+ <platforms>
+ <platform os="Linux" osVersions="*" architecture="*"/>
+ </platforms>
+
+ <paths>
+ <path name="/opt/app/dmaap/msgrtr/jenkinsbuild" type="d" user="msgrtr" group="dmaap" permissions="755" recursive="true"/>
+ </paths>
+
+ <actions>
+ <action type="INST">
+ <proc stage="PRE" user="msgrtr" group="dmaap"/>
+ <proc stage="POST" user="msgrtr" group="dmaap"/>
+ </action>
+ <action type="INIT">
+ <proc stage="PRE" user="msgrtr" group="dmaap"/>
+ <proc stage="POST" user="msgrtr" group="dmaap"/>
+ </action>
+ <action type="DINST">
+ <proc stage="PRE" user="msgrtr" group="dmaap"/>
+ <proc stage="POST" user="msgrtr" group="dmaap"/>
+ </action>
+ </actions>
+
+</descriptor>
diff --git a/src/main/swm/fallback/postproc/post_proc b/src/main/swm/fallback/postproc/post_proc
new file mode 100644
index 0000000..d017750
--- /dev/null
+++ b/src/main/swm/fallback/postproc/post_proc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd ../../common
+exec sh -x ./install_postproc.sh
diff --git a/src/main/swm/fallback/preproc/pre_proc b/src/main/swm/fallback/preproc/pre_proc
new file mode 100644
index 0000000..3f1b26f
--- /dev/null
+++ b/src/main/swm/fallback/preproc/pre_proc
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd ../../common
+exec sh -x ./install_preproc.sh
diff --git a/src/main/swm/initinst/postproc/post_proc b/src/main/swm/initinst/postproc/post_proc
new file mode 100644
index 0000000..afbabdd
--- /dev/null
+++ b/src/main/swm/initinst/postproc/post_proc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+exec sh -x ../../install/postproc/post_proc
+
+#cd ../../common
+#exec sh -x ./install_postproc.sh
diff --git a/src/main/swm/initinst/preproc/pre_proc b/src/main/swm/initinst/preproc/pre_proc
new file mode 100644
index 0000000..2588a94
--- /dev/null
+++ b/src/main/swm/initinst/preproc/pre_proc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+#exec sh -x ../../install/preproc/pre_proc
+
+#cd ../../common
+#exec sh -x ./install_preproc.sh
diff --git a/src/main/swm/install/postproc/post_proc b/src/main/swm/install/postproc/post_proc
new file mode 100644
index 0000000..7954fb1
--- /dev/null
+++ b/src/main/swm/install/postproc/post_proc
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+echo "Calling common script to set up environment"
+#source ../../common/common.env
+echo "Common environment set up"
+
+#source /opt/app/datartr/dmaap1/setJavaHome.sh
+
+echo "moving DMaaP.war"
+cd /opt/app/dmaap/msgrtr/jenkinsbuild/lib
+mv DMaaP.war /opt/app/dmaap/msgrtr/jenkinsbuild
+cd /opt/app/dmaap/msgrtr/jenkinsbuild
+rm -r lib
+rm -r bin
+rm -r etc
+
+#echo "swm testing"
+#cd /opt/app/datartr/dmaap1/tomcat_2/apache-tomcat-7.0.64/bin
+#exec sh -x ./startup.sh
+#echo "tomcat started"
+
+#Run common install tasks
+#cd ../../common
+#exec sh -x ./install_postproc.sh
diff --git a/src/main/swm/install/preproc/pre_proc b/src/main/swm/install/preproc/pre_proc
new file mode 100644
index 0000000..ffd71e3
--- /dev/null
+++ b/src/main/swm/install/preproc/pre_proc
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#echo "Calling common script to set up environment"
+#source ../../common/common.env
+#source /opt/app/datartr/dmaap1/setJavaHome.sh
+#echo "Common environment set up"
+
+#echo "swm testing"
+#cd /opt/app/datartr/dmaap1/tomcat_2/apache-tomcat-7.0.64/bin
+#exec sh -x ./shutdown.sh
+#echo "tomcat stopped"
+
+
+
+#echo "Running common install pre proc"
+#cd ../../common
+#exec sh -x ./install_preproc.sh