Search in sources :

Example 1 with JavaTransferService

use of com.ibeiliao.deployment.transfer.service.JavaTransferService in project Corgi by kevinYin.

the class TestTransfer method testTransform.

@Test
public void testTransform() {
    TransferRequest transferRequest = new TransferRequest();
    transferRequest.setHistoryId(20);
    transferRequest.setSaveFileName("dev/statement-impl.tar.gz");
    transferRequest.setModuleName("statement-impl");
    transferRequest.setEnv("dev");
    transferRequest.setModuleType(ModuleType.SERVICE.getValue());
    transferRequest.setTargetServerIps(Lists.newArrayList("123.56.158.175"));
    transferRequest.setProjectName("pay");
    transferRequest.setRestartShell("com.alibaba.dubbo.container.Main");
    transferRequest.setJvmArgs("-Xms128m -Xmx192m -server -d64");
    // 发布  重启  stop
    JavaTransferService javaTransferService = new JavaTransferService(transferRequest, DeployType.STOP);
    javaTransferService.pushPackageToServer();
// JavaTransferService.buildModuleRestartShell(transferRequest, new TransferResult());
}
Also used : TransferRequest(com.ibeiliao.deployment.transfer.vo.TransferRequest) JavaTransferService(com.ibeiliao.deployment.transfer.service.JavaTransferService) Test(org.junit.Test)

Example 2 with JavaTransferService

use of com.ibeiliao.deployment.transfer.service.JavaTransferService in project Corgi by kevinYin.

the class ViewProjectController method stopServer.

/**
 * 停止服务
 */
@RequestMapping("stopServer.do")
@ResponseBody
@MenuResource("停止服务")
public RestResult<Object> stopServer(int serverId) {
    TransferRequest request;
    try {
        request = createTransferRequest(serverId, false);
        Assert.isTrue(request.getModuleType() != ModuleType.STATIC.getValue(), "静态项目不能stop");
        JavaTransferService javaTransferService = new JavaTransferService(request, DeployType.STOP);
        return transfer(request.getHistoryId(), javaTransferService);
    } catch (Exception e) {
        logger.info("停止失败,{}", e);
        return new RestResult<>(ApiCode.FAILURE, "停止失败");
    }
}
Also used : TransferRequest(com.ibeiliao.deployment.transfer.vo.TransferRequest) JavaTransferService(com.ibeiliao.deployment.transfer.service.JavaTransferService) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with JavaTransferService

use of com.ibeiliao.deployment.transfer.service.JavaTransferService in project Corgi by kevinYin.

the class ViewProjectController method restartServer.

/**
 * 重启服务
 */
@RequestMapping("restartServer.do")
@ResponseBody
@MenuResource("重启服务")
public RestResult<Object> restartServer(int serverId) {
    TransferRequest request;
    try {
        request = createTransferRequest(serverId, true);
        Assert.isTrue(request.getModuleType() != ModuleType.STATIC.getValue(), "静态项目不能执行重启");
        JavaTransferService javaTransferService = new JavaTransferService(request, DeployType.RESTART);
        return transfer(request.getHistoryId(), javaTransferService);
    } catch (Exception e) {
        logger.info("重启失败, {}", e);
        return new RestResult<>(ApiCode.FAILURE, "重启失败");
    }
}
Also used : TransferRequest(com.ibeiliao.deployment.transfer.vo.TransferRequest) JavaTransferService(com.ibeiliao.deployment.transfer.service.JavaTransferService) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

JavaTransferService (com.ibeiliao.deployment.transfer.service.JavaTransferService)3 TransferRequest (com.ibeiliao.deployment.transfer.vo.TransferRequest)3 MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Test (org.junit.Test)1