From 8a2751aaa3c1367cdf70a6fa2d0b9ad39f311b0b Mon Sep 17 00:00:00 2001
From: lizi00164331
Date: Wed, 13 Sep 2017 21:34:18 +0800
Subject: Add tomcat server to esr-server.
Change-Id: Id6148623e7d15fef60648fe51124d65f58978167
Issue-ID: AAI-291
Signed-off-by: lizi00164331
---
integration/pom.xml | 157 +++++++++++++++++-------
integration/src/main/assembly/monitor.sh | 75 +++++++++++
integration/src/main/assembly/shutdown.bat | 24 ++++
integration/src/main/assembly/shutdown.sh | 27 ++++
integration/src/main/assembly/startup.bat | 26 ++++
integration/src/main/assembly/startup.sh | 29 +++++
integration/src/main/assembly/startup4docker.sh | 30 +++++
integration/src/main/webapp/WEB-INF/web.xml | 2 +-
8 files changed, 328 insertions(+), 42 deletions(-)
create mode 100644 integration/src/main/assembly/monitor.sh
create mode 100644 integration/src/main/assembly/shutdown.bat
create mode 100644 integration/src/main/assembly/shutdown.sh
create mode 100644 integration/src/main/assembly/startup.bat
create mode 100644 integration/src/main/assembly/startup.sh
create mode 100644 integration/src/main/assembly/startup4docker.sh
(limited to 'integration')
diff --git a/integration/pom.xml b/integration/pom.xml
index 4f737cb..b4cef04 100644
--- a/integration/pom.xml
+++ b/integration/pom.xml
@@ -23,13 +23,18 @@
4.0.0
aai-esr-gui-integration
- war
+ pom
esr-gui/integration
- esrui
+ esr-gui
1.1.2
1.7.6
+ linux64
+ win64
+ target/assembly/${linux64id}
+ target/assembly/${win64id}
+ target/version
@@ -88,69 +93,139 @@
org.onap.aai.esr-gui
- esr
- 1.0.0-SNAPSHOT
- war
+ httpserver
+ ${project.version}
+ zip
- esrui
- org.apache.maven.plugins
- maven-war-plugin
-
- WEB-INF/web.xml
-
-
- org.onap.aai.esr-gui
- common
-
-
- org.onap.aai.esr-gui
- esr
-
-
-
+ maven-resources-plugin
+
+
+ copy-resources-${linux64id}
+ process-resources
+
+ copy-resources
+
+
+ ${linux64outputdir}
+
+
+ src/main/assembly/
+ false
+
+ **/*
+
+
+ **/*.bat
+
+
+
+ true
+
+
+
+ copy-resources-${win64id}
+ process-resources
+
+ copy-resources
+
+
+ ${win64outputdir}
+
+
+ src/main/assembly/
+ false
+
+ **/*
+
+
+ **/*.sh
+
+
+
+ true
+
+
+
org.apache.maven.plugins
- maven-antrun-plugin
-
+ maven-dependency-plugin
+
- zip
- package
+ unpack-httpserver-${linux64id}
- run
+ unpack
+ prepare-package
-
-
-
-
-
+
+
+ org.onap.aai.esr-gui
+ httpserver
+ zip
+
+
+ **/*.bat,*.cmd
+ ${linux64outputdir}
+ false
+ true
+ true
+
+
+
+ unpack-httpserver-${win64id}
+
+ unpack
+
+ prepare-package
+
+
+
+ org.onap.aai.esr-gui
+ httpserver
+ zip
+
+
+ *.sh,*/*.sh,*/*/*.sh
+ ${win64outputdir}
+ false
+ true
+ true
- org.codehaus.mojo
- build-helper-maven-plugin
+ org.apache.maven.plugins
+ maven-antrun-plugin
- attach-artifacts
+ distribution
package
- attach-artifact
+ run
-
-
- target/${packagename}-${project.version}.zip
- zip
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/integration/src/main/assembly/monitor.sh b/integration/src/main/assembly/monitor.sh
new file mode 100644
index 0000000..9cac87a
--- /dev/null
+++ b/integration/src/main/assembly/monitor.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+DIRNAME=`dirname $0`
+RUNHOME=`cd $DIRNAME/; pwd`
+LOG_DIR=${RUNHOME}/tomcat/logs
+
+RETRY=$1
+CURL_RETRY_COUNT=1
+SLEEP_SECONDS_IN_MONITOR=2
+
+if [ x"$HTTP_OVERWRITE_PORT" == x"" ]; then
+ apds_port=80
+else
+ apds_port=$HTTP_OVERWRITE_PORT
+fi
+
+#####################################
+echo @RUNHOME@ $RUNHOME
+echo @LOG_DIR@ $LOG_DIR
+echo @apds_port@ $apds_port
+#####################################
+
+print_log() {
+ LOG_DATE=`date "+%Y-%m-%d %H:%M:%S"`
+ LOG_FILENAME="$LOG_DIR/apds-monitor-`date "+%Y-%m-%d"`.log"
+ ######[$$]:进程id
+ ###### $n 传递给脚本或函数的参数, $1为函数名称,默认为FUNCNAME[0] $2为日志输出内容
+ ###### $? 函数的返回值
+ ###### FUNCNAME[@]: 函数调用栈,
+ ###### {} 第一个空格后在写脚本
+ { echo -e $LOG_DATE "[$$]===${FUNCNAME[@]}=== $2 "; } >> $LOG_FILENAME
+}
+
+apds_monitor() {
+ print_log ${FUNCNAME[0]} "Starting health check. ==$1==";
+ if [ "$1" == "with-retry" ]; then
+ CURL_RETRY_COUNT=5
+ fi
+
+ for i in `seq $CURL_RETRY_COUNT`
+ do
+ success=0
+ response=$(curl -m 2 -sL 127.0.0.1:$apds_port/blueprint/readme.txt -w %{http_code} -o /dev/null)
+ rc=$?
+ if [ $rc -eq 0 ];then
+ print_log "${FUNCNAME[0]}" "Info: Curl to health check endpoint succeeded.";
+ success=1
+ break
+ else
+ print_log "${FUNCNAME[0]}" "Warn: Curl to health check endpoint failed $i time(s).";
+ if [ "$1" == "with-retry" ]; then
+ sleep $SLEEP_SECONDS_IN_MONITOR
+ fi
+ fi
+ done
+
+ if [ $success -eq 0 ];then
+ print_log "${FUNCNAME[0]}" "Failed: health check Endpoint is unreachable.";
+ return 1
+ fi
+
+ if [ $response -eq 200 ]; then
+ print_log "${FUNCNAME[0]}" "health check succeed.";
+ return 0
+ fi
+
+ print_log "${FUNCNAME[0]}" "Failed:health check return non 200 but is : $response ";
+ return 1
+}
+
+if [ ! -d "$LOG_DIR" ]; then
+ echo there is no $LOG_DIR but will be created, You can ignore this message!
+ mkdir -p "$LOG_DIR"
+fi
+
+apds_monitor $RETRY
diff --git a/integration/src/main/assembly/shutdown.bat b/integration/src/main/assembly/shutdown.bat
new file mode 100644
index 0000000..c2178a3
--- /dev/null
+++ b/integration/src/main/assembly/shutdown.bat
@@ -0,0 +1,24 @@
+@REM
+@REM Copyright 2017 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+title catalog
+
+set RUNHOME=%~dp0
+echo ##RUNHOME %RUNHOME%
+
+echo ### shutdown blueprint
+start /D %RUNHOME%tomcat bin\shutdown.bat
diff --git a/integration/src/main/assembly/shutdown.sh b/integration/src/main/assembly/shutdown.sh
new file mode 100644
index 0000000..d1762c7
--- /dev/null
+++ b/integration/src/main/assembly/shutdown.sh
@@ -0,0 +1,27 @@
+#
+# Copyright 2017 ZTE Corporation.
+#
+# 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.
+#
+
+DIRNAME=`dirname $0`
+RUNHOME=`cd $DIRNAME/; pwd`
+echo @RUNHOME@ $RUNHOME
+
+echo "### shutdown blueprint";
+cd $RUNHOME
+cd ./tomcat
+export CATALINA_HOME=$RUNHOME/tomcat
+export CATALINA_BASE=$RUNHOME/tomcat
+$RUNHOME/tomcat/bin/shutdown.sh &
+echo "### shutdown blueprint end";
diff --git a/integration/src/main/assembly/startup.bat b/integration/src/main/assembly/startup.bat
new file mode 100644
index 0000000..52bfe3c
--- /dev/null
+++ b/integration/src/main/assembly/startup.bat
@@ -0,0 +1,26 @@
+@REM
+@REM Copyright 2017 ZTE Corporation.
+@REM
+@REM Licensed under the Apache License, Version 2.0 (the "License");
+@REM you may not use this file except in compliance with the License.
+@REM You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+@REM
+
+@echo off
+title catalog
+
+set RUNHOME=%~dp0
+echo ##RUNHOME %RUNHOME%
+
+set CATALINA_HOME=%RUNHOME%tomcat
+set CATALINA_BASE=%RUNHOME%tomcat
+echo ### Starting tomcat
+start /D %RUNHOME%tomcat bin\startup.bat
diff --git a/integration/src/main/assembly/startup.sh b/integration/src/main/assembly/startup.sh
new file mode 100644
index 0000000..d95c99b
--- /dev/null
+++ b/integration/src/main/assembly/startup.sh
@@ -0,0 +1,29 @@
+#
+# Copyright 2017 ZTE Corporation.
+#
+# 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.
+#
+
+
+DIRNAME=`dirname $0`
+RUNHOME=`cd $DIRNAME/; pwd`
+echo @RUNHOME@ $RUNHOME
+echo "### Starting blueprint";
+cd ./tomcat
+if [ ! -d "$RUNHOME/tomcat/logs" ]; then
+ mkdir $RUNHOME/tomcat/logs
+fi
+export CATALINA_HOME=$RUNHOME/tomcat
+export CATALINA_BASE=$RUNHOME/tomcat
+$RUNHOME/tomcat/bin/startup.sh &
+echo "### Starting blueprint end";
diff --git a/integration/src/main/assembly/startup4docker.sh b/integration/src/main/assembly/startup4docker.sh
new file mode 100644
index 0000000..f2adb11
--- /dev/null
+++ b/integration/src/main/assembly/startup4docker.sh
@@ -0,0 +1,30 @@
+#
+# Copyright 2017 ZTE Corporation.
+#
+# 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.
+#
+
+#!/bin/sh
+DIRNAME=`dirname $0`
+RUNHOME=`cd $DIRNAME/; pwd`
+echo @RUNHOME@ $RUNHOME
+echo "### Starting blueprint";
+#cd ./tomcat
+cd $RUNHOME/tomcat
+if [ ! -d "$RUNHOME/tomcat/logs" ]; then
+ mkdir $RUNHOME/tomcat/logs
+fi
+export CATALINA_HOME=$RUNHOME/tomcat
+export CATALINA_BASE=$RUNHOME/tomcat
+$RUNHOME/tomcat/bin/catalina.sh run
+echo "### Starting blueprint end";
diff --git a/integration/src/main/webapp/WEB-INF/web.xml b/integration/src/main/webapp/WEB-INF/web.xml
index 6d677a5..b4ddd68 100644
--- a/integration/src/main/webapp/WEB-INF/web.xml
+++ b/integration/src/main/webapp/WEB-INF/web.xml
@@ -15,7 +15,7 @@
limitations under the License.
-->
- OPEN-O Web Application
+ ONAP Web Application
login/index.html
--
cgit 1.2.3-korg