update docker configs

This commit is contained in:
CaiHQ 2022-05-05 13:28:28 +08:00
parent da1f524a06
commit 3000ba5874
11 changed files with 114 additions and 39 deletions

View File

@ -81,7 +81,9 @@ task copyScript(type: Copy) {
include 'cmstop.sh'
include 'cmconfig.json.template'
include 'killContracts.sh'
include 'generatekey.sh'
include 'genKeyAndCMConfig.sh'
include 'cmvar.json'
include 'log4j2.properties'
}
into "./build/output"
println("copyScript done !")

View File

@ -1,19 +1,22 @@
{
"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",
"wsPluginActions": "org.bdware.metering.MeteringAction",
"clientToAgentPlugins": "",
"clientToClusterPlugins": "",
"tcpPlugins": ""
"cmi":"",
"debug":"",
"disableDoRepo":false,
"disableLocalLhs":false,
"doipCertPath":"",
"doipLhsAddress":"",
"doipPort":21032,
"doipUserHandle":"",
"enableEventPersistence":false,
"enableSsl":"./ssl/chained.pem:./ssl/domain.pem",
"ip":"127.0.0.1",
"isLAN":true,
"overwrite":false,
"servicePort":21030,
"textFileSuffixes":".yjs,.json,.txt,.css,.js,.html,.md,.conf,.csv",
"withBdledgerClient":"./runnable/bdledger_mac",
"withBdledgerServer":false,
"consistencyPlugins": "./libs/custom-plugin.jar",
"datachainConf": "_LEDGERHOSTCONF"
}

View File

@ -18,7 +18,7 @@ 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 &
java -Dfile.encoding=UTF-8 -Djava.library.path="./dynamicLibrary" -Dlog4j.configurationFile=./log4j2.properties -cp "./libs/*:bdagent.jar" org.bdware.server.CMHttpServer 1>/dev/null 2>/dev/null &
#-Xmx3550m -Xms3550m -Xmn2g
#-XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5
# 以下可启用https/wss其中./ssl/xxx.pfx为ssl证书的路径:后面的123456是密码。

3
script/cmvar.json Normal file
View File

@ -0,0 +1,3 @@
{
"_LEDGERHOSTCONF": "localhost:2401"
}

View File

