Service Deployer
class ServiceDeployer(keyPair: Set<KeyPair>, proxyJump: String? = null, sshPrepareWork: (session: ClientSession, node: ServiceNode, service: Service) -> Unit? = null, sleepAfterSuspend: Duration? = null, clientSessionFetcher: (SshClient, ServiceNode) -> ClientSession = { sshClient, node ->
sshClient
.let {
if (proxyJump != null) {
it.connect(HostConfigEntry("", node.ip, 22, "root", proxyJump))
} else
it.connect("root", node.ip, 22)
}
.verify(10000)
.session
})
负责在阿里云上部署或者升级服务
Author
CJ
Constructors
Link copied to clipboard
constructor(keyPair: Set<KeyPair>, proxyJump: String? = null, sshPrepareWork: (session: ClientSession, node: ServiceNode, service: Service) -> Unit? = null, sleepAfterSuspend: Duration? = null, clientSessionFetcher: (SshClient, ServiceNode) -> ClientSession = { sshClient, node ->
sshClient
.let {
if (proxyJump != null) {
it.connect(HostConfigEntry("", node.ip, 22, "root", proxyJump))
} else
it.connect("root", node.ip, 22)
}
.verify(10000)
.session
})
Functions
Link copied to clipboard
fun deploy(service: Service, entrances: Collection<IngressEntrance>, deployment: Deployment, logForService: LoggingApi = log.toLoggingApi(), logForNode: (node: ServiceNode, level: LogLevel, message: String, throwable: Throwable?) -> Unit = { node, level, message, t ->
logForService.logMessage(level, "${node.ip}:${node.port} " + message, t)
}, nodesAware: (List<ServiceNode>) -> Unit = { nodes ->
log.info("即将部署到:{}", nodes.map { "${it.ip}:${it.port}" })
}, nodeStageChanger: (ServiceNode, NodeDeployStage) -> Unit = { node, stage ->
log.info("${node.ip}:${node.port}" + "已经到了:{}", stage)
}, restart: Boolean = false)