Skip to content

Commit

Permalink
Merge pull request #492 from WeBankBlockchain/dev
Browse files Browse the repository at this point in the history
fix visual deploy
  • Loading branch information
CodingCattwo authored Apr 23, 2023
2 parents af4ae46 + cd319fa commit 1907788
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ dependencies {
exclude group: 'org.apache.commons'
}
compile 'org.thymeleaf:thymeleaf:3.0.11.RELEASE'
compile 'ognl:ognl:3.2.14'
// 使用3.1.26才能确保Thymeleaf正常
// compile 'ognl:ognl:3.2.14'

testCompile test,mbg

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,14 @@ public boolean generateConfigLocalAndInitDb(String chainName, List<DeployNodeInf
@Transactional
public void initChainDbData(String chainName, List<DeployNodeInfo> deployNodeInfoList, List<IpConfigParse> ipConfigParseList,
String webaseSignAddr, String imageTag, byte encryptType, String agencyName){
log.info("start initChainDbData chainName:{}, ipConfigParseList:{}",
chainName, ipConfigParseList);
log.info("start initChainDbData chainName:{}, deployNodeInfoList:{},ipConfigParseList:{}",
chainName, deployNodeInfoList, ipConfigParseList);
ProgressTools.setInitChainData();
// insert chain
final TbChain newChain = ((ChainService) AopContext.currentProxy()).insert(chainName, chainName,
imageTag, encryptType, ChainStatusEnum.INITIALIZED,
RunTypeEnum.DOCKER, webaseSignAddr);
log.info("initChainDbData insert newChain {}", newChain);

// all host ips
Map<String, TbHost> newIpHostMap = new HashMap<>();
Expand All @@ -395,6 +396,7 @@ public void initChainDbData(String chainName, List<DeployNodeInfo> deployNodeIn
newIpHostMap.putIfAbsent(config.getIp(), host);
});

log.info("initChainDbData temp newIpHostMap {}", newIpHostMap);
// insert nodes for all hosts. there may be multiple nodes on a host.
newIpHostMap.keySet().forEach((ip) -> {
List<Path> nodePathList = null;
Expand All @@ -404,12 +406,15 @@ public void initChainDbData(String chainName, List<DeployNodeInfo> deployNodeIn
throw new NodeMgrException(ConstantCode.LIST_HOST_NODE_DIR_ERROR.attach(ip));
}

log.info("initChainDbData temp nodePathList {}", nodePathList);
for (Path nodeRoot : CollectionUtils.emptyIfNull(nodePathList)) {
// get node properties
NodeConfig nodeConfig = NodeConfig.read(nodeRoot, encryptType);
log.info("initChainDbData temp nodeConfig {}", nodeConfig);

// get frontPort
DeployNodeInfo targetNode = this.getFrontPort(deployNodeInfoList, ip, nodeConfig.getChannelPort());
log.info("initChainDbData temp targetNode {}", targetNode);
if (targetNode == null) {
throw new NodeMgrException(ConstantCode.DEPLOY_INFO_NOT_MATCH_IP_CONF);
}
Expand All @@ -426,6 +431,7 @@ public void initChainDbData(String chainName, List<DeployNodeInfo> deployNodeIn
DockerCommandService.getContainerName(host.getRootDir(), chainName,
nodeConfig.getHostIndex()), nodeConfig.getJsonrpcPort(), nodeConfig.getP2pPort(),
nodeConfig.getChannelPort(), newChain.getId(), newChain.getChainName(), FrontStatusEnum.INITIALIZED);
log.info("initChainDbData insert front {}", front);
this.frontService.insert(front);

// insert node and front group mapping
Expand All @@ -444,6 +450,7 @@ public void initChainDbData(String chainName, List<DeployNodeInfo> deployNodeIn

// update group timestamp and node list
Pair<Long, List<String>> longListPair = nodeConfig.getGroupIdToTimestampNodeListMap().get(groupId);
log.info("initChainDbData temp longListPair {}", longListPair);
if (longListPair != null) {
this.groupService.updateTimestampNodeIdList(groupId,longListPair.getKey(),longListPair.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void pullImage(String ip, String imageTag, int imagePullType, String down
log.info("pullImage from cdn");
ansibleService.execPullDockerCdnShell(ip, downloadPath + "/download", imageTag, webaseVersion);
}
// todo 加上一个check image,确保拉取成功
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ public TbFrontGroupMap newFrontGroupWithStatus(Integer frontId, Integer groupId,
*/
@Transactional
public TbFrontGroupMap newFrontGroup(Integer frontId, Integer groupId, GroupStatus groupStatus) {
log.info("start newFrontGroup {}|{}|{}", frontId, groupId, groupStatus);
TbFrontGroupMap tbFrontGroupMap = new TbFrontGroupMap(frontId, groupId, groupStatus.getValue());

//add db
frontGroupMapMapper.insertSelective(tbFrontGroupMap);
log.info("end newFrontGroup {}|{}|{}", frontId, groupId, groupStatus);

return tbFrontGroupMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ public void updateGroupNodeCount(int groupId, int nodeCount) {

@Transactional
public void updateTimestampNodeIdList(int groupId, long timestamp,List<String> nodeIdList) {
log.debug("start updateTimestampNodeIdList groupId:{} nodeCount:{}", groupId, timestamp, nodeIdList);
log.info("start updateTimestampNodeIdList groupId:{} nodeCount:{}|{}", groupId, timestamp, nodeIdList);
this.groupMapper.updateTimestampNodeList(groupId, timestamp,JsonTools.toJSONString(nodeIdList));
}

Expand All @@ -1120,6 +1120,8 @@ public void updateTimestampNodeIdList(int groupId, long timestamp,List<String> n
public TbGroup insertIfNew(int groupId, int nodeCount, String groupDesc,
GroupType groupType, GroupStatus groupStatus, Integer chainId, String chainName) {

log.info("insertIfNew insert group {}|{}|{}|{}|{}|{}|{}",
groupId, nodeCount, groupDesc, groupType, groupStatus, chainId, chainName);
TbGroup group = this.groupMapper.getGroupByChainIdAndGroupId(chainId,groupId);
if (group != null) {
return group;
Expand Down

0 comments on commit 1907788

Please sign in to comment.