[Agent] [Octopus] - caqa fix bugs

This commit is contained in:
zeaslity
2024-01-30 15:54:33 +08:00
parent a471dabe46
commit 36c650301e
15 changed files with 327 additions and 47 deletions

View File

@@ -100,18 +100,18 @@ public class AppFuncScheduler {
);
List<AppFunctionEnum> appFunctionEnumList = List.of(
AppFunctionEnum.DEPLOY_CHRONY_SERVER,
AppFunctionEnum.DEPLOY_RKE
// AppFunctionEnum.DEPLOY_CHRONY_SERVER,
// AppFunctionEnum.DEPLOY_RKE
// AppFunctionEnum.DEPLOY_K8S_DASHBOARD,
// AppFunctionEnum.DEPLOY_NFS,
// AppFunctionEnum.DEPLOY_TEST_NFS,
// AppFunctionEnum.DEPLOY_K8S_NAMESPACE,
// AppFunctionEnum.DEPLOY_K8S_NAMESPACE
// AppFunctionEnum.DEPLOY_K8S_PVC,
// AppFunctionEnum.DEPLOY_K8S_MYSQL,
// AppFunctionEnum.DEPLOY_K8S_REDIS,
// AppFunctionEnum.DEPLOY_K8S_MIDDLEWARES,
// AppFunctionEnum.DEPLOY_INGRESS
// AppFunctionEnum.DEPLOY_FRONTEND
AppFunctionEnum.DEPLOY_FRONTEND
// AppFunctionEnum.DEPLOY_BACKEND
// AppFunctionEnum.DEPLOY_K8S_SRS

View File

@@ -96,9 +96,8 @@ public class BaseFuncScheduler {
List<BaseFunctionEnum> masterNodeProcedureList = List.of(
BaseFunctionEnum.DISABLE_SWAP,
BaseFunctionEnum.DISABLE_SELINUX,
BaseFunctionEnum.SHUTDOWN_FIREWALL,
BaseFunctionEnum.INSTALL_DEFAULT_SSH_KEY
BaseFunctionEnum.DISABLE_SELINUX
);
@@ -132,10 +131,9 @@ public class BaseFuncScheduler {
}
List<BaseFunctionEnum> masterNodeDurationTaskList = List.of(
// BaseFunctionEnum.INSTALL_NFS_SERVER_ONLINE,
// BaseFunctionEnum.INSTALL_DOCKER,
// BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
// BaseFunctionEnum.MODIFY_DOCKER_CONFIG,
BaseFunctionEnum.INSTALL_DOCKER,
BaseFunctionEnum.INSTALL_DOCKER_COMPOSE,
BaseFunctionEnum.MODIFY_DOCKER_CONFIG
// BaseFunctionEnum.INSTALL_HARBOR
);

View File

@@ -4,6 +4,7 @@ import io.wdd.func.auto.beans.HarborFunctionEnum;
import io.wdd.func.auto.beans.ProjectDeployContext;
import io.wdd.server.beans.po.ServerInfoPO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -182,8 +183,8 @@ public class HarborFuncScheduler {
syncHarborArgList.add(masterNode.getServerIpInV4());
// second arg sourceHarborHost
String sourceHarborHost = getIPv4Address();
syncHarborArgList.add(sourceHarborHost);
// String sourceHarborHost = getIPv4Address();
syncHarborArgList.add("harbor.wdd.io");
// third arg sync project name
syncHarborArgList.add(projectDeployContext.getCurrentSynchronizingProject());
@@ -218,14 +219,16 @@ public class HarborFuncScheduler {
String os = System
.getProperty("os.name")
.toLowerCase();
String devHarborSourceHost = "10.250.0.100";
// String devHarborSourceHost = "10.250.0.100";
String devHarborSourceHost = "20.4.16.200"; // cqga
if (os.contains("linux")) {
try {
InetAddress localhost = InetAddress.getLocalHost();
if (localhost.getHostAddress() != null && !localhost
.getHostAddress()
.isEmpty()) {
.isEmpty() && !StringUtils.startsWith(localhost.getHostAddress(), "127")) {
return localhost.getHostAddress();
} else {

View File

@@ -53,11 +53,11 @@ public class AcceptAgentInitInfo {
"London",
7,
"LosAngeles",
7,
"Beijing",
8,
"Paripark",
9
"Beijing",
9,
"Chongqing",
10
)
);
public static Set<String> ALL_SERVER_ARCH_INFO = new HashSet<>(

View File

@@ -1,14 +1,15 @@
server:
port: 9999
# shanghai 10.250.0.100
# local 10.250.0.100
# shanghai 20.4.16.200
# local 20.4.16.200
# cqga 20.4.16.200
spring:
main:
allow-circular-references: true
allow-bean-definition-overriding: true
rabbitmq:
host: 10.250.0.100
host: 20.4.16.200
port: 20672
username: boge
password: boge8tingH
@@ -23,7 +24,7 @@ spring:
max-interval: 65000
initial-interval: 65000
redis:
host: 10.250.0.100
host: 20.4.16.200
port: 21370
database: 0
password: boge8tingH
@@ -46,7 +47,7 @@ spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://10.250.0.100:21306/octopus_server?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
url: jdbc:mysql://20.4.16.200:21306/octopus_server?autoReconnect=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: boge
password: boge8tingH
type: com.zaxxer.hikari.HikariDataSource

View File

@@ -5,12 +5,15 @@ import io.wdd.func.auto.service.AppFuncScheduler;
import io.wdd.func.auto.service.BaseFuncScheduler;
import io.wdd.func.auto.service.HarborFuncScheduler;
import io.wdd.server.beans.po.ServerInfoPO;
import io.wdd.server.beans.request.ServerQueryEntity;
import io.wdd.server.beans.vo.ProjectServerVO;
import io.wdd.server.coreService.CoreProjectServerService;
import io.wdd.server.coreService.CoreServerService;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.annotation.Resource;
import java.util.Optional;
@SpringBootTest
public class TestBaseFuncScheduler {
@@ -27,37 +30,67 @@ public class TestBaseFuncScheduler {
@Resource
CoreServerService serverService;
@Resource
CoreProjectServerService coreProjectServerService;
@Test
public void testRunProcedure() {
ProjectDeployContext projectDeployContext = new ProjectDeployContext();
// projectDeployContext.setProjectId(1716372290994155522L); // vultr
projectDeployContext.setProjectId(1722453318596550657L); // lappro
Long projectServerId = 1751084188582440961L;// cqga
// Long projectServerId = 1722453318596550657L;// lappro
projectDeployContext.setProjectId(projectServerId);
ServerQueryEntity serverQueryEntity = new ServerQueryEntity();
// exsi server
serverQueryEntity.setServerName("Chengdu-amd64-99");
// ServerQueryEntity serverQueryEntity = new ServerQueryEntity();
// // exsi server
//// serverQueryEntity.setServerName("Chengdu-amd64-99");
// // lappro
//// serverQueryEntity.setServerName("Chengdu-amd64-65");
//
// // cqga
// serverQueryEntity.setServerName();
// ServerInfoPO serverInfoPO = serverService
// .serverGetByPage(serverQueryEntity)
// .getRecords()
// .get(0);
// lappro
// serverQueryEntity.setServerName("Chengdu-amd64-65");
String serverName = "Chongqing-amd64-01"; // cgga
// String serverName = "Chengdu-amd64-99"; // lap pro
ServerInfoPO serverInfoPO = serverService
.serverGetByPage(serverQueryEntity)
.getRecords()
.get(0);
ProjectServerVO projectServerVO = coreProjectServerService.projectServerOne(projectServerId);
Optional<ServerInfoPO> serverInfoPOOptional = projectServerVO.getBindingServerList().stream().filter(
serverInfoPO -> StringUtils.contains(serverInfoPO.getServerName(), serverName)
).findFirst();
if (serverInfoPOOptional.isEmpty()) {
System.out.printf("project of %s server of %s is empty", projectServerVO, serverName);
return;
}
ServerInfoPO serverInfoPO = serverInfoPOOptional.get();
System.out.println("serverInfoPO = " + serverInfoPO);
projectDeployContext.setMasterNode(serverInfoPO);
// baseFuncScheduler.runProcedure(projectDeployContext);
baseFuncScheduler.runProcedure(projectDeployContext);
// projectServerVO.getBindingServerList().forEach(
// serverInfoPO1 -> {
// if (!StringUtils.contains(serverInfoPO1.getServerName(), "01")) {
// projectDeployContext.setMasterNode(serverInfoPO1);
//
// baseFuncScheduler.runProcedure(projectDeployContext);
// }
// }
// );
// harborFuncScheduler.runProcedure(projectDeployContext);
// appFuncScheduler.runProcedure(projectDeployContext);
appFuncScheduler.runProcedure(projectDeployContext);
}
}