-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
44 changed files
with
4,950 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/bin/bash | ||
|
||
function processor_setup() { | ||
echo "install processor into ${out_path} " | ||
|
||
#create processor list | ||
mkdir -p ${out_path} | ||
cp -r ./* ${out_path}/ | ||
rm -f ${out_path}/install-processor.sh | ||
|
||
if [[ -z ${server_port} ]];then | ||
echo "server_port is empty." | ||
echo "set server_port failed" | ||
exit 1 | ||
else | ||
sed -i "/server.port*/cserver.port=${server_port}" ${out_path}/conf/application-prod.properties | ||
fi | ||
echo "set server_port success" | ||
|
||
if [[ -z ${mysql_ip} ]];then | ||
echo "mysql_ip is empty." | ||
echo "set mysql_ip failed" | ||
exit 1 | ||
else | ||
sed -i "s/127.0.0.1:3306/${mysql_ip}:3306/" ${out_path}/conf/application-prod.properties | ||
fi | ||
echo "set mysql_ip success" | ||
|
||
if [[ -z ${mysql_port} ]];then | ||
echo "mysql_port is empty." | ||
echo "set mysql_port failed" | ||
exit 1 | ||
else | ||
sed -i "s/3306/${mysql_port}/" ${out_path}/conf/application-prod.properties | ||
fi | ||
echo "set mysql_port success" | ||
|
||
if [[ -z ${mysql_user} ]];then | ||
echo "mysql_user is empty." | ||
echo "set mysql_user failed" | ||
exit 1 | ||
else | ||
sed -i "s/xxxx/${mysql_user}/" ${out_path}/conf/application-prod.properties | ||
fi | ||
echo "set mysql_user success" | ||
|
||
if [[ -z ${mysql_pwd} ]];then | ||
echo "mysql_pwd is empty" | ||
echo "set mysql_pwd failed" | ||
exit 1 | ||
else | ||
sed -i "s/yyyy/${mysql_pwd}/" ${out_path}/conf/application-prod.properties | ||
fi | ||
echo "set mysql_pwd success" | ||
|
||
|
||
# init db, create database and tables | ||
cd ${out_path} | ||
./init-processor.sh | ||
if [[ $? -ne 0 ]];then | ||
echo "Error,init mysql fail" | ||
exit 1 | ||
fi | ||
echo "init db success" | ||
|
||
echo "processor module install success" | ||
} | ||
|
||
#get parameter | ||
para="" | ||
|
||
# usage | ||
if [[ $# -lt 2 ]]; then | ||
echo "Usage:" | ||
echo " $0 --out_path /data/app/weevent-install/processor " | ||
echo " --server_port --mysql_ip --mysql_port --mysql_user --mysql_pwd " | ||
exit 1 | ||
fi | ||
|
||
server_port="" | ||
mysql_ip="" | ||
mysql_port="" | ||
mysql_user="" | ||
mysql_pwd="" | ||
out_path="" | ||
current_path=$(pwd) | ||
echo "current path $current_path" | ||
|
||
while [[ $# -ge 2 ]] ; do | ||
case "$1" in | ||
--out_path) para="$1 = $2;";out_path="$2";shift 2;; | ||
--server_port) para="$1 = $2;";server_port="$2";shift 2;; | ||
--mysql_ip) para="$1 = $2;";mysql_ip="$2";shift 2;; | ||
--mysql_port) para="$1 = $2;";mysql_port="$2";shift 2;; | ||
--mysql_user) para="$1 = $2;";mysql_user="$2";shift 2;; | ||
--mysql_pwd) para="$1 = $2;";mysql_pwd="$2";shift 2;; | ||
*) echo "unknown parameter $1." ; exit 1 ; break;; | ||
esac | ||
done | ||
|
||
processor_setup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
apply plugin: "org.springframework.boot" | ||
apply plugin: "io.spring.dependency-management" | ||
|
||
dependencies { | ||
// spring boot | ||
implementation("org.springframework.boot:spring-boot-starter") | ||
|
||
implementation("org.springframework.boot:spring-boot-starter-web") | ||
|
||
runtime('mysql:mysql-connector-java') | ||
|
||
// spring boot with log4j2 | ||
implementation("org.springframework.boot:spring-boot-starter-log4j2") | ||
|
||
// avoid "Log4j appears to be running in a Servlet environment, but there's no log4j-web module available." | ||
implementation("org.apache.logging.log4j:log4j-web:2.11.2") | ||
|
||
implementation("org.mybatis.spring.boot:mybatis-spring-boot-starter:1.1.1") | ||
|
||
implementation("org.apache.tomcat:tomcat-jdbc:8.5.23"); | ||
|
||
implementation("log4j:log4j:1.2.17") | ||
|
||
implementation("com.webank.weevent:weevent-client:1.0.0") | ||
|
||
//fastjson | ||
implementation("com.alibaba:fastjson:1.2.47") | ||
|
||
// redis | ||
implementation("redis.clients:jedis:3.0.1") | ||
|
||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
|
||
implementation("org.apache.commons:commons-pool2:2.7.0") | ||
|
||
implementation("org.apache.commons:commons-jexl3:3.1") | ||
|
||
implementation("org.springframework:spring-context-support") | ||
// https://mvnrepository.com/artifact/org.quartz-scheduler/quartz | ||
implementation("org.quartz-scheduler:quartz:2.2.1") | ||
} | ||
|
||
bootJar { | ||
destinationDir file("dist/apps") | ||
archiveName project.name + "-" + version + ".jar" | ||
|
||
// thin spring boot jar | ||
excludes = ["*.jar"] | ||
|
||
doLast { | ||
copy { | ||
from file("src/main/resources/") | ||
into "dist/conf" | ||
} | ||
copy { | ||
from configurations.runtimeClasspath | ||
into "dist/lib" | ||
} | ||
} | ||
} | ||
//mybatis generator plugin ------ start | ||
buildscript { | ||
repositories { | ||
maven { | ||
url "https://plugins.gradle.org/m2/" | ||
} | ||
} | ||
dependencies { | ||
classpath "gradle.plugin.com.arenagod.gradle:mybatis-generator-plugin:1.4" | ||
} | ||
} | ||
|
||
apply plugin: "com.arenagod.gradle.MybatisGenerator" | ||
|
||
configurations { | ||
mybatisGenerator | ||
} | ||
|
||
mybatisGenerator { | ||
verbose = true | ||
configFile = 'src/main/resources/tools/generatorConfig.xml' | ||
} |
Oops, something went wrong.