use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class InitTestDataService method init.
/**
* 创建初始化数据
*/
public InitData init() {
// 1. 创建 account
// 2. 创建 project
// 3. 创建 module
// 4. 初始化 env
// 5. 创建 server group & server
List<ProjectEnv> envs = createProjectEnv();
AdminAccount account = createAdminAccount();
Project project = createProject(account);
ProjectModule module = createModule(account.getUid(), project, envs);
return new InitData(account, project, module, envs);
}
use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class ModuleServiceTest method testCheckResinPort.
@Test
public void testCheckResinPort() {
ProjectModule module = moduleService.getByModuleId(6);
List<ServerGroup> serverGroups = serverGroupService.getByModuleIds(Lists.newArrayList(6), true);
module.setServerGroups(serverGroups);
module.setModuleId(0);
module.getResinConf().setHttpPort(8087);
module.getResinConf().setServerPort(6807);
module.getResinConf().setWatchdogPort(6608);
Map<String, String> resinPort2OccupyInfoMap = moduleService.checkResinPortOccupy(module);
assert !resinPort2OccupyInfoMap.isEmpty();
}
use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class DeployHistoryServiceImpl method checkModuleStatus.
private void checkModuleStatus(int moduleId) {
ProjectModule module = projectModuleService.getByModuleId(moduleId);
if (module == null) {
throw new IllegalArgumentException("模块不存在,moduleId=" + moduleId);
}
if (module.getModuleType() != ModuleType.STATIC.getValue()) {
Assert.hasText(module.getRestartShell(), "重启脚本为空,请先完善模块配置");
}
Assert.hasText(module.getCompileShell(), "编译脚本为空,请先完善模块配置");
Assert.hasText(module.getSvnAccount(), "svn/git帐号为空,请先完善模块配置");
Assert.hasText(module.getSvnPassword(), "svn/git密码为空,请先完善模块配置");
}
use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class DeployHistoryServiceImpl method createDeploymentOrder.
@Override
@Transactional
public void createDeploymentOrder(DeploymentOrder order) {
validateParameterAndModule(order);
// 检查服务器是否存在 & 环境是否为 envId
List<Server> servers = checkServerStatus(order);
checkProjectAuthorization(order);
checkIfDeployingModuleWithEnv(order);
logger.info("创建上线单 | order: " + JSON.toJSONString(order));
ProjectModule module = projectModuleService.getByModuleId(order.getModuleId());
DeployHistoryPO deployHistory = new DeployHistoryPO();
VOUtil.copy(order, deployHistory);
deployHistory.setCreateTime(new Date());
deployHistory.setProjectId(module.getProjectId());
deployHistory.setModuleName(module.getModuleName());
deployHistory.setResult(DeployResult.NONE.getValue());
// 如果模块需要审核,进入审核,否则进入发布阶段
if (needAudit(module, deployHistory)) {
deployHistory.setDeployStatus(DeployStatus.WAITING_FOR_AUDIT.getValue());
} else {
deployHistory.setDeployStatus(DeployStatus.WAITING_FOR_DEPLOYMENT.getValue());
}
deployHistory.setSuccessCount(0);
deployHistory.setDeployServers(order.getServerId().length);
if (!deployHistory.getTagName().startsWith("/")) {
deployHistory.setTagName("/" + deployHistory.getTagName());
}
// 判断是不是回滚的请求
if (deployHistory.getRollbackToDeployId() > 0) {
deployHistory.setIsRollback(Constants.TRUE);
}
deployHistoryDao.insert(deployHistory);
saveDeployServers(deployHistory, order, servers);
}
use of com.ibeiliao.deployment.admin.vo.project.ProjectModule in project Corgi by kevinYin.
the class CreateDeploymentController method enoughServerRes.
/**
* 判断服务器资源是否足够
* @param order
* @return ApiCode.SUCCESS=足够
* @author linyi 2017/5/11
*/
private RestResult<Object> enoughServerRes(DeploymentOrder order) {
List<DeployHistory> histories = deployHistoryService.queryDeployHistory(order.getEnvId(), order.getModuleId(), 1, 10);
// 静态项目不做判断
ProjectModule module = projectModuleService.getByModuleId(order.getModuleId());
if (module.getModuleType() == ModuleType.STATIC.getValue()) {
return new RestResult<>(ApiCode.SUCCESS, "");
}
/* if (CollectionUtils.isEmpty(histories)) {
logger.info("第一次发布");
String jvmArgs = getJvmArgs(order.getModuleId(), order.getEnvId());
for (int serverId : order.getServerId()) {
Server server = serverService.getById(serverId);
if (server == null || StringUtils.isBlank(server.getIp())) {
return new RestResult<>(ApiCode.FAILURE, "serverId或IP不存在, serverId: " + serverId);
}
RestResult<Object> result = AliyunEcsUtil.isEnoughResByIp(server.getIp(), jvmArgs);
if (!result.isSuccess()) {
return result;
}
}
}*/
return new RestResult<>(ApiCode.SUCCESS, "");
}
Aggregations