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
|
||||
/WebContent/
|
||||
/runnable
|
||||
cmconfig.json*
|
||||
/cmconfig.json*
|
||||
/build/
|
||||
*/build/*
|
0
WebContent/.keep
Normal file
0
WebContent/.keep
Normal file
14
build.gradle
14
build.gradle
@ -36,9 +36,11 @@ dependencies {
|
||||
implementation 'io.prometheus:simpleclient_httpserver:0.12.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs << "-Xlint:unchecked"
|
||||
}
|
||||
|
||||
jar {
|
||||
String libs = ''
|
||||
configurations.runtimeClasspath.each {
|
||||
@ -54,8 +56,18 @@ jar {
|
||||
|
||||
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) {
|
||||
from("../script/") {
|
||||
from("./script/") {
|
||||
include 'cmstart.sh'
|
||||
include 'cmstop.sh'
|
||||
include 'cmconfig.json.template'
|
||||
|
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 BDIndexerAction(),
|
||||
LedgerActions.instance,
|
||||
new CMLogAction(), new TemporyTestAction()) {
|
||||
new CMLogAction(),
|
||||
new TemporyTestAction()) {
|
||||
@Override
|
||||
public boolean checkPermission(Action a, JsonObject arg, long per) {
|
||||
boolean flag = a.httpAccess();
|
||||
@ -103,16 +104,12 @@ public class CMHttpHandler extends SimpleChannelInboundHandler<HttpObject> {
|
||||
}
|
||||
TimeDBUtil.instance.put(
|
||||
CMTables.LocalNodeLogDB.toString(),
|
||||
"{\"action\":\""
|
||||
+ action
|
||||
+ "\",\"pubKey\":\""
|
||||
+ pubkey
|
||||
+ "\",\"status\":\""
|
||||
+ status
|
||||
+ "\",\"date\":"
|
||||
+ System.currentTimeMillis()
|
||||
+ "}");
|
||||
|
||||
String.format(
|
||||
"{\"action\":\"%s\",\"pubKey\":\"%s\",\"status\":\"%s\",\"date\":%d}",
|
||||
action,
|
||||
pubkey,
|
||||
status,
|
||||
System.currentTimeMillis()));
|
||||
return flag && flag2;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user