feature(web): 优化额外参数的输入和服务信息查询优化
This commit is contained in:
@@ -21,7 +21,8 @@ echo "${info.name} $host $hostname $datetime"
|
|||||||
ssh $host 'bash -s' < stop.sh ${runtime.jarPath}/${info.name}.jar
|
ssh $host 'bash -s' < stop.sh ${runtime.jarPath}/${info.name}.jar
|
||||||
<#if selectedHosts?seq_contains(host)>
|
<#if selectedHosts?seq_contains(host)>
|
||||||
ssh $host "mkdir -p ${runtime.jarPath};curl ftp://yyy:QeY\!68\)4nH1@132.121.122.15:2222/${info.sourceJar} -o ${runtime.jarPath}/${info.name}.jar"
|
ssh $host "mkdir -p ${runtime.jarPath};curl ftp://yyy:QeY\!68\)4nH1@132.121.122.15:2222/${info.sourceJar} -o ${runtime.jarPath}/${info.name}.jar"
|
||||||
ssh $host "export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P\"Dp^A47>WSn:Wn].gs/+\"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.';nohup ${runtime.jdkPath} <#list environments?keys as key>-D${key?replace("_", ".")}=${environments[key]?string} </#list>-jar ${runtime.jarPath}/${info.name}.jar<#noparse> --datetime=${datetime} --hostname=${hostname} --eureka.instance.hostname=${hostname} --logging.parent=${log_path} --loki.url=${loki_url} --spring.cloud.zookeeper.connect-string=${zk_url} --eureka.client.service-url.defaultZone='${eureka_url}' --spring.security.meta.authority='${security_authority}' --spring.security.meta.username='${security_username}' --spring.security.meta.darkcode='${security_darkcode}'</#noparse> <#list arguments?keys as key>--${key?replace("_", ".")}=${arguments[key]?string} </#list>> /dev/null 2>&1 &"
|
start_time=`date +%Y%m%d%H%M%S`
|
||||||
|
ssh $host "export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P\"Dp^A47>WSn:Wn].gs/+\"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.';nohup ${runtime.jdkPath} <#list environments?keys as key>-D${key?replace("_", ".")}=${environments[key]?string} </#list>-jar ${runtime.jarPath}/${info.name}.jar<#noparse> --datetime=${datetime} --hostname=${hostname} --eureka.instance.hostname=${hostname} --logging.parent=${log_path} --loki.url=${loki_url} --eureka.client.service-url.defaultZone='${eureka_url}' --spring.cloud.zookeeper.connect-string=${zk_url} --spring.cloud.zookeeper.discovery.metadata.startTime=${start_time} --spring.cloud.zookeeper.discovery.metadata.hostIp=${host} --spring.security.meta.authority='${security_authority}' --spring.security.meta.username='${security_username}' --spring.security.meta.darkcode='${security_darkcode}'</#noparse> <#list arguments?keys as key>--${key?replace("_", ".")}=${arguments[key]?string} </#list>> /dev/null 2>&1 &"
|
||||||
</#if>
|
</#if>
|
||||||
echo ''
|
echo ''
|
||||||
</#list>
|
</#list>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ spring:
|
|||||||
enabled: ${spring.cloud.zookeeper.enabled}
|
enabled: ${spring.cloud.zookeeper.enabled}
|
||||||
root: /hudi-services
|
root: /hudi-services
|
||||||
instance-id: ${spring.application.name}-${hostname}-${random.uuid}-${datetime:19700101}
|
instance-id: ${spring.application.name}-${hostname}-${random.uuid}-${datetime:19700101}
|
||||||
|
metadata:
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
instance:
|
instance:
|
||||||
hostname: localhost
|
hostname: localhost
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.lanyuanxiaoyao.service.web.controller.base.BaseController;
|
|||||||
import com.lanyuanxiaoyao.service.web.entity.CloudServiceVO;
|
import com.lanyuanxiaoyao.service.web.entity.CloudServiceVO;
|
||||||
import com.netflix.appinfo.InstanceInfo;
|
import com.netflix.appinfo.InstanceInfo;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import org.apache.curator.x.discovery.ServiceInstance;
|
||||||
import org.eclipse.collections.api.block.function.Function;
|
import org.eclipse.collections.api.block.function.Function;
|
||||||
import org.eclipse.collections.api.factory.Lists;
|
import org.eclipse.collections.api.factory.Lists;
|
||||||
import org.eclipse.collections.api.factory.Maps;
|
import org.eclipse.collections.api.factory.Maps;
|
||||||
@@ -20,6 +21,8 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||||
import org.springframework.cloud.netflix.eureka.EurekaServiceInstance;
|
import org.springframework.cloud.netflix.eureka.EurekaServiceInstance;
|
||||||
|
import org.springframework.cloud.zookeeper.discovery.ZookeeperInstance;
|
||||||
|
import org.springframework.cloud.zookeeper.discovery.ZookeeperServiceInstance;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -68,6 +71,14 @@ public class CloudController extends BaseController {
|
|||||||
service.setServiceUpTime(info.getLeaseInfo().getServiceUpTimestamp());
|
service.setServiceUpTime(info.getLeaseInfo().getServiceUpTimestamp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (instance instanceof ZookeeperServiceInstance) {
|
||||||
|
ZookeeperServiceInstance zookeeperServiceInstance = (ZookeeperServiceInstance) instance;
|
||||||
|
ServiceInstance<ZookeeperInstance> serviceInstance = zookeeperServiceInstance.getServiceInstance();
|
||||||
|
if (ObjectUtil.isNotNull(serviceInstance)) {
|
||||||
|
service.setServiceUpTime(serviceInstance.getRegistrationTimeUTC());
|
||||||
|
service.setStatus(serviceInstance.getPayload().getMetadata().getOrDefault("instance_status", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
return service;
|
return service;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -76,7 +87,7 @@ public class CloudController extends BaseController {
|
|||||||
return services()
|
return services()
|
||||||
.groupBy(groupByField)
|
.groupBy(groupByField)
|
||||||
.toMap()
|
.toMap()
|
||||||
.collectValues((serviceId, services) -> new CloudServiceVO(serviceId, services.toSortedListBy(CloudServiceVO.Service::getHost).toImmutable()))
|
.collectValues((serviceId, services) -> new CloudServiceVO(serviceId, services.toSortedListBy(CloudServiceVO.Service::getServiceUpTime).toImmutable()))
|
||||||
.valuesView()
|
.valuesView()
|
||||||
.toSortedListBy(CloudServiceVO::getName)
|
.toSortedListBy(CloudServiceVO::getName)
|
||||||
.toImmutable();
|
.toImmutable();
|
||||||
|
|||||||
Reference in New Issue
Block a user