summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortangpeng <tang.peng5@zte.com.cn>2017-02-21 16:42:42 +0800
committertangpeng <tang.peng5@zte.com.cn>2017-02-21 16:46:30 +0800
commit9c14e8bc2360c0098a23486ea71fc5c99e2fd64e (patch)
treec21b6b4f284e0924e9b0b610f921da2263350bff
parentf7907354daf58f6a729556e21ba01cae777de0be (diff)
Add holmes-engine-d-standalone module
Change-Id: I92203b32eac0888ba6df0328a6bc0a918909e3b3 Issue-Id:HOLMES-45 Signed-off-by: tangpeng <tang.peng5@zte.com.cn>
-rw-r--r--engine-d-standalone/pom.xml168
-rw-r--r--engine-d-standalone/src/main/assembly/bin/find_kill_process.bat24
-rw-r--r--engine-d-standalone/src/main/assembly/bin/initDB.bat34
-rw-r--r--engine-d-standalone/src/main/assembly/bin/initDB.sh34
-rw-r--r--engine-d-standalone/src/main/assembly/bin/run.bat41
-rw-r--r--engine-d-standalone/src/main/assembly/bin/run.sh35
-rw-r--r--engine-d-standalone/src/main/assembly/bin/stop.bat34
-rw-r--r--engine-d-standalone/src/main/assembly/bin/stop.sh44
-rw-r--r--engine-d-standalone/src/main/assembly/conf/engine-d.yml72
-rw-r--r--engine-d-standalone/src/main/assembly/dbscripts/mysql/openo-holmes_engine_d-createobj.sql17
-rw-r--r--pom.xml8
11 files changed, 511 insertions, 0 deletions
diff --git a/engine-d-standalone/pom.xml b/engine-d-standalone/pom.xml
new file mode 100644
index 0000000..b6b14e1
--- /dev/null
+++ b/engine-d-standalone/pom.xml
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.openo.holmes.engine-management</groupId>
+ <artifactId>holmes-engine-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>holmes-engine-d-standalone</artifactId>
+ <modelVersion>4.0.0</modelVersion>
+ <name>holmes-engine/holmes-engine-d-standalone</name>
+ <packaging>pom</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-resources-${linux64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${linux64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.bat</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-resources-${win64id}</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${win64outputdir}</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/assembly/</directory>
+ <filtering>false</filtering>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <overwrite>true</overwrite>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-jar-${linux64id}</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.openo.holmes.engine-management</groupId>
+ <artifactId>holmes-engine-d</artifactId>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${linux64outputdir}</outputDirectory>
+ <destFileName>holmes-engine-d.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ <execution>
+ <id>copy-jar-${win64id}</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.openo.holmes.engine-management</groupId>
+ <artifactId>holmes-engine-d</artifactId>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>${win64outputdir}</outputDirectory>
+ <destFileName>holmes-engine-d.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target name="distribution">
+ <tar destfile="${version.output}/${packagename}-${project.version}-linux64.tar.gz" longfile="posix" compression="gzip">
+ <tarfileset dir="target/assembly/linux64" filemode="0644" dirmode="0755">
+ <exclude name="**/*.sh"/>
+ </tarfileset>
+ <tarfileset dir="target/assembly/linux64" filemode="0755" dirmode="0755">
+ <include name="**/*.sh"/>
+ </tarfileset>
+ </tar>
+ <attachartifact file="${version.output}/${packagename}-${project.version}-linux64.tar.gz" classifier="linux64" type="tar.gz"/>
+ <zip destfile="${version.output}/${packagename}-${project.version}-win64.zip" update="true">
+ <zipfileset dir="target/assembly/win64" includes="**"/>
+ </zip>
+ <attachartifact file="${version.output}/${packagename}-${project.version}-win64.zip" classifier="win64" type="zip"/>
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openo.holmes.engine-management</groupId>
+ <artifactId>holmes-engine-d</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/engine-d-standalone/src/main/assembly/bin/find_kill_process.bat b/engine-d-standalone/src/main/assembly/bin/find_kill_process.bat
new file mode 100644
index 0000000..6c61d50
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/find_kill_process.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 %1 | findstr %2 >NUL
+echo ERRORLEVEL=%ERRORLEVEL%
+IF ERRORLEVEL 1 goto findend
+for /f "tokens=1" %%a in (%1) do (
+ echo kill %1
+ taskkill /F /pid %%a
+)
+:findend \ No newline at end of file
diff --git a/engine-d-standalone/src/main/assembly/bin/initDB.bat b/engine-d-standalone/src/main/assembly/bin/initDB.bat
new file mode 100644
index 0000000..29a795c
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/initDB.bat
@@ -0,0 +1,34 @@
+@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
+set HOME=%~dp0
+set user=%1
+set password=%2
+set port=%3
+set host=%4
+echo start init holmes engine-d db
+echo HOME=%HOME%
+set main_path=%HOME%..\
+cd /d %main_path%
+mysql -u%user% -p%password% -P%port% -h%host% < %main_path%\dbscripts\mysql\openo-holmes_engine_d-createobj.sql
+set "err=%errorlevel%"
+if "%err%"=="0" (
+ echo init engine-d db success
+ ) else (
+ echo failed init engine-d db
+ pause
+ ) \ No newline at end of file
diff --git a/engine-d-standalone/src/main/assembly/bin/initDB.sh b/engine-d-standalone/src/main/assembly/bin/initDB.sh
new file mode 100644
index 0000000..7f16c2a
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/initDB.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+#
+# 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`
+HOME=`cd $DIRNAME/; pwd`
+user=$1
+password=$2
+port=$3
+host=$4
+echo "start init holmes engine-d db"
+main_path=$HOME/../
+mysql -u$user -p$password -P$port -h$host <$main_path/dbscripts/mysql/openo-holmes_engine_d-createobj.sql
+sql_result=$?
+if [ $sql_result != 0 ] ; then
+ echo "failed to init engine-d database!"
+ exit 1
+fi
+echo "init engine-d success!"
+exit 0
+
diff --git a/engine-d-standalone/src/main/assembly/bin/run.bat b/engine-d-standalone/src/main/assembly/bin/run.bat
new file mode 100644
index 0000000..89151e8
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/run.bat
@@ -0,0 +1,41 @@
+@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 holmes-engine-d-service
+
+set RUNHOME=%~dp0
+echo ### RUNHOME: %RUNHOME%
+echo ### Starting engine-d-service
+set main_path=%RUNHOME%..\
+cd /d %main_path%
+set JAVA="%JAVA_HOME%\bin\java.exe"
+set port=8312
+set jvm_opts=-Xms50m -Xmx128m
+rem set jvm_opts=%jvm_opts% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=%port%,server=y,suspend=n
+set class_path=%main_path%;%main_path%holmes-engine-d.jar
+echo ### jvm_opts: %jvm_opts%
+echo ### class_path: %class_path%
+
+%JAVA% -classpath %class_path% %jvm_opts% org.openo.holmes.engine.EngineDActiveApp server %main_path%conf/engine-d.yml
+
+IF ERRORLEVEL 1 goto showerror
+exit
+:showerror
+echo WARNING: Error occurred during startup or Server abnormally stopped by way of killing the process,Please check!
+echo After checking, press any key to close
+pause
+exit \ No newline at end of file
diff --git a/engine-d-standalone/src/main/assembly/bin/run.sh b/engine-d-standalone/src/main/assembly/bin/run.sh
new file mode 100644
index 0000000..4a93b50
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/run.sh
@@ -0,0 +1,35 @@
+#
+# 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 @JAVA_HOME@ $JAVA_HOME
+JAVA="$JAVA_HOME/bin/java"
+echo @JAVA@ $JAVA
+main_path=$RUNHOME/../
+cd $main_path
+JAVA_OPTS="-Xms50m -Xmx128m"
+port=8312
+#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
+echo @JAVA_OPTS@ $JAVA_OPTS
+
+class_path="$main_path/:$main_path/holmes-engine-d.jar"
+echo @class_path@ $class_path
+
+"$JAVA" $JAVA_OPTS -classpath "$class_path" org.openo.holmes.engine.EngineDActiveApp server "$main_path/conf/engine-d.yml"
+
diff --git a/engine-d-standalone/src/main/assembly/bin/stop.bat b/engine-d-standalone/src/main/assembly/bin/stop.bat
new file mode 100644
index 0000000..22280e7
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/stop.bat
@@ -0,0 +1,34 @@
+@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 stopping engine-d-service
+
+set HOME=%~dp0
+set Main_Class="org.openo.holmes.engine.EngineDActiveApp"
+
+echo ================== engine-d-service info =============================================
+echo HOME=$HOME
+echo Main_Class=%Main_Class%
+echo ===============================================================================
+
+echo ### Stopping engine-d-service
+cd /d %HOME%
+
+for /f "delims=" %%i in ('"%JAVA_HOME%\bin\jcmd"') do (
+ call find_kill_process "%%i" %Main_Class%
+)
+exit \ No newline at end of file
diff --git a/engine-d-standalone/src/main/assembly/bin/stop.sh b/engine-d-standalone/src/main/assembly/bin/stop.sh
new file mode 100644
index 0000000..8f81bda
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/bin/stop.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+#
+# 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`
+HOME=`cd $DIRNAME/; pwd`
+Main_Class="org.openo.holmes.engine.EngineDActiveApp"
+
+echo ================== engine-d-service info =============================================
+echo HOME=$HOME
+echo Main_Class=$Main_Class
+echo ===============================================================================
+cd $HOME; pwd
+
+echo @WORK_DIR@ $HOME
+
+function save_service_pid(){
+ service_pid=`ps -ef | grep $Main_Class | grep -v grep | awk '{print $2}'`
+ echo @service_pid@ $service_pid
+}
+
+function kill_service_process(){
+ ps -p $service_pid
+ if [ $? == 0 ]; then
+ kill -9 $service_pid
+ fi
+}
+
+save_service_pid;
+echo @C_CMD@ kill -9 $service_pid
+kill_service_process; \ No newline at end of file
diff --git a/engine-d-standalone/src/main/assembly/conf/engine-d.yml b/engine-d-standalone/src/main/assembly/conf/engine-d.yml
new file mode 100644
index 0000000..247ac4b
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/conf/engine-d.yml
@@ -0,0 +1,72 @@
+#
+# 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.
+#
+server:
+ type: simple
+ rootPath: '/api/holmes-engine/v1/*'
+ applicationContextPath: /
+ adminContextPath: /admin
+ connector:
+ type: http
+ port: 12003
+
+
+# Logging settings.
+logging:
+
+ # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
+ level: INFO
+
+ # Logger-specific levels.
+ loggers:
+
+ # Sets the level for 'com.example.app' to DEBUG.
+ com.example: DEBUG
+
+ appenders:
+ - type: console
+ threshold: INFO
+ timeZone: UTC
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ - type: file
+ threshold: INFO
+ logFormat: "%d{yyyy-MM-dd HH:mm:ss SSS} %-5p [%c][%t] - %m%n"
+ currentLogFilename: ../logs/holmes-engine-d.log
+ archivedLogFilenamePattern: ../logs/zip/holmes-engine-d-%d{yyyy-MM-dd}.log.gz
+ archivedFileCount: 7
+
+
+database:
+ driverClass: com.mysql.jdbc.Driver
+ user: root
+ password: root321
+# url: jdbc:mysql://${db_ip}:${db_port}/mysql?useUnicode=relationtesttrue&characterEncoding=UTF8
+ url: jdbc:mysql://10.74.156.206:3306/mysql?useUnicode=true&characterEncoding=UTF8
+ properties:
+ charSet: UTF-8
+ maxWaitForConnection: 1s
+ validationQuery: "/* MyService Health Check */ SELECT 1"
+ minSize: 8
+ maxSize: 100
+ checkConnectionWhileIdle: false
+ evictionInterval: 10s
+ minIdleTime: 1s
+
+mqConfig:
+ brokerIp: 127.0.0.1
+ brokerPort: 61616
+ mqServiceName: activemq
+ mqServiceVersion: v1
+
diff --git a/engine-d-standalone/src/main/assembly/dbscripts/mysql/openo-holmes_engine_d-createobj.sql b/engine-d-standalone/src/main/assembly/dbscripts/mysql/openo-holmes_engine_d-createobj.sql
new file mode 100644
index 0000000..4f5294a
--- /dev/null
+++ b/engine-d-standalone/src/main/assembly/dbscripts/mysql/openo-holmes_engine_d-createobj.sql
@@ -0,0 +1,17 @@
+--
+-- 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.
+--
+
+
diff --git a/pom.xml b/pom.xml
index 6e90aa4..89c3963 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,7 @@
<name>holmes-engine-parent</name>
<modules>
<module>engine-d</module>
+ <module>engine-d-standalone</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -54,6 +55,13 @@
<jaxrs.consumer.version>5.0</jaxrs.consumer.version>
<slf4j.version>1.6.1</slf4j.version>
<quartz.version>2.2.1</quartz.version>
+
+ <packagename>openo-holmes-engine-d</packagename>
+ <linux64id>linux64</linux64id>
+ <win64id>win64</win64id>
+ <linux64outputdir>target/assembly/${linux64id}</linux64outputdir>
+ <win64outputdir>target/assembly/${win64id}</win64outputdir>
+ <version.output>target/version</version.output>
</properties>
<dependencyManagement>
<dependencies>