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 'cmstop.sh'
include 'cmconfig.json.template' include 'cmconfig.json.template'
include 'killContracts.sh' include 'killContracts.sh'
include 'generatekey.sh' include 'genKeyAndCMConfig.sh'
include 'cmvar.json'
include 'log4j2.properties'
} }
into "./build/output" into "./build/output"
println("copyScript done !") println("copyScript done !")

View File

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

View File

@ -18,7 +18,7 @@ fi
# ps -ef | grep java | grep bdserver | grep CM | awk '{print $2}' | xargs kill -9 # 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 #-Xmx3550m -Xms3550m -Xmn2g
#-XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5 #-XX:+UseConcMarkSweepGC -XX:CMSFullGCsBeforeCompaction=5
# 以下可启用https/wss其中./ssl/xxx.pfx为ssl证书的路径:后面的123456是密码。 # 以下可启用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 #!/bin/bash
echo "generate manger.key, manager.keypair!" 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; RocksDB hash2Data;
private String dataNodeIP; private String dataNodeIP;
private int dataNodePort; private int dataNodePort;
static final String DBDir = "ContractManagerDB/GRPCPool";
// public static OnHashCallback callback; //for CM write on chain // public static OnHashCallback callback; //for CM write on chain
GRPCPool() { GRPCPool() {
logIndex = new LenVarTimeSerialIndex("./log/hashToData.index", 20); logIndex = new LenVarTimeSerialIndex("./"+DBDir+"/hashToData.index", 20);
requestID2Hash = openDB("./log/requestIDToHash", "req2Hash"); requestID2Hash = openDB("./"+DBDir+"/requestIDToHash", "req2Hash");
hash2Data = openDB("./log/hashToData", "hash2Data"); hash2Data = openDB("./"+DBDir+"/hashToData", "hash2Data");
contractName2LogIndex = new HashMap<>(); contractName2LogIndex = new HashMap<>();
instances = new ArrayList<>(); instances = new ArrayList<>();
for (int i = 0; i < WORKER_COUNT; ++i) { for (int i = 0; i < WORKER_COUNT; ++i) {
@ -622,7 +622,7 @@ public class GRPCPool implements ChainOpener {
if (index == null) { if (index == null) {
index = index =
new LenVarTimeSerialIndex( new LenVarTimeSerialIndex(
"./log/hashByContract/" + contractName + ".index", 20); "./"+DBDir+"/hashByContract/" + contractName + ".index", 20);
contractName2LogIndex.put(contractName, index); contractName2LogIndex.put(contractName, index);
} }
return index; return index;

View File

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

View File

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

View File

@ -4,12 +4,37 @@ appender.console.type=Console
appender.console.name=STDOUT appender.console.name=STDOUT
appender.console.layout.type=PatternLayout 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.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.logrolling.type=RollingFile
appender.rolling.append=true appender.logrolling.name=infoLogFile
appender.rolling.fileName=./log/cm.log appender.logrolling.append=true
appender.rolling.layout.type=PatternLayout appender.logrolling.fileName=./log/cm.log
appender.rolling.layout.pattern=%d-%m%n 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.level=info
rootLogger.appenderRef.stdout.ref=STDOUT 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 rootLogger.appenderRef.log.ref=log

View File

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