mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-09 17:34:13 +00:00
chore: add scripts and set tools
This commit is contained in:
parent
6ac402a47e
commit
877dcfe661
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,6 +10,6 @@
|
|||||||
/manager.key
|
/manager.key
|
||||||
/WebContent/
|
/WebContent/
|
||||||
/runnable
|
/runnable
|
||||||
cmconfig.json*
|
/cmconfig.json*
|
||||||
/build/
|
/build/
|
||||||
*/build/*
|
*/build/*
|
0
WebContent/.keep
Normal file
0
WebContent/.keep
Normal file
20
build.gradle
20
build.gradle
@ -36,9 +36,11 @@ dependencies {
|
|||||||
implementation 'io.prometheus:simpleclient_httpserver:0.12.0'
|
implementation 'io.prometheus:simpleclient_httpserver:0.12.0'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
options.compilerArgs<<"-Xlint:unchecked"
|
options.compilerArgs << "-Xlint:unchecked"
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
String libs = ''
|
String libs = ''
|
||||||
configurations.runtimeClasspath.each {
|
configurations.runtimeClasspath.each {
|
||||||
@ -54,8 +56,18 @@ jar {
|
|||||||
|
|
||||||
tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
|
tasks.processResources.setDuplicatesStrategy(DuplicatesStrategy.INCLUDE)
|
||||||
|
|
||||||
|
task prepareWebContent(type: Exec) {
|
||||||
|
if (System.properties['os.name'].toString().toLowerCase().contains('windows')) {
|
||||||
|
commandLine "rmdir", ".\\WebContent\\ide"
|
||||||
|
commandLine "mklink", "/j", "..\\..\\agent-frontend", ".\\WebContent\\ide"
|
||||||
|
} else {
|
||||||
|
commandLine "rm", "./WebContent/ide"
|
||||||
|
commandLine "ln", "-s", "../../agent-frontend", "./WebContent/ide"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task copyScript(type: Copy) {
|
task copyScript(type: Copy) {
|
||||||
from("../script/") {
|
from("./script/") {
|
||||||
include 'cmstart.sh'
|
include 'cmstart.sh'
|
||||||
include 'cmstop.sh'
|
include 'cmstop.sh'
|
||||||
include 'cmconfig.json.template'
|
include 'cmconfig.json.template'
|
||||||
@ -142,7 +154,7 @@ task copyKeys(type: Copy) {
|
|||||||
into "./build/output/keys"
|
into "./build/output/keys"
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildBDServerZip(type: Zip, dependsOn: [ ":agent-backend:copyWebContent",
|
task buildBDServerZip(type: Zip, dependsOn: [":agent-backend:copyWebContent",
|
||||||
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
|
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
|
||||||
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
|
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
|
||||||
from './build/output/'
|
from './build/output/'
|
||||||
@ -151,7 +163,7 @@ task buildBDServerZip(type: Zip, dependsOn: [ ":agent-backend:copyWebContent",
|
|||||||
destinationDirectory = file('build/')
|
destinationDirectory = file('build/')
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildBDServerZipLite(type: Zip, dependsOn: [ ":agent-backend:copyWebContent",
|
task buildBDServerZipLite(type: Zip, dependsOn: [":agent-backend:copyWebContent",
|
||||||
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
|
":agent-backend:copyBDWareProjectDir", ":agent-backend:copyScript",
|
||||||
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
|
":agent-backend:copyJar", ":agent-backend:copyLibs", ":agent-backend:copyKeys"]) {
|
||||||
from('./build/output/') {
|
from('./build/output/') {
|
||||||
|
15
script/cmconfig.json.template
Normal file
15
script/cmconfig.json.template
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"ip": "127.0.0.1",
|
||||||
|
"servicePort": 21030,
|
||||||
|
"isLAN" : true,
|
||||||
|
"disableDoRepo": false,
|
||||||
|
"doipPort": 21032,
|
||||||
|
"doipCertPath": "",
|
||||||
|
"doipUserHandle": "",
|
||||||
|
"doipLhsAddress": "",
|
||||||
|
"withBdledgerServer": false,
|
||||||
|
"withBdledgerClient": "",
|
||||||
|
"enableEventPersistence": false,
|
||||||
|
"enableSsl": "./ssl/chained.pem:./ssl/domain.pem",
|
||||||
|
"textFileSuffixes": ".yjs,.json,.txt,.css,.js,.html,.md,.conf,.csv"
|
||||||
|
}
|
26
script/cmstart.sh
Executable file
26
script/cmstart.sh
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ ! -d "log/" ]; then
|
||||||
|
mkdir "log"
|
||||||
|
fi
|
||||||
|
|
||||||
|
bash ./cmstop.sh
|
||||||
|
|
||||||
|
time=$(date "+%Y_%m_%d_%H:%M:%S")
|
||||||
|
|
||||||
|
if [ -f "./log/cm.log" ]; then
|
||||||
|
echo "move log ./log/cm_${time}.log"
|
||||||
|
mv ./log/cm.log "./log/cm_${time}.log"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "./log/cm.err" ]; then
|
||||||
|
mv ./log/cm.err "./log/cm_${time}.err"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ps -ef | grep java | grep bdserver | grep CM | awk '{print $2}' | xargs kill -9
|
||||||
|
|
||||||
|
java -Dfile.encoding=UTF-8 -Djava.library.path="./dynamicLibrary" -cp "./libs/*:bdagent.jar" org.bdware.server.CMHttpServer 1>./log/cm.log 2>./log/cm.err &
|
||||||
|
#-Xmx3550m -Xms3550m -Xmn2g
|
||||||
|
#-XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5
|
||||||
|
# 以下可启用https/wss,其中,./ssl/xxx.pfx为ssl证书的路径,:后面的123456是密码。
|
||||||
|
# java -Dfile.encoding=UTF-8 -cp "./libs/*:bdagent.jar" org.bdware.server.CMHttpServer -service-port=8080 -enable-ssl=./ssl/xxx.pfx:123456 -do-repo-ip=127.0.0.1 -do-repo-port=18099 1 > ./log/cm.log 2> ./log/cm.err &
|
||||||
|
echo $! >./PID
|
10
script/cmstop.sh
Executable file
10
script/cmstop.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -a "./PID" ]; then
|
||||||
|
ls /proc/$(cat PID)/cmdline
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
kill -9 $(cat PID)
|
||||||
|
echo "shutdown old contract manager"
|
||||||
|
fi
|
||||||
|
rm ./PID
|
||||||
|
fi
|
9
script/killContracts.sh
Normal file
9
script/killContracts.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ -a './CMI' ]; then
|
||||||
|
ps -ef | grep java | grep yjs | grep $(cat CMI) | awk '{print $2}' | xargs kill -9
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 0 ]; then
|
||||||
|
echo $1
|
||||||
|
ps -ef | grep java | grep yjs | grep $1 | awk '{print $2}' | xargs kill -9
|
||||||
|
fi
|
@ -73,7 +73,8 @@ public class CMHttpHandler extends SimpleChannelInboundHandler<HttpObject> {
|
|||||||
new HttpFileAction(),
|
new HttpFileAction(),
|
||||||
new BDIndexerAction(),
|
new BDIndexerAction(),
|
||||||
LedgerActions.instance,
|
LedgerActions.instance,
|
||||||
new CMLogAction(), new TemporyTestAction()) {
|
new CMLogAction(),
|
||||||
|
new TemporyTestAction()) {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPermission(Action a, JsonObject arg, long per) {
|
public boolean checkPermission(Action a, JsonObject arg, long per) {
|
||||||
boolean flag = a.httpAccess();
|
boolean flag = a.httpAccess();
|
||||||
@ -103,16 +104,12 @@ public class CMHttpHandler extends SimpleChannelInboundHandler<HttpObject> {
|
|||||||
}
|
}
|
||||||
TimeDBUtil.instance.put(
|
TimeDBUtil.instance.put(
|
||||||
CMTables.LocalNodeLogDB.toString(),
|
CMTables.LocalNodeLogDB.toString(),
|
||||||
"{\"action\":\""
|
String.format(
|
||||||
+ action
|
"{\"action\":\"%s\",\"pubKey\":\"%s\",\"status\":\"%s\",\"date\":%d}",
|
||||||
+ "\",\"pubKey\":\""
|
action,
|
||||||
+ pubkey
|
pubkey,
|
||||||
+ "\",\"status\":\""
|
status,
|
||||||
+ status
|
System.currentTimeMillis()));
|
||||||
+ "\",\"date\":"
|
|
||||||
+ System.currentTimeMillis()
|
|
||||||
+ "}");
|
|
||||||
|
|
||||||
return flag && flag2;
|
return flag && flag2;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user