@ -1,3 +1,5 @@
#!/bin/bash
echo "generate manger.key, manager.keypair!"
java -cp cp/libs:cp/yjs.jar org.bdware.sc.SM2Helper generateKeyToFile
java -cp cp/libs:cp/yjs.jar org.bdware.sc.SM2Helper generateKeyToFile
echo "generate CMConfig!"
java -cp cp/libs/*:cp/yjs.jar org.bdware.sc.SM2Helper generateCMConfig

40
script/log4j2.properties Normal file
View File

@ -0,0 +1,40 @@
filter.threshold.type=ThresholdFilter
filter.threshold.level=debug
appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
appender.logrolling.type=RollingFile
appender.logrolling.name=infoLogFile
appender.logrolling.append=true
appender.logrolling.fileName=./log/cm.log
appender.logrolling.filePattern=./log/cm-%i.log
appender.logrolling.layout.type=PatternLayout
appender.logrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.logrolling.policies.type = Policies
appender.logrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.logrolling.policies.size.size = 100MB
appender.logrolling.strategy.type = DefaultRolloverStrategy
appender.logrolling.strategy.max = 5
appender.errrolling.type=RollingFile
appender.errrolling.name=errorLogFile
appender.errrolling.append=true
appender.errrolling.fileName=./log/cm.err
appender.errrolling.filePattern=./log/cm-%i.err
appender.errrolling.layout.type=PatternLayout
appender.errrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.errrolling.policies.type = Policies
appender.errrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.errrolling.policies.size.size = 100MB
appender.errrolling.strategy.type = DefaultRolloverStrategy
appender.errrolling.strategy.max = 5
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.errorFile.ref=errorLogFile
rootLogger.appenderRef.errorFile.level=error
rootLogger.appenderRef.infoFile.ref=infoLogFile
rootLogger.appenderRef.infoFile.level=info
rootLogger.appenderRef.log.ref=log

View File

@ -67,12 +67,12 @@ public class GRPCPool implements ChainOpener {
RocksDB hash2Data;
private String dataNodeIP;
private int dataNodePort;
static final String DBDir = "ContractManagerDB/GRPCPool";
// public static OnHashCallback callback; //for CM write on chain
GRPCPool() {
logIndex = new LenVarTimeSerialIndex("./log/hashToData.index", 20);
requestID2Hash = openDB("./log/requestIDToHash", "req2Hash");
hash2Data = openDB("./log/hashToData", "hash2Data");
logIndex = new LenVarTimeSerialIndex("./"+DBDir+"/hashToData.index", 20);
requestID2Hash = openDB("./"+DBDir+"/requestIDToHash", "req2Hash");
hash2Data = openDB("./"+DBDir+"/hashToData", "hash2Data");
contractName2LogIndex = new HashMap<>();
instances = new ArrayList<>();
for (int i = 0; i < WORKER_COUNT; ++i) {
@ -622,7 +622,7 @@ public class GRPCPool implements ChainOpener {
if (index == null) {
index =
new LenVarTimeSerialIndex(
"./log/hashByContract/" + contractName + ".index", 20);
"./"+DBDir+"/hashByContract/" + contractName + ".index", 20);
contractName2LogIndex.put(contractName, index);
}
return index;

View File

@ -722,7 +722,6 @@ public class CMActions implements OnHashCallback {
} else {
c.setScript(args.get("script").getAsString());
}
if (args.has("publicKey")) {
c.setOwner(args.get("publicKey").getAsString());
c.setSignature(args.get("signature").getAsString());
@ -1262,11 +1261,11 @@ public class CMActions implements OnHashCallback {
ret,
args.has("requestID") ? args.get("requestID").getAsString() : null,
"");
Map<String, Object> r = new HashMap<>();
r.put("action", "onKillContractProcess");
r.put("data", ret);
r.put("executeTime", System.currentTimeMillis() - s);
resultCallback.onResult(JsonUtil.toJson(r));
JsonObject r = new JsonObject();
r.addProperty("action", "onKillContractProcess");
r.addProperty("data", ret);
r.addProperty("executeTime", System.currentTimeMillis() - s);
resultCallback.onResult(r);
ExecutionManager.instance.updateLocalContractToNodeCenter();
}
} else {

View File

@ -382,7 +382,6 @@ public class FileActions {
}
ContractManager.threadPool.execute(
() -> {
// manifestFile......
try {
GRPCPool.instance.reRegister(jo.get("doi").getAsString());
} catch (Exception e) {

View File

@ -4,12 +4,37 @@ appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=%highlight{[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n}{FATAL=Bright Red,ERROR=Red,WARN=Yellow,INFO=Green,DEBUG=Blue,TRACE=White}
appender.rolling.type=File
appender.rolling.name=log
appender.rolling.append=true
appender.rolling.fileName=./log/cm.log
appender.rolling.layout.type=PatternLayout
appender.rolling.layout.pattern=%d-%m%n
appender.logrolling.type=RollingFile
appender.logrolling.name=infoLogFile
appender.logrolling.append=true
appender.logrolling.fileName=./log/cm.log
appender.logrolling.filePattern=./log/cm-%i.log
appender.logrolling.layout.type=PatternLayout
appender.logrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.logrolling.policies.type = Policies
appender.logrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.logrolling.policies.size.size = 100MB
appender.logrolling.strategy.type = DefaultRolloverStrategy
appender.logrolling.strategy.max = 5
appender.errrolling.type=RollingFile
appender.errrolling.name=errorLogFile
appender.errrolling.append=true
appender.errrolling.fileName=./log/cm.err
appender.errrolling.filePattern=./log/cm-%i.err
appender.errrolling.layout.type=PatternLayout
appender.errrolling.layout.pattern=[%-5p] %d{HH:mm:ss.SSS} %m (%F:%L)[%M]%n
appender.errrolling.policies.type = Policies
appender.errrolling.policies.size.type = SizeBasedTriggeringPolicy
appender.errrolling.policies.size.size = 100MB
appender.errrolling.strategy.type = DefaultRolloverStrategy
appender.errrolling.strategy.max = 5
rootLogger.level=info
rootLogger.appenderRef.stdout.ref=STDOUT
rootLogger.appenderRef.log.ref=log
rootLogger.appenderRef.errorFile.ref=errorLogFile
rootLogger.appenderRef.errorFile.level=error
rootLogger.appenderRef.infoFile.ref=infoLogFile
rootLogger.appenderRef.infoFile.level=info
rootLogger.appenderRef.log.ref=log

View File

@ -1,5 +1,6 @@
package org.bdware.server;
import org.bdware.sc.ContractManager;
import org.bdware.server.action.Action;
import org.bdware.server.action.ActionExecutor;
import org.bdware.server.http.CMHttpHandler;
@ -82,6 +83,7 @@ public class PermissionHelper {
@Test
public void listFrontAgentHttpAPIAction() {
ContractManager manager = new ContractManager();
CMHttpHandler handler = new CMHttpHandler();
parse(handler.actionExecutor.getHandlers(), true);
}