[agent-go] - 更新ServerInfo的字段
This commit is contained in:
@@ -13,7 +13,7 @@ type AgentServerInfo struct {
|
|||||||
ServerIPPbV6 string `json:"serverIpPbV6" yaml:"serverIpPbV6"`
|
ServerIPPbV6 string `json:"serverIpPbV6" yaml:"serverIpPbV6"`
|
||||||
ServerIPInV6 string `json:"serverIpInV6" yaml:"serverIpInV6"`
|
ServerIPInV6 string `json:"serverIpInV6" yaml:"serverIpInV6"`
|
||||||
City string `json:"city" yaml:"city"`
|
City string `json:"city" yaml:"city"`
|
||||||
Region string `json:"region" yaml:"region"`
|
Province string `json:"province" yaml:"province"`
|
||||||
Country string `json:"country" yaml:"country"`
|
Country string `json:"country" yaml:"country"`
|
||||||
Organization string `json:"organization" yaml:"organization"`
|
Organization string `json:"organization" yaml:"organization"`
|
||||||
TimeZone string `json:"timeZone" yaml:"timeZone"`
|
TimeZone string `json:"timeZone" yaml:"timeZone"`
|
||||||
@@ -31,6 +31,7 @@ type AgentServerInfo struct {
|
|||||||
PlatformVersion string `json:"platformVersion"` // version of the complete OS
|
PlatformVersion string `json:"platformVersion"` // version of the complete OS
|
||||||
KernelVersion string `json:"kernelVersion"` // version of the OS kernel (if available)
|
KernelVersion string `json:"kernelVersion"` // version of the OS kernel (if available)
|
||||||
KernelArch string `json:"kernelArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
|
KernelArch string `json:"kernelArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
|
||||||
|
CPUArch string `json:"cpuArch"` // native cpu architecture queried at runtime, as returned by `uname -m` or empty string in case of error
|
||||||
IoSpeed string `json:"ioSpeed" yaml:"ioSpeed"`
|
IoSpeed string `json:"ioSpeed" yaml:"ioSpeed"`
|
||||||
MemoryTotal string `json:"memoryTotal" yaml:"memoryTotal"`
|
MemoryTotal string `json:"memoryTotal" yaml:"memoryTotal"`
|
||||||
SwapTotal string `json:"swapTotal" yaml:"swapTotal"`
|
SwapTotal string `json:"swapTotal" yaml:"swapTotal"`
|
||||||
@@ -39,5 +40,5 @@ type AgentServerInfo struct {
|
|||||||
Comment string `json:"comment" yaml:"comment"`
|
Comment string `json:"comment" yaml:"comment"`
|
||||||
MachineID string `json:"machineId" yaml:"machineId"`
|
MachineID string `json:"machineId" yaml:"machineId"`
|
||||||
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
|
AgentVersion string `json:"agentVersion" yaml:"agentVersion"`
|
||||||
TopicName string `json:"topicName" yaml:"topicName"`
|
AgentTopicName string `json:"agentTopicName" yaml:"agentTopicName"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func INIT(octopusAgentConfigFileName string) chan bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 建立 运行时 RabbitMQ连接
|
// 建立 运行时 RabbitMQ连接
|
||||||
runtimeConnectorQueue := buildAndStartBusinessRuntimeQueue(a_agent.AgentServerInfoCache.TopicName)
|
runtimeConnectorQueue := buildAndStartBusinessRuntimeQueue(a_agent.AgentServerInfoCache.AgentTopicName)
|
||||||
|
|
||||||
// 激活子模块
|
// 激活子模块
|
||||||
activatedOctopusAgentModules()
|
activatedOctopusAgentModules()
|
||||||
@@ -318,6 +318,8 @@ func uniformAgentServerName(agentInfo *a_status.AgentInfo, agentServerInfo *a_ag
|
|||||||
// linux host architecture
|
// linux host architecture
|
||||||
arch := getMachineType(agentInfo.HostInfo.KernelArch)
|
arch := getMachineType(agentInfo.HostInfo.KernelArch)
|
||||||
|
|
||||||
|
agentServerInfo.CPUArch = arch
|
||||||
|
|
||||||
var numS string
|
var numS string
|
||||||
if agentServerInfo.ServerIPInV4 != "" {
|
if agentServerInfo.ServerIPInV4 != "" {
|
||||||
split := strings.Split(agentServerInfo.ServerIPInV4, ".")
|
split := strings.Split(agentServerInfo.ServerIPInV4, ".")
|
||||||
@@ -433,7 +435,7 @@ func refreshAgentNetworkInfo(agentInfo *a_status.AgentInfo, agentServerInfo *a_a
|
|||||||
|
|
||||||
if publicNetworkInfo.IP != "" {
|
if publicNetworkInfo.IP != "" {
|
||||||
agentServerInfo.ServerIPPbV4 = publicNetworkInfo.IP
|
agentServerInfo.ServerIPPbV4 = publicNetworkInfo.IP
|
||||||
agentServerInfo.Region = publicNetworkInfo.Region
|
agentServerInfo.Province = publicNetworkInfo.Region
|
||||||
agentServerInfo.City = publicNetworkInfo.City
|
agentServerInfo.City = publicNetworkInfo.City
|
||||||
agentServerInfo.Country = publicNetworkInfo.Country
|
agentServerInfo.Country = publicNetworkInfo.Country
|
||||||
agentServerInfo.Location = publicNetworkInfo.Loc
|
agentServerInfo.Location = publicNetworkInfo.Loc
|
||||||
@@ -507,7 +509,7 @@ func handleInitMsgFromServer(initFromServerMsg *rabbitmq.OctopusMessage, initToS
|
|||||||
g.G.AgentHasRegister = true
|
g.G.AgentHasRegister = true
|
||||||
|
|
||||||
// 保存真实的AgentTopicName
|
// 保存真实的AgentTopicName
|
||||||
a_agent.AgentServerInfoCache.TopicName = serverInfo.TopicName
|
a_agent.AgentServerInfoCache.AgentTopicName = serverInfo.AgentTopicName
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// 不是自身的 注册回复信息 -- 拒绝 2023年6月19日 此处存在错误! 会死循环Nack 导致异常
|
// 不是自身的 注册回复信息 -- 拒绝 2023年6月19日 此处存在错误! 会死循环Nack 导致异常
|
||||||
|
|||||||
68
agent-go/octopus-agent-cmii.yaml
Normal file
68
agent-go/octopus-agent-cmii.yaml
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
server:
|
||||||
|
port: 8000
|
||||||
|
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
web: info
|
||||||
|
|
||||||
|
octopus:
|
||||||
|
message:
|
||||||
|
# agent boot up default common exchange
|
||||||
|
init_exchange: InitExchange
|
||||||
|
# server will send message to agent using this common queue
|
||||||
|
init_to_server: InitToServer
|
||||||
|
# agent boot up default common exchange routing key
|
||||||
|
init_to_server_key: InitToServerKey
|
||||||
|
# server will receive message from agent using this common queue
|
||||||
|
init_from_server: InitFromServer
|
||||||
|
# agent boot up default common exchange routing key
|
||||||
|
init_from_server_key: InitFromServerKey
|
||||||
|
# initialization register time out (unit ms) default is 5 min
|
||||||
|
init_ttl: "3000000"
|
||||||
|
# Octopus Exchange Name == server comunicate with agent
|
||||||
|
octopus_exchange: OctopusExchange
|
||||||
|
# Octopus Message To Server == all agent send info to server queue and topic
|
||||||
|
octopus_to_server: OctopusToServer
|
||||||
|
executor:
|
||||||
|
name: executor-functions
|
||||||
|
status:
|
||||||
|
name: octopus-agent
|
||||||
|
healthy:
|
||||||
|
type: cron
|
||||||
|
cron: 10 */1 * * * ? *
|
||||||
|
start-delay: 30
|
||||||
|
metric:
|
||||||
|
pinch: 20
|
||||||
|
agent:
|
||||||
|
executor:
|
||||||
|
# agent执行一条Command的最长超时时间
|
||||||
|
processMaxTimeOut: 60
|
||||||
|
status:
|
||||||
|
app:
|
||||||
|
- Nginx/nginx
|
||||||
|
- MySQL/mysql
|
||||||
|
- Xray/xray
|
||||||
|
- OctopusAgent/octopus-agent
|
||||||
|
- Redis/redis
|
||||||
|
- RabbitMQ/rabbitmq
|
||||||
|
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
rabbitmq:
|
||||||
|
# host: 42.192.52.227
|
||||||
|
host: 192.168.35.71
|
||||||
|
port: 20672
|
||||||
|
username: boge
|
||||||
|
password: boge8tingH
|
||||||
|
virtual-host: /
|
||||||
|
listener:
|
||||||
|
simple:
|
||||||
|
retry:
|
||||||
|
# ack failed will reentrant the Rabbit Listener
|
||||||
|
max-attempts: 2
|
||||||
|
enabled: true
|
||||||
|
# retry interval unit ms
|
||||||
|
max-interval: 65000
|
||||||
|
initial-interval: 65000
|
||||||
@@ -66,26 +66,3 @@ spring:
|
|||||||
# retry interval unit ms
|
# retry interval unit ms
|
||||||
max-interval: 65000
|
max-interval: 65000
|
||||||
initial-interval: 65000
|
initial-interval: 65000
|
||||||
|
|
||||||
#spring:
|
|
||||||
# application:
|
|
||||||
# name: octopus-agent
|
|
||||||
# profiles:
|
|
||||||
# active: dev
|
|
||||||
# cloud:
|
|
||||||
# nacos:
|
|
||||||
# config:
|
|
||||||
# group: dev
|
|
||||||
# config-retry-time: 3000
|
|
||||||
# file-extension: yaml
|
|
||||||
# max-retry: 3
|
|
||||||
# # server-addr: "150.230.198.103:21060"
|
|
||||||
# server-addr: "42.192.52.227:21060"
|
|
||||||
# timeout: 5000
|
|
||||||
# config-long-poll-timeout: 5000
|
|
||||||
# extension-configs:
|
|
||||||
# - group: dev
|
|
||||||
# data-id: "common-dev.yaml"
|
|
||||||
#
|
|
||||||
#server:
|
|
||||||
# port: 8000
|
|
||||||
@@ -91,7 +91,7 @@ public class FakeDataUtils {
|
|||||||
|
|
||||||
ServerInfoVO serverInfoVO = ServerInfoVO
|
ServerInfoVO serverInfoVO = ServerInfoVO
|
||||||
.builder()
|
.builder()
|
||||||
.topicName(agentTopicName)
|
.agentTopicName(agentTopicName)
|
||||||
.serverName(serverName)
|
.serverName(serverName)
|
||||||
.serverIpPbV4(publicIpV4)
|
.serverIpPbV4(publicIpV4)
|
||||||
.serverIpPbV6(publicIpV6)
|
.serverIpPbV6(publicIpV6)
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class AppFuncScheduler {
|
|||||||
|
|
||||||
String masterTopicName = projectDeployContext
|
String masterTopicName = projectDeployContext
|
||||||
.getMasterNode()
|
.getMasterNode()
|
||||||
.getTopicName();
|
.getAgentTopicName();
|
||||||
|
|
||||||
List<AppFunctionEnum> masterAppProcedure = projectDeployContext.getMasterAppProcedure();
|
List<AppFunctionEnum> masterAppProcedure = projectDeployContext.getMasterAppProcedure();
|
||||||
if (CollectionUtils.isEmpty(masterAppProcedure)) {
|
if (CollectionUtils.isEmpty(masterAppProcedure)) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class BaseFuncScheduler {
|
|||||||
|
|
||||||
String masterTopicName = projectDeployContext
|
String masterTopicName = projectDeployContext
|
||||||
.getMasterNode()
|
.getMasterNode()
|
||||||
.getTopicName();
|
.getAgentTopicName();
|
||||||
|
|
||||||
return serverDoRunProcedure(
|
return serverDoRunProcedure(
|
||||||
true,
|
true,
|
||||||
@@ -105,7 +105,7 @@ public class BaseFuncScheduler {
|
|||||||
List<String> agentTopicNameList = projectDeployContext
|
List<String> agentTopicNameList = projectDeployContext
|
||||||
.getAgentNodeList()
|
.getAgentNodeList()
|
||||||
.stream()
|
.stream()
|
||||||
.map(ServerInfoPO::getTopicName)
|
.map(ServerInfoPO::getAgentTopicName)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
for (String agentTopicName : agentTopicNameList) {
|
for (String agentTopicName : agentTopicNameList) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class HarborFuncScheduler {
|
|||||||
// 执行 基础功能施工的内容
|
// 执行 基础功能施工的内容
|
||||||
String masterTopicName = projectDeployContext
|
String masterTopicName = projectDeployContext
|
||||||
.getMasterNode()
|
.getMasterNode()
|
||||||
.getTopicName();
|
.getAgentTopicName();
|
||||||
|
|
||||||
// create harbor project
|
// create harbor project
|
||||||
if (!CreateHarborProject(projectDeployContext)) {
|
if (!CreateHarborProject(projectDeployContext)) {
|
||||||
@@ -123,7 +123,7 @@ public class HarborFuncScheduler {
|
|||||||
|
|
||||||
// send harbor create message
|
// send harbor create message
|
||||||
boolean createProjectOK = funcService.callHarborFuncAndJudge(
|
boolean createProjectOK = funcService.callHarborFuncAndJudge(
|
||||||
masterNode.getTopicName(),
|
masterNode.getAgentTopicName(),
|
||||||
HarborFunctionEnum.CREATE_PROJECT,
|
HarborFunctionEnum.CREATE_PROJECT,
|
||||||
createProjectArgList
|
createProjectArgList
|
||||||
);
|
);
|
||||||
@@ -156,7 +156,7 @@ public class HarborFuncScheduler {
|
|||||||
|
|
||||||
// send harbor create message
|
// send harbor create message
|
||||||
boolean listProjectOK = funcService.callHarborFuncAndJudge(
|
boolean listProjectOK = funcService.callHarborFuncAndJudge(
|
||||||
masterNode.getTopicName(),
|
masterNode.getAgentTopicName(),
|
||||||
HarborFunctionEnum.LIST_PROJECT,
|
HarborFunctionEnum.LIST_PROJECT,
|
||||||
listProjectArgList
|
listProjectArgList
|
||||||
);
|
);
|
||||||
@@ -202,7 +202,7 @@ public class HarborFuncScheduler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
boolean syncHarborProjectOk = funcService.callHarborFuncAndJudge(
|
boolean syncHarborProjectOk = funcService.callHarborFuncAndJudge(
|
||||||
masterNode.getTopicName(),
|
masterNode.getAgentTopicName(),
|
||||||
HarborFunctionEnum.SYNC_PROJECT_BETWEEN_HARBOR,
|
HarborFunctionEnum.SYNC_PROJECT_BETWEEN_HARBOR,
|
||||||
syncHarborArgList
|
syncHarborArgList
|
||||||
);
|
);
|
||||||
@@ -269,7 +269,7 @@ public class HarborFuncScheduler {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return funcService.callHarborFuncAndJudge(
|
return funcService.callHarborFuncAndJudge(
|
||||||
masterNode.getTopicName(),
|
masterNode.getAgentTopicName(),
|
||||||
HarborFunctionEnum.SYNC_STATUS_HARBOR,
|
HarborFunctionEnum.SYNC_STATUS_HARBOR,
|
||||||
syncHarborArgList
|
syncHarborArgList
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class ImageFuncScheduler {
|
|||||||
|
|
||||||
ArrayList<String> imageSyncFuncArgs = imageSyncContext.getImageSyncFuncArgs();
|
ArrayList<String> imageSyncFuncArgs = imageSyncContext.getImageSyncFuncArgs();
|
||||||
|
|
||||||
String outsideAgentTopicName = imageSyncContext.getProjectMasterNode().getTopicName();
|
String outsideAgentTopicName = imageSyncContext.getProjectMasterNode().getAgentTopicName();
|
||||||
|
|
||||||
// 设置消息体
|
// 设置消息体
|
||||||
ImageSyncMessage imageSyncMessage = imageSyncContext.getImageSyncMessage();
|
ImageSyncMessage imageSyncMessage = imageSyncContext.getImageSyncMessage();
|
||||||
@@ -124,7 +124,7 @@ public class ImageFuncScheduler {
|
|||||||
imageSyncMessage.setProjectNameSpace(imageSyncContext.getProjectInfoPO().getProjectNamespace());
|
imageSyncMessage.setProjectNameSpace(imageSyncContext.getProjectInfoPO().getProjectNamespace());
|
||||||
imageSyncMessage.setProjectName(imageSyncContext.getProjectInfoPO().getProjectName());
|
imageSyncMessage.setProjectName(imageSyncContext.getProjectInfoPO().getProjectName());
|
||||||
imageSyncMessage.setInnerWorkTopicName(imageSyncContext.getInnerWorkerAgentName());
|
imageSyncMessage.setInnerWorkTopicName(imageSyncContext.getInnerWorkerAgentName());
|
||||||
imageSyncMessage.setProjectMasterTopicName(imageSyncContext.getProjectMasterNode().getTopicName());
|
imageSyncMessage.setProjectMasterTopicName(imageSyncContext.getProjectMasterNode().getAgentTopicName());
|
||||||
imageSyncMessage.setProjectMasterIP(imageSyncContext.getProjectMasterNode().getServerIpInV4());
|
imageSyncMessage.setProjectMasterIP(imageSyncContext.getProjectMasterNode().getServerIpInV4());
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ import io.wdd.func.xray.beans.node.ProxyNode;
|
|||||||
import io.wdd.func.xray.beans.node.XrayConfigInfo;
|
import io.wdd.func.xray.beans.node.XrayConfigInfo;
|
||||||
import io.wdd.func.xray.service.XrayCallAgent;
|
import io.wdd.func.xray.service.XrayCallAgent;
|
||||||
import io.wdd.func.xray.service.XrayCoreService;
|
import io.wdd.func.xray.service.XrayCoreService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -17,7 +20,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static io.wdd.func.xray.persisit.cache.ProxyNodeCache.PROXY_NODE_TOPIC_NAME_MAP;
|
import static io.wdd.func.xray.persisit.cache.ProxyNodeCache.PROXY_NODE_TOPIC_NAME_MAP;
|
||||||
|
|
||||||
@RestController
|
//@RestController
|
||||||
@RequestMapping("/server/func/xray")
|
@RequestMapping("/server/func/xray")
|
||||||
@Api(tags = "Xray控制")
|
@Api(tags = "Xray控制")
|
||||||
public class XrayController {
|
public class XrayController {
|
||||||
|
|||||||
@@ -65,12 +65,14 @@ public class XrayDBOperator {
|
|||||||
.getLocation()
|
.getLocation()
|
||||||
.split(" ")[0];
|
.split(" ")[0];
|
||||||
|
|
||||||
|
serverCity = "Chengdu";
|
||||||
|
|
||||||
// fix bug for Seoul的情况 tmd
|
// fix bug for Seoul的情况 tmd
|
||||||
if (!ALL_SERVER_CITY_INDEX.containsKey(serverCity)) {
|
// if (!ALL_SERVER_CITY_INDEX.containsKey(serverCity) && serverInfoVO) {
|
||||||
serverCity = serverInfoVO
|
// serverCity = serverInfoVO
|
||||||
.getLocation()
|
// .getLocation()
|
||||||
.split(" ")[1];
|
// .split(" ")[1];
|
||||||
}
|
// }
|
||||||
|
|
||||||
int cityBitMapBase = ALL_SERVER_CITY_INDEX.get(serverCity) * 10;
|
int cityBitMapBase = ALL_SERVER_CITY_INDEX.get(serverCity) * 10;
|
||||||
int serverGraphNum = cityBitMapBase;
|
int serverGraphNum = cityBitMapBase;
|
||||||
@@ -84,7 +86,7 @@ public class XrayDBOperator {
|
|||||||
|
|
||||||
return ProxyNode
|
return ProxyNode
|
||||||
.builder()
|
.builder()
|
||||||
.agentTopicName(serverInfoVO.getTopicName())
|
.agentTopicName(serverInfoVO.getAgentTopicName())
|
||||||
.num(serverGraphNum)
|
.num(serverGraphNum)
|
||||||
.publicIPv4(serverInfoVO.getServerIpPbV4())
|
.publicIPv4(serverInfoVO.getServerIpPbV4())
|
||||||
.publicIPv6(serverInfoVO.getServerIpPbV6())
|
.publicIPv6(serverInfoVO.getServerIpPbV6())
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package io.wdd.rpc.init;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.rabbitmq.client.Channel;
|
|
||||||
import io.wdd.common.handler.MyRuntimeException;
|
import io.wdd.common.handler.MyRuntimeException;
|
||||||
import io.wdd.common.utils.TimeUtils;
|
import io.wdd.common.utils.TimeUtils;
|
||||||
import io.wdd.rpc.message.OctopusMessage;
|
import io.wdd.rpc.message.OctopusMessage;
|
||||||
@@ -12,20 +11,17 @@ import io.wdd.rpc.message.sender.OMessageToAgentSender;
|
|||||||
import io.wdd.rpc.status.deprecate.AgentStatus;
|
import io.wdd.rpc.status.deprecate.AgentStatus;
|
||||||
import io.wdd.server.beans.vo.ServerInfoVO;
|
import io.wdd.server.beans.vo.ServerInfoVO;
|
||||||
import io.wdd.server.utils.DaemonDatabaseOperator;
|
import io.wdd.server.utils.DaemonDatabaseOperator;
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.amqp.core.Message;
|
import org.springframework.amqp.core.Message;
|
||||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||||
import org.springframework.amqp.rabbit.annotation.*;
|
import org.springframework.amqp.rabbit.annotation.*;
|
||||||
import org.springframework.amqp.support.AmqpHeaders;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.messaging.handler.annotation.Header;
|
import org.springframework.messaging.handler.annotation.Payload;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import static io.wdd.common.config.OctopusObjectMapperConfig.OctopusObjectMapper;
|
import static io.wdd.common.config.OctopusObjectMapperConfig.OctopusObjectMapper;
|
||||||
|
|
||||||
@@ -103,7 +99,6 @@ public class AcceptAgentInitInfo {
|
|||||||
*
|
*
|
||||||
* @param message the message
|
* @param message the message
|
||||||
*/
|
*/
|
||||||
@SneakyThrows
|
|
||||||
@RabbitHandler
|
@RabbitHandler
|
||||||
@RabbitListener(
|
@RabbitListener(
|
||||||
bindings =
|
bindings =
|
||||||
@@ -113,14 +108,14 @@ public class AcceptAgentInitInfo {
|
|||||||
key = {"${octopus.message.init_to_server_key}"}
|
key = {"${octopus.message.init_to_server_key}"}
|
||||||
)
|
)
|
||||||
,
|
,
|
||||||
ackMode = "MANUAL"
|
ackMode = "AUTO"
|
||||||
)
|
)
|
||||||
public void handleOctopusAgentBootUpInfo(Message message, Channel channel, @Header(AmqpHeaders.DELIVERY_TAG) long deliveryTag) {
|
public void handleOctopusAgentBootUpInfo(@Payload Message message) {
|
||||||
|
|
||||||
// manual ack the rabbit message
|
// manual ack the rabbit message
|
||||||
// https://stackoverflow.com/questions/38728668/spring-rabbitmq-using-manual-channel-acknowledgement-on-a-service-with-rabbit
|
// https://stackoverflow.com/questions/38728668/spring-rabbitmq-using-manual-channel-acknowledgement-on-a-service-with-rabbit
|
||||||
|
|
||||||
ServerInfoVO serverInfoVO;
|
ServerInfoVO serverInfoVO = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -141,19 +136,17 @@ public class AcceptAgentInitInfo {
|
|||||||
|
|
||||||
// 2. generate the unique topic for agent
|
// 2. generate the unique topic for agent
|
||||||
String agentQueueTopic = generateAgentQueueTopic(serverInfoVO);
|
String agentQueueTopic = generateAgentQueueTopic(serverInfoVO);
|
||||||
serverInfoVO.setTopicName(agentQueueTopic);
|
if (StringUtils.isBlank(agentQueueTopic)) {
|
||||||
|
throw new RuntimeException("agent topic name generate error!");
|
||||||
// cache enabled for agent re-register
|
}
|
||||||
// if (!checkAgentAlreadyRegister(agentQueueTopic)) {
|
serverInfoVO.setAgentTopicName(agentQueueTopic);
|
||||||
// log.info("[AGENT INIT] - agent not exist ! start to register !");
|
|
||||||
// }
|
|
||||||
|
|
||||||
// whether agent is registered already
|
// whether agent is registered already
|
||||||
// save or update the octopus agent server info
|
// save or update the octopus agent server info
|
||||||
// 3. save the agent info into database
|
// 3. save the agent info into database
|
||||||
// backend fixed thread daemon to operate the database ensuring the operation is correct !
|
// backend fixed thread daemon to operate the database ensuring the operation is correct !
|
||||||
if (!databaseOperator.saveInitOctopusAgentInfo(serverInfoVO)) {
|
if (!databaseOperator.saveInitOctopusAgentInfo(serverInfoVO)) {
|
||||||
throw new MyRuntimeException("database save agent info error !");
|
throw new RuntimeException("database save agent info error !");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. generate the Octopus Agent Status Redis Stream Key & Consumer-Group
|
// 4. generate the Octopus Agent Status Redis Stream Key & Consumer-Group
|
||||||
@@ -162,55 +155,14 @@ public class AcceptAgentInitInfo {
|
|||||||
// 5. send InitMessage to agent
|
// 5. send InitMessage to agent
|
||||||
sendInitMessageToAgent(serverInfoVO);
|
sendInitMessageToAgent(serverInfoVO);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
} catch (IOException e) {
|
log.error("handle init_to_server queue error => {}", e.getMessage());
|
||||||
|
return;
|
||||||
/**
|
|
||||||
* 有异常就绝收消息
|
|
||||||
* basicNack(long deliveryTag, boolean multiple, boolean requeue)
|
|
||||||
* requeue:true为将消息重返当前消息队列,还可以重新发送给消费者;
|
|
||||||
* false:将消息丢弃
|
|
||||||
*/
|
|
||||||
|
|
||||||
// long deliveryTag, boolean multiple, boolean requeue
|
|
||||||
|
|
||||||
channel.basicNack(
|
|
||||||
deliveryTag,
|
|
||||||
false,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
// long deliveryTag, boolean requeue
|
|
||||||
// channel.basicReject(deliveryTag,true);
|
|
||||||
|
|
||||||
// 这里只是便于出现死循环时查看
|
|
||||||
TimeUnit.SECONDS.sleep(5);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 一般实际异常情况下的处理过程:记录出现异常的业务数据,将它单独插入到一个单独的模块,
|
|
||||||
* 然后尝试3次,如果还是处理失败的话,就进行人工介入处理
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
throw new MyRuntimeException("Octopus Server Initialization Error, please check !");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 无异常就确认消息
|
|
||||||
* 无异常就确认消息
|
|
||||||
* basicAck(long deliveryTag, boolean multiple)
|
|
||||||
* deliveryTag:取出来当前消息在队列中的的索引;
|
|
||||||
* multiple:为true的话就是批量确认,如果当前deliveryTag为5,那么就会确认
|
|
||||||
* deliveryTag为5及其以下的消息;一般设置为false
|
|
||||||
*/
|
|
||||||
// ack the rabbitmq info
|
|
||||||
// If all logic is successful
|
|
||||||
log.info(
|
log.info(
|
||||||
"Agent [ {} ] has init successfully !",
|
"Agent [ {} ] has init successfully !",
|
||||||
serverInfoVO.getTopicName()
|
serverInfoVO.getAgentTopicName()
|
||||||
);
|
|
||||||
channel.basicAck(
|
|
||||||
deliveryTag,
|
|
||||||
false
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +211,7 @@ public class AcceptAgentInitInfo {
|
|||||||
// should be the OctopusExchange Name
|
// should be the OctopusExchange Name
|
||||||
.content(serverInfoContent)
|
.content(serverInfoContent)
|
||||||
.init_time(TimeUtils.currentFormatTime())
|
.init_time(TimeUtils.currentFormatTime())
|
||||||
.uuid(serverInfoVO.getTopicName())
|
.uuid(serverInfoVO.getAgentTopicName())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
oMessageToAgentSender.sendINIT(octopusMessage);
|
oMessageToAgentSender.sendINIT(octopusMessage);
|
||||||
@@ -303,7 +255,7 @@ public class AcceptAgentInitInfo {
|
|||||||
"city are not validated from agent are {}",
|
"city are not validated from agent are {}",
|
||||||
serverInfoVO
|
serverInfoVO
|
||||||
);
|
);
|
||||||
throw new MyRuntimeException("server name not validated !");
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
String machineIdPrefixSixBytes = String.valueOf(
|
String machineIdPrefixSixBytes = String.valueOf(
|
||||||
@@ -311,7 +263,7 @@ public class AcceptAgentInitInfo {
|
|||||||
.getMachineId()
|
.getMachineId()
|
||||||
.toCharArray(),
|
.toCharArray(),
|
||||||
0,
|
0,
|
||||||
6
|
8
|
||||||
);
|
);
|
||||||
|
|
||||||
return serverName + "-" + machineIdPrefixSixBytes;
|
return serverName + "-" + machineIdPrefixSixBytes;
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public class AllAgentStatusCache {
|
|||||||
|
|
||||||
List<String> collect = allAgentInfo
|
List<String> collect = allAgentInfo
|
||||||
.stream()
|
.stream()
|
||||||
.map(ServerInfoPO::getTopicName)
|
.map(ServerInfoPO::getAgentTopicName)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
ALL_AGENT_TOPIC_NAME_LIST.addAll(collect);
|
ALL_AGENT_TOPIC_NAME_LIST.addAll(collect);
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public class ServerInfoPO implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* octopus message unique key name
|
* octopus message unique key name
|
||||||
*/
|
*/
|
||||||
@TableField(value = "topic_name")
|
@TableField(value = "agent_topic_name")
|
||||||
private String topicName;
|
private String agentTopicName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server host name
|
* server host name
|
||||||
@@ -93,11 +93,35 @@ public class ServerInfoPO implements Serializable {
|
|||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server location , type City Country
|
* 服务器所在的城市信息
|
||||||
|
*/
|
||||||
|
@TableField(value = "city")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省份
|
||||||
|
*/
|
||||||
|
@TableField(value = "province")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国家
|
||||||
|
*/
|
||||||
|
@TableField(value = "country")
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经纬度
|
||||||
*/
|
*/
|
||||||
@TableField(value = "location")
|
@TableField(value = "location")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时区
|
||||||
|
*/
|
||||||
|
@TableField(value = "timezone")
|
||||||
|
private String timezone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server isp manager
|
* server isp manager
|
||||||
*/
|
*/
|
||||||
@@ -116,12 +140,24 @@ public class ServerInfoPO implements Serializable {
|
|||||||
@TableField(value = "cpu_core")
|
@TableField(value = "cpu_core")
|
||||||
private String cpuCore;
|
private String cpuCore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构 amd64
|
||||||
|
*/
|
||||||
|
@TableField(value = "cpu_arch")
|
||||||
|
private String cpuArch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@TableField(value = "memory_total")
|
@TableField(value = "memory_total")
|
||||||
private String memoryTotal;
|
private String memoryTotal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableField(value = "swap_total")
|
||||||
|
private String swapTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -152,6 +188,36 @@ public class ServerInfoPO implements Serializable {
|
|||||||
@TableField(value = "virtualization")
|
@TableField(value = "virtualization")
|
||||||
private String virtualization;
|
private String virtualization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统平台
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统具体类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform_family")
|
||||||
|
private String platformFamily;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统的版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform_version")
|
||||||
|
private String platformVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内核版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "kernel_version")
|
||||||
|
private String kernelVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内核的架构 x86_64
|
||||||
|
*/
|
||||||
|
@TableField(value = "kernel_arch")
|
||||||
|
private String kernelArch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -189,10 +255,10 @@ public class ServerInfoPO implements Serializable {
|
|||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* optimistic lock for concurrent
|
* Agent的版本信息
|
||||||
*/
|
*/
|
||||||
@TableField(value = "version")
|
@TableField(value = "agent_version")
|
||||||
private Integer version;
|
private String agentVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务器的角色信息
|
* 服务器的角色信息
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package io.wdd.server.beans.vo;
|
package io.wdd.server.beans.vo;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -22,134 +20,246 @@ public class ServerInfoVO {
|
|||||||
*/
|
*/
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
|
@TableField(value = "tenant_name")
|
||||||
|
private String tenantName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* octopus message unique key name
|
||||||
|
*/
|
||||||
|
@TableField(value = "agent_topic_name")
|
||||||
|
private String agentTopicName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server host name
|
* server host name
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "server_name")
|
||||||
private String serverName;
|
private String serverName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server public ipv4
|
* server public ipv4
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "server_ip_pb_v4")
|
||||||
private String serverIpPbV4;
|
private String serverIpPbV4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server inner ipv4
|
* server inner ipv4
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "server_ip_in_v4")
|
||||||
private String serverIpInV4;
|
private String serverIpInV4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server public ipv6
|
* server public ipv6
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "server_ip_pb_v6")
|
||||||
private String serverIpPbV6;
|
private String serverIpPbV6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server inner ipv6
|
* server inner ipv6
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "server_ip_in_v6")
|
||||||
private String serverIpInV6;
|
private String serverIpInV6;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* server register time
|
||||||
|
*/
|
||||||
|
@TableField(value = "register_time")
|
||||||
|
private LocalDateTime registerTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* expire time
|
||||||
|
*/
|
||||||
|
@TableField(value = "expire_time")
|
||||||
|
private LocalDateTime expireTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@TableField(value = "update_time")
|
||||||
private LocalDateTime registerTime;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime expireTime;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
private Integer proxyType;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableField(value = "create_time")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server location , type City Country
|
* 服务器所在的城市信息
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "city")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省份
|
||||||
|
*/
|
||||||
|
@TableField(value = "province")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 国家
|
||||||
|
*/
|
||||||
|
@TableField(value = "country")
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 经纬度
|
||||||
|
*/
|
||||||
|
@TableField(value = "location")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时区
|
||||||
|
*/
|
||||||
|
@TableField(value = "timezone")
|
||||||
|
private String timezone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server isp manager
|
* server isp manager
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "provider")
|
||||||
private String provider;
|
private String provider;
|
||||||
|
|
||||||
/**
|
|
||||||
* split by ,
|
|
||||||
*/
|
|
||||||
private String managePort;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "cpu_brand")
|
||||||
private String cpuBrand;
|
private String cpuBrand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "cpu_core")
|
||||||
private String cpuCore;
|
private String cpuCore;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu架构 amd64
|
||||||
|
*/
|
||||||
|
@TableField(value = "cpu_arch")
|
||||||
|
private String cpuArch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "memory_total")
|
||||||
private String memoryTotal;
|
private String memoryTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "swap_total")
|
||||||
|
private String swapTotal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableField(value = "disk_total")
|
||||||
private String diskTotal;
|
private String diskTotal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "disk_usage")
|
||||||
private String diskUsage;
|
private String diskUsage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "io_speed")
|
||||||
private String ioSpeed;
|
private String ioSpeed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "tcp_control")
|
||||||
private String tcpControl;
|
private String tcpControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* server virtualization method
|
* server virtualization method
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "virtualization")
|
||||||
private String virtualization;
|
private String virtualization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统平台
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform")
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统具体类别
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform_family")
|
||||||
|
private String platformFamily;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作系统的版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "platform_version")
|
||||||
|
private String platformVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内核版本
|
||||||
|
*/
|
||||||
|
@TableField(value = "kernel_version")
|
||||||
|
private String kernelVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内核的架构 x86_64
|
||||||
|
*/
|
||||||
|
@TableField(value = "kernel_arch")
|
||||||
|
private String kernelArch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "os_info")
|
||||||
private String osInfo;
|
private String osInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "os_kernel_info")
|
||||||
private String osKernelInfo;
|
private String osKernelInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器能否访问公网
|
||||||
|
*/
|
||||||
|
@TableField(value = "can_access_public")
|
||||||
|
private Integer canAccessPublic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* machine uuid from /etc/machineid
|
* machine uuid from /etc/machineid
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "machine_id")
|
||||||
private String machineId;
|
private String machineId;
|
||||||
|
|
||||||
/**
|
|
||||||
* octopus message unique key name
|
|
||||||
*/
|
|
||||||
private String topicName;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@TableField(value = "comment")
|
||||||
private String comment;
|
private String comment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0 alive || 1 deleted
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_delete")
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent的版本信息
|
||||||
|
*/
|
||||||
|
@TableField(value = "agent_version")
|
||||||
private String agentVersion;
|
private String agentVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器的角色信息
|
||||||
|
*/
|
||||||
|
@TableField(value = "role")
|
||||||
|
private String role;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.wdd.server.beans.po.ServerInfoPO;
|
|||||||
/**
|
/**
|
||||||
* @author wddsh
|
* @author wddsh
|
||||||
* @description 针对表【server_info】的数据库操作Mapper
|
* @description 针对表【server_info】的数据库操作Mapper
|
||||||
* @createDate 2024-03-26 18:11:29
|
* @createDate 2024-04-29 16:46:02
|
||||||
* @Entity io.wdd.server.beans.po.ServerInfoPO
|
* @Entity io.wdd.server.beans.po.ServerInfoPO
|
||||||
*/
|
*/
|
||||||
public interface ServerInfoMapper extends BaseMapper<ServerInfoPO> {
|
public interface ServerInfoMapper extends BaseMapper<ServerInfoPO> {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import io.wdd.server.beans.po.ServerInfoPO;
|
|||||||
/**
|
/**
|
||||||
* @author wddsh
|
* @author wddsh
|
||||||
* @description 针对表【server_info】的数据库操作Service
|
* @description 针对表【server_info】的数据库操作Service
|
||||||
* @createDate 2024-03-26 18:11:29
|
* @createDate 2024-04-29 16:46:02
|
||||||
*/
|
*/
|
||||||
public interface ServerInfoService extends IService<ServerInfoPO> {
|
public interface ServerInfoService extends IService<ServerInfoPO> {
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Service;
|
|||||||
/**
|
/**
|
||||||
* @author wddsh
|
* @author wddsh
|
||||||
* @description 针对表【server_info】的数据库操作Service实现
|
* @description 针对表【server_info】的数据库操作Service实现
|
||||||
* @createDate 2024-03-26 18:11:29
|
* @createDate 2024-04-29 16:46:02
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ServerInfoServiceImpl extends ServiceImpl<ServerInfoMapper, ServerInfoPO>
|
public class ServerInfoServiceImpl extends ServiceImpl<ServerInfoMapper, ServerInfoPO>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ spring:
|
|||||||
allow-circular-references: true
|
allow-circular-references: true
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 42.192.52.227
|
host: 10.250.0.100
|
||||||
port: 20672
|
port: 20672
|
||||||
username: boge
|
username: boge
|
||||||
password: boge8tingH
|
password: boge8tingH
|
||||||
@@ -22,9 +22,9 @@ spring:
|
|||||||
enabled: true
|
enabled: true
|
||||||
# retry interval unit ms
|
# retry interval unit ms
|
||||||
max-interval: 65000
|
max-interval: 65000
|
||||||
initial-interval: 65000
|
initial-interval: 2000
|
||||||
redis:
|
redis:
|
||||||
host: 42.192.52.227
|
host: 10.250.0.100
|
||||||
port: 21370
|
port: 21370
|
||||||
database: 0
|
database: 0
|
||||||
password: boge8tingH
|
password: boge8tingH
|
||||||
@@ -46,7 +46,7 @@ spring:
|
|||||||
|
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://42.192.52.227:21306/octopus_server?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
url: jdbc:mysql://10.250.0.100:21306/octopus_server?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
|
||||||
username: boge
|
username: boge
|
||||||
password: boge8tingH
|
password: boge8tingH
|
||||||
type: com.zaxxer.hikari.HikariDataSource
|
type: com.zaxxer.hikari.HikariDataSource
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<resultMap id="BaseResultMap" type="io.wdd.server.beans.po.ServerInfoPO">
|
<resultMap id="BaseResultMap" type="io.wdd.server.beans.po.ServerInfoPO">
|
||||||
<id property="serverId" column="server_id" jdbcType="BIGINT"/>
|
<id property="serverId" column="server_id" jdbcType="BIGINT"/>
|
||||||
<result property="tenantName" column="tenant_name" jdbcType="VARCHAR"/>
|
<result property="tenantName" column="tenant_name" jdbcType="VARCHAR"/>
|
||||||
<result property="topicName" column="topic_name" jdbcType="VARCHAR"/>
|
<result property="agentTopicName" column="agent_topic_name" jdbcType="VARCHAR"/>
|
||||||
<result property="serverName" column="server_name" jdbcType="VARCHAR"/>
|
<result property="serverName" column="server_name" jdbcType="VARCHAR"/>
|
||||||
<result property="serverIpPbV4" column="server_ip_pb_v4" jdbcType="VARCHAR"/>
|
<result property="serverIpPbV4" column="server_ip_pb_v4" jdbcType="VARCHAR"/>
|
||||||
<result property="serverIpInV4" column="server_ip_in_v4" jdbcType="VARCHAR"/>
|
<result property="serverIpInV4" column="server_ip_in_v4" jdbcType="VARCHAR"/>
|
||||||
@@ -17,37 +17,52 @@
|
|||||||
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
|
<result property="expireTime" column="expire_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||||
|
<result property="city" column="city" jdbcType="VARCHAR"/>
|
||||||
|
<result property="province" column="province" jdbcType="VARCHAR"/>
|
||||||
|
<result property="country" column="country" jdbcType="VARCHAR"/>
|
||||||
<result property="location" column="location" jdbcType="VARCHAR"/>
|
<result property="location" column="location" jdbcType="VARCHAR"/>
|
||||||
|
<result property="timezone" column="timezone" jdbcType="VARCHAR"/>
|
||||||
<result property="provider" column="provider" jdbcType="VARCHAR"/>
|
<result property="provider" column="provider" jdbcType="VARCHAR"/>
|
||||||
<result property="cpuBrand" column="cpu_brand" jdbcType="VARCHAR"/>
|
<result property="cpuBrand" column="cpu_brand" jdbcType="VARCHAR"/>
|
||||||
<result property="cpuCore" column="cpu_core" jdbcType="VARCHAR"/>
|
<result property="cpuCore" column="cpu_core" jdbcType="VARCHAR"/>
|
||||||
|
<result property="cpuArch" column="cpu_arch" jdbcType="VARCHAR"/>
|
||||||
<result property="memoryTotal" column="memory_total" jdbcType="VARCHAR"/>
|
<result property="memoryTotal" column="memory_total" jdbcType="VARCHAR"/>
|
||||||
|
<result property="swapTotal" column="swap_total" jdbcType="VARCHAR"/>
|
||||||
<result property="diskTotal" column="disk_total" jdbcType="VARCHAR"/>
|
<result property="diskTotal" column="disk_total" jdbcType="VARCHAR"/>
|
||||||
<result property="diskUsage" column="disk_usage" jdbcType="VARCHAR"/>
|
<result property="diskUsage" column="disk_usage" jdbcType="VARCHAR"/>
|
||||||
<result property="ioSpeed" column="io_speed" jdbcType="VARCHAR"/>
|
<result property="ioSpeed" column="io_speed" jdbcType="VARCHAR"/>
|
||||||
<result property="tcpControl" column="tcp_control" jdbcType="VARCHAR"/>
|
<result property="tcpControl" column="tcp_control" jdbcType="VARCHAR"/>
|
||||||
<result property="virtualization" column="virtualization" jdbcType="VARCHAR"/>
|
<result property="virtualization" column="virtualization" jdbcType="VARCHAR"/>
|
||||||
|
<result property="platform" column="platform" jdbcType="VARCHAR"/>
|
||||||
|
<result property="platformFamily" column="platform_family" jdbcType="VARCHAR"/>
|
||||||
|
<result property="platformVersion" column="platform_version" jdbcType="VARCHAR"/>
|
||||||
|
<result property="kernelVersion" column="kernel_version" jdbcType="VARCHAR"/>
|
||||||
|
<result property="kernelArch" column="kernel_arch" jdbcType="VARCHAR"/>
|
||||||
<result property="osInfo" column="os_info" jdbcType="VARCHAR"/>
|
<result property="osInfo" column="os_info" jdbcType="VARCHAR"/>
|
||||||
<result property="osKernelInfo" column="os_kernel_info" jdbcType="VARCHAR"/>
|
<result property="osKernelInfo" column="os_kernel_info" jdbcType="VARCHAR"/>
|
||||||
<result property="canAccessPublic" column="can_access_public" jdbcType="TINYINT"/>
|
<result property="canAccessPublic" column="can_access_public" jdbcType="TINYINT"/>
|
||||||
<result property="machineId" column="machine_id" jdbcType="VARCHAR"/>
|
<result property="machineId" column="machine_id" jdbcType="VARCHAR"/>
|
||||||
<result property="comment" column="comment" jdbcType="VARCHAR"/>
|
<result property="comment" column="comment" jdbcType="VARCHAR"/>
|
||||||
<result property="isDelete" column="is_delete" jdbcType="TINYINT"/>
|
<result property="isDelete" column="is_delete" jdbcType="TINYINT"/>
|
||||||
<result property="version" column="version" jdbcType="INTEGER"/>
|
<result property="agentVersion" column="agent_version" jdbcType="VARCHAR"/>
|
||||||
<result property="role" column="role" jdbcType="VARCHAR"/>
|
<result property="role" column="role" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
server_id
|
server_id
|
||||||
,tenant_name,topic_name,
|
,tenant_name,agent_topic_name,
|
||||||
server_name,server_ip_pb_v4,server_ip_in_v4,
|
server_name,server_ip_pb_v4,server_ip_in_v4,
|
||||||
server_ip_pb_v6,server_ip_in_v6,register_time,
|
server_ip_pb_v6,server_ip_in_v6,register_time,
|
||||||
expire_time,update_time,create_time,
|
expire_time,update_time,create_time,
|
||||||
location,provider,cpu_brand,
|
city,province,country,
|
||||||
cpu_core,memory_total,disk_total,
|
location,timezone,provider,
|
||||||
|
cpu_brand,cpu_core,cpu_arch,
|
||||||
|
memory_total,swap_total,disk_total,
|
||||||
disk_usage,io_speed,tcp_control,
|
disk_usage,io_speed,tcp_control,
|
||||||
virtualization,os_info,os_kernel_info,
|
virtualization,platform,platform_family,
|
||||||
can_access_public,machine_id,comment,
|
platform_version,kernel_version,kernel_arch,
|
||||||
is_delete,version,role
|
os_info,os_kernel_info,can_access_public,
|
||||||
|
machine_id,comment,is_delete,
|
||||||
|
agent_version,role
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public class TestImageSyncScheduler {
|
|||||||
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
ArrayList<String> ImageFullNameList = new ArrayList<>(List.of(
|
||||||
// "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0",
|
// "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0",
|
||||||
// "harbor.cdcyy.com.cn/cmii/cmii/srs:v5.0.195"
|
// "harbor.cdcyy.com.cn/cmii/cmii/srs:v5.0.195"
|
||||||
"harbor.cdcyy.com.cn/cmii/cmii-uav-platform:5.3.0-cqly-042901"
|
"harbor.cdcyy.com.cn/cmii/cmii-uav-platform:5.3.0-cqly-042902"
|
||||||
));
|
));
|
||||||
|
|
||||||
Boolean downloadAndCompressOnly = false;
|
Boolean downloadAndCompressOnly = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user