diff --git a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/RuntimeInfo.java b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/RuntimeInfo.java index 28e1c58..69cc495 100644 --- a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/RuntimeInfo.java +++ b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/RuntimeInfo.java @@ -1,5 +1,7 @@ package com.lanyuanxiaoyao.service.cli.core; +import java.util.Map; + /** * 运行配置 * @@ -10,7 +12,8 @@ public class RuntimeInfo { private String signature; private String user; private String jarPath; - private String jdkPath; + private String defaultJdk; + private Map jdkPath; private String logPath; private String confPath; private String dataPath; @@ -47,11 +50,19 @@ public class RuntimeInfo { this.jarPath = jarPath; } - public String getJdkPath() { + public String getDefaultJdk() { + return defaultJdk; + } + + public void setDefaultJdk(String defaultJdk) { + this.defaultJdk = defaultJdk; + } + + public Map getJdkPath() { return jdkPath; } - public void setJdkPath(String jdkPath) { + public void setJdkPath(Map jdkPath) { this.jdkPath = jdkPath; } @@ -146,22 +157,23 @@ public class RuntimeInfo { @Override public String toString() { return "RuntimeInfo{" + - "signature='" + signature + '\'' + - ", user='" + user + '\'' + - ", jarPath='" + jarPath + '\'' + - ", jdkPath='" + jdkPath + '\'' + - ", logPath='" + logPath + '\'' + - ", confPath='" + confPath + '\'' + - ", dataPath='" + dataPath + '\'' + - ", downloadUrl='" + downloadUrl + '\'' + - ", kerberosKeytabPath='" + kerberosKeytabPath + '\'' + - ", loki=" + loki + - ", zkUrl='" + zkUrl + '\'' + - ", connectorZkUrl='" + connectorZkUrl + '\'' + - ", hudi=" + hudi + - ", security=" + security + - ", yarn=" + yarn + - '}'; + "signature='" + signature + '\'' + + ", user='" + user + '\'' + + ", jarPath='" + jarPath + '\'' + + ", defaultJdk='" + defaultJdk + '\'' + + ", jdkPath=" + jdkPath + + ", logPath='" + logPath + '\'' + + ", confPath='" + confPath + '\'' + + ", dataPath='" + dataPath + '\'' + + ", downloadUrl='" + downloadUrl + '\'' + + ", kerberosKeytabPath='" + kerberosKeytabPath + '\'' + + ", loki=" + loki + + ", zkUrl='" + zkUrl + '\'' + + ", connectorZkUrl='" + connectorZkUrl + '\'' + + ", hudi=" + hudi + + ", security=" + security + + ", yarn=" + yarn + + '}'; } public static final class LokiInfo { diff --git a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java index 07a0442..4182b7f 100644 --- a/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java +++ b/service-cli/service-cli-core/src/main/java/com/lanyuanxiaoyao/service/cli/core/ServiceInfo.java @@ -17,6 +17,7 @@ public class ServiceInfo { private List groups = new ArrayList<>(); private Integer replicas = 0; private String sourceJar; + private String jdk; private List classpath = new ArrayList<>(); private Map environments = new HashMap<>(); private Map arguments = new HashMap<>(); @@ -61,6 +62,14 @@ public class ServiceInfo { this.sourceJar = sourceJar; } + public String getJdk() { + return jdk; + } + + public void setJdk(String jdk) { + this.jdk = jdk; + } + public List getClasspath() { return classpath; } @@ -88,14 +97,15 @@ public class ServiceInfo { @Override public String toString() { return "ServiceInfo{" + - "enabled=" + enabled + - ", order=" + order + - ", groups=" + groups + - ", replicas=" + replicas + - ", sourceJar='" + sourceJar + '\'' + - ", classpath=" + classpath + - ", environments=" + environments + - ", arguments=" + arguments + - '}'; + "enabled=" + enabled + + ", order=" + order + + ", groups=" + groups + + ", replicas=" + replicas + + ", sourceJar='" + sourceJar + '\'' + + ", jdk=" + jdk + + ", classpath=" + classpath + + ", environments=" + environments + + ", arguments=" + arguments + + '}'; } } diff --git a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java index fe7a637..e88caae 100644 --- a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java +++ b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/RunnerApplication.java @@ -138,7 +138,8 @@ public class RunnerApplication implements ApplicationRunner { Path planPath = Paths.get(root.toString(), "deploy.plan"); Map> deployPlans = new HashMap<>(); if (Files.exists(planPath) && !deployInformationProperties.getShuffler()) { - deployPlans = mapper.readValue(new String(Files.readAllBytes(planPath)), new TypeReference>>() {}); + deployPlans = mapper.readValue(new String(Files.readAllBytes(planPath)), new TypeReference>>() { + }); } for (ServiceInfoWrapper serviceInfo : serviceInfoList) { @@ -168,8 +169,8 @@ public class RunnerApplication implements ApplicationRunner { MapUtil.builder() .put("currentPath", absolutRootPath) .put("hosts", hostInfoList - .collect(HostInfoWrapper::getHostnameIp) - .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) + .collect(HostInfoWrapper::getHostnameIp) + .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) .put("selectedHosts", selectedHosts) .put("runtime", runtimeInfo) .put("info", serviceInfo) @@ -187,8 +188,8 @@ public class RunnerApplication implements ApplicationRunner { MapUtil.builder() .put("currentPath", absolutRootPath) .put("hosts", hostInfoList - .collect(HostInfoWrapper::getHostnameIp) - .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) + .collect(HostInfoWrapper::getHostnameIp) + .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) .put("runtime", runtimeInfo) .put("info", serviceInfo) .put("arguments", serviceInfo.getArguments()) @@ -199,13 +200,13 @@ public class RunnerApplication implements ApplicationRunner { StrUtil.format("stop-{}.sh", serviceInfo.getName()) ) ); - generateTemplate( + generateTemplate( "cloud/log.ftl", MapUtil.builder() .put("currentPath", absolutRootPath) .put("hosts", hostInfoList - .collect(HostInfoWrapper::getHostnameIp) - .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) + .collect(HostInfoWrapper::getHostnameIp) + .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) .put("selectedHosts", selectedHosts) .put("runtime", runtimeInfo) .put("info", serviceInfo) @@ -219,24 +220,15 @@ public class RunnerApplication implements ApplicationRunner { ); } - generateTemplate( - "cloud/stop-script.ftl", - MapUtil.builder() - .put("currentPath", absolutRootPath) - .put("runtime", runtimeInfo) - .build(), - Paths.get(root.toString(), "stop.sh") - ); - generateTemplate( "cloud/ssh-script.ftl", MapUtil.builder() - .put("currentPath", absolutRootPath) - .put("hosts", hostInfoList - .collect(HostInfoWrapper::getHostnameIp) - .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) - .put("runtime", runtimeInfo) - .build(), + .put("currentPath", absolutRootPath) + .put("hosts", hostInfoList + .collect(HostInfoWrapper::getHostnameIp) + .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) + .put("runtime", runtimeInfo) + .build(), Paths.get(root.toString(), "ssh.sh") ); @@ -338,14 +330,14 @@ public class RunnerApplication implements ApplicationRunner { Paths.get(root.toString(), "update.sh") ); - Template stopTemplate = engine.getTemplate("cloud/stop-script.ftl"); - String stopScript = stopTemplate.render(MapUtil.builder() - .put("currentPath", absolutRootPath) - .put("runtime", runtimeInfo) - .build()); - // 一个魔法操作 - stopScript = stopScript.replaceAll("application_name=\".*\"", "application_name=\"service-uploader.jar\""); - Files.write(Paths.get(root.toString(), "stop.sh"), stopScript.getBytes()); + generateTemplate( + "uploader/stop.ftl", + MapUtil.builder() + .put("currentPath", absolutRootPath) + .put("runtime", runtimeInfo) + .build(), + Paths.get(root.toString(), "stop.sh") + ); } private void generateUpdateJar(Path root) throws IOException { diff --git a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java index 4441690..8472782 100644 --- a/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java +++ b/service-cli/service-cli-runner/src/main/java/com/lanyuanxiaoyao/service/cli/runner/ServiceInfoWrapper.java @@ -49,6 +49,10 @@ public class ServiceInfoWrapper { return serviceInfo.getSourceJar(); } + public String getJdk() { + return serviceInfo.getJdk(); + } + public List getClasspath() { return serviceInfo.getClasspath(); } diff --git a/service-cli/service-cli-runner/src/main/resources/application-b12.yml b/service-cli/service-cli-runner/src/main/resources/application-b12.yml index 7d83983..1912c6e 100644 --- a/service-cli/service-cli-runner/src/main/resources/application-b12.yml +++ b/service-cli/service-cli-runner/src/main/resources/application-b12.yml @@ -7,7 +7,11 @@ deploy: # 应用jar包 jar-path: /data/datalake/jars # 主机jdk根目录 - jdk-path: /opt/jdk8u252-b09 + default-jdk: jdk8_arm + jdk-path: + "jdk8": /opt/jdk1.8.0_162 + "jdk8_arm": /opt/jdk8u252-b09 + "jdk17": /opt/jdk-17.0.15 # 应用日志 log-path: /data/datalake/logs # 应用配置 diff --git a/service-cli/service-cli-runner/src/main/resources/application.yml b/service-cli/service-cli-runner/src/main/resources/application.yml index 1514f1f..2dd825a 100644 --- a/service-cli/service-cli-runner/src/main/resources/application.yml +++ b/service-cli/service-cli-runner/src/main/resources/application.yml @@ -38,8 +38,6 @@ deploy: "[connector.hadoop.kerberos-keytab-path]": ${deploy.runtime.kerberos-keytab-path} "[connector.hudi.app-hdfs-path]": ${deploy.runtime.hudi.app-hdfs-path} "[connector.hudi.app-test-hdfs-path]": ${deploy.runtime.hudi.app-test-hdfs-path} - "[connector.hudi.victoria-push-url]": ${deploy.runtime.hudi.victoria-push-url} - "[connector.hudi.loki-push-url]": ${deploy.runtime.hudi.loki-push-url} arguments: "[spring.application.name]": service-launcher-b1 "[connector.cluster.cluster]": b1 @@ -59,8 +57,6 @@ deploy: "[connector.hadoop.kerberos-keytab-path]": ${deploy.runtime.kerberos-keytab-path} "[connector.hudi.app-hdfs-path]": ${deploy.runtime.hudi.app-hdfs-path} "[connector.hudi.app-test-hdfs-path]": ${deploy.runtime.hudi.app-test-hdfs-path} - "[connector.hudi.victoria-push-url]": ${deploy.runtime.hudi.victoria-push-url} - "[connector.hudi.loki-push-url]": ${deploy.runtime.hudi.loki-push-url} arguments: "[spring.application.name]": service-launcher-a4 "[connector.cluster.cluster]": a4 @@ -80,8 +76,6 @@ deploy: "[connector.hadoop.kerberos-keytab-path]": ${deploy.runtime.kerberos-keytab-path} "[connector.hudi.app-hdfs-path]": ${deploy.runtime.hudi.app-hdfs-path} "[connector.hudi.app-test-hdfs-path]": ${deploy.runtime.hudi.app-test-hdfs-path} - "[connector.hudi.victoria-push-url]": ${deploy.runtime.hudi.victoria-push-url} - "[connector.hudi.loki-push-url]": ${deploy.runtime.hudi.loki-push-url} arguments: "[spring.application.name]": service-launcher-b12 "[connector.cluster.cluster]": b12 @@ -147,7 +141,6 @@ deploy: "[connector.hadoop.kerberos-principal]": ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM "[connector.hadoop.kerberos-keytab-path]": ${deploy.runtime.kerberos-keytab-path} arguments: - "[executor.loki-push-url]": ${deploy.runtime.loki.hudi-push-url} "[executor.task-jar-path]": ${deploy.runtime.executor.task-jar-path} "[executor.task-result-path]": ${deploy.runtime.executor.task-result-path} service-web: @@ -168,3 +161,10 @@ deploy: - "service" source-jar: service-monitor-1.0.0-SNAPSHOT.jar replicas: 1 + service-ai-chat: + order: 6 + groups: + - "ai" + source-jar: service-ai-chat-1.0.0-SNAPSHOT.jar + jdk: "jdk17" + replicas: 1 diff --git a/service-cli/service-cli-runner/src/main/resources/template/check/check.ftl b/service-cli/service-cli-runner/src/main/resources/template/check/check.ftl index c36e935..43c9540 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/check/check.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/check/check.ftl @@ -1,4 +1,4 @@ #!/bin/bash mkdir -p ${runtime.jarPath} curl ${runtime.downloadUrl}/service-check-1.0.0-SNAPSHOT.jar -o ${runtime.jarPath}/service-check.jar -${runtime.jdkPath}/bin/java -jar ${runtime.jarPath}/service-check.jar +${runtime.jdkPath['jdk8']}/bin/java -jar ${runtime.jarPath}/service-check.jar diff --git a/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy.ftl b/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy.ftl index 66a679b..a67dee7 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy.ftl @@ -13,7 +13,7 @@ hostname_full=`ssh $host 'hostname -f'` <#-- 获取当前时间 --> start_time=`date +%Y%m%d%H%M%S` ssh $host "mkdir -p ${runtime.jarPath};curl ${runtime.downloadUrl}/${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}/bin/java <#list environments?keys as key>-D${key}=${environments[key]?string} -jar ${runtime.jarPath}/${info.name}.jar <#noparse>--deploy.datetime=${datetime} --deploy.ip=${host} --deploy.hostname=${hostname} --deploy.hostname-full=${hostname_full} --deploy.start-time=${start_time} --hudi-service.signature=${runtime.signature} --logging.parent=${runtime.logPath} --loki.url=${runtime.loki.servicePushUrl} --spring.cloud.zookeeper.connect-string=${runtime.zkUrl} --spring.security.meta.authority='${runtime.security.authority}' --spring.security.meta.username='${runtime.security.username}' --spring.security.meta.darkcode='${runtime.security.darkcode}' --yarn-cluster.sync-clusters=${runtime.yarn.syncClusters} --yarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} <#list arguments?keys as key>--${key}='${arguments[key]?string}' > /dev/null 2>&1 &" +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[info.jdk!(runtime.defaultJdk)]}/bin/java <#list environments?keys as key>-D${key}=${environments[key]?string} -jar ${runtime.jarPath}/${info.name}.jar <#noparse>--deploy.datetime=${datetime} --deploy.ip=${host} --deploy.hostname=${hostname} --deploy.hostname-full=${hostname_full} --deploy.start-time=${start_time} --hudi-service.signature=${runtime.signature} --logging.parent=${runtime.logPath} --spring.cloud.zookeeper.connect-string=${runtime.zkUrl} --spring.security.meta.authority='${runtime.security.authority}' --spring.security.meta.username='${runtime.security.username}' --spring.security.meta.darkcode='${runtime.security.darkcode}' --yarn-cluster.sync-clusters=${runtime.yarn.syncClusters} --yarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} <#list arguments?keys as key>--${key}='${arguments[key]?string}' > /dev/null 2>&1 &" echo '' diff --git a/service-cli/service-cli-runner/src/main/resources/template/cloud/stop.ftl b/service-cli/service-cli-runner/src/main/resources/template/cloud/stop.ftl index 56362fb..610f745 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/cloud/stop.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/cloud/stop.ftl @@ -1,7 +1,46 @@ #!/bin/bash <#list hosts as host> -host=${host.ip} echo "${info.name} ${host.ip} ${host.hostname} $datetime" -ssh $host 'bash -s' < ${currentPath}/stop.sh ${runtime.jarPath}/${info.name}.jar +ssh ${host.ip} bash -s <<'EOF' +original_command="$0" +application_name="${runtime.jarPath}/${info.name}.jar" + +function get_pid() { + ID=$(ps ef | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{ print $2 }') + if [[ -z "$ID" ]]; then + ID=$(ps aux | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{print $2}') + if [[ -z "$ID" ]]; then + ID=$(${runtime.jdkPath[info.jdk!(runtime.defaultJdk)]}/bin/jps -lmvV | grep "$application_name" | awk '{print $1}') + fi + fi + echo $ID +} + +pid=$(get_pid) + +if [[ -z "$pid" ]]; then + echo "Application is already stopped." + exit 0 +fi + +echo "Stopping $pid..." +kill $pid + +LOOPS=0 +while (true); do + cpid=$(get_pid) + if [[ -z "$cpid" ]]; then + echo "Oook! cost:$LOOPS" + break + fi + LOOPS=$(($LOOPS+1)) + if [[ $(($LOOPS%15)) -eq 0 ]]; then + echo "Wait timeout, try to force kill $pid..." + kill -9 $pid + fi + sleep 1s +done +EOF + diff --git a/service-cli/service-cli-runner/src/main/resources/template/command-pro/cli.ftl b/service-cli/service-cli-runner/src/main/resources/template/command-pro/cli.ftl index 88febf2..12880f8 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/command-pro/cli.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/command-pro/cli.ftl @@ -1,4 +1,4 @@ #!/bin/bash mkdir -p ${runtime.jarPath} export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P\"Dp^A47>WSn:Wn].gs/+\"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.' -${runtime.jdkPath}/bin/java <#noparse>-Ddeploy.datetime=$(date +%Y%m%d%H%M%S) -Ddeploy.hostname=$(hostname) -Ddeploy.hostname-full=$(hostname -f) -Ddeploy.start-time=$(date +%Y%m%d%H%M%S) -Dlogging.parent=${runtime.logPath} -Dloki.url=${runtime.loki.servicePushUrl} -Dspring.cloud.zookeeper.connect-string=${runtime.zkUrl} -Dyarn-cluster.sync-clusters=${runtime.yarn.syncClusters} -Dyarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} -jar ${runtime.jarPath}/service-command-pro.jar<#if directly> $@ +${runtime.jdkPath['jdk8']}/bin/java <#noparse>-Ddeploy.datetime=$(date +%Y%m%d%H%M%S) -Ddeploy.hostname=$(hostname) -Ddeploy.hostname-full=$(hostname -f) -Ddeploy.start-time=$(date +%Y%m%d%H%M%S) -Dlogging.parent=${runtime.logPath} -Dloki.url=${runtime.loki.servicePushUrl} -Dspring.cloud.zookeeper.connect-string=${runtime.zkUrl} -Dyarn-cluster.sync-clusters=${runtime.yarn.syncClusters} -Dyarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} -jar ${runtime.jarPath}/service-command-pro.jar<#if directly> $@ diff --git a/service-cli/service-cli-runner/src/main/resources/template/command/cli.ftl b/service-cli/service-cli-runner/src/main/resources/template/command/cli.ftl index c64576e..cf2d661 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/command/cli.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/command/cli.ftl @@ -1,4 +1,4 @@ #!/bin/bash mkdir -p ${runtime.jarPath} export JASYPT_ENCRYPTOR_PASSWORD='r#(R,P\"Dp^A47>WSn:Wn].gs/+\"v:q_Q*An~zF*g-@j@jtSTv5H/,S-3:R?r9R}.' -${runtime.jdkPath}/bin/java <#noparse>-Ddeploy.datetime=$(date +%Y%m%d%H%M%S) -Ddeploy.hostname=$(hostname) -Ddeploy.hostname-full=$(hostname -f) -Ddeploy.start-time=$(date +%Y%m%d%H%M%S) -Dlogging.parent=${runtime.logPath} -Dloki.url=${runtime.loki.servicePushUrl} -Dspring.cloud.zookeeper.connect-string=${runtime.zkUrl} -Dyarn-cluster.sync-clusters=${runtime.yarn.syncClusters} -Dyarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} -jar ${runtime.jarPath}/service-command.jar<#if directly> $@ +${runtime.jdkPath['jdk8']}/bin/java <#noparse>-Ddeploy.datetime=$(date +%Y%m%d%H%M%S) -Ddeploy.hostname=$(hostname) -Ddeploy.hostname-full=$(hostname -f) -Ddeploy.start-time=$(date +%Y%m%d%H%M%S) -Dlogging.parent=${runtime.logPath} -Dloki.url=${runtime.loki.servicePushUrl} -Dspring.cloud.zookeeper.connect-string=${runtime.zkUrl} -Dyarn-cluster.sync-clusters=${runtime.yarn.syncClusters} -Dyarn-cluster.compaction-clusters=${runtime.yarn.compactionClusters} -jar ${runtime.jarPath}/service-command.jar<#if directly> $@ diff --git a/service-cli/service-cli-runner/src/main/resources/template/uploader/start.ftl b/service-cli/service-cli-runner/src/main/resources/template/uploader/start.ftl index 149f98f..c1a3b2b 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/uploader/start.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/uploader/start.ftl @@ -1,4 +1,4 @@ #!/bin/bash mkdir -p ${runtime.jarPath} 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}/bin/java -jar ${runtime.jarPath}/service-uploader.jar <#noparse>--deploy.datetime=$(date +%Y%m%d%H%M%S) --deploy.hostname=$(hostname) --deploy.hostname-full=$(hostname -f) --deploy.start-time=$(date +%Y%m%d%H%M%S) --logging.parent=${runtime.logPath} --loki.url=${runtime.loki.servicePushUrl} --spring.cloud.zookeeper.connect-string=${runtime.zkUrl} --uploader.backend=local --uploader.tmp-dir=${runtime.dataPath}/uploader --spring.security.meta.authority='${runtime.security.authority}' --spring.security.meta.username='${runtime.security.username}' --spring.security.meta.darkcode='${runtime.security.darkcode}' > /dev/null 2>&1 & +nohup ${runtime.jdkPath['jdk8']}/bin/java -jar ${runtime.jarPath}/service-uploader.jar <#noparse>--deploy.datetime=$(date +%Y%m%d%H%M%S) --deploy.hostname=$(hostname) --deploy.hostname-full=$(hostname -f) --deploy.start-time=$(date +%Y%m%d%H%M%S) --logging.parent=${runtime.logPath} --loki.url=${runtime.loki.servicePushUrl} --spring.cloud.zookeeper.connect-string=${runtime.zkUrl} --uploader.backend=local --uploader.tmp-dir=${runtime.dataPath}/uploader --spring.security.meta.authority='${runtime.security.authority}' --spring.security.meta.username='${runtime.security.username}' --spring.security.meta.darkcode='${runtime.security.darkcode}' > /dev/null 2>&1 & diff --git a/service-cli/service-cli-runner/src/main/resources/template/cloud/stop-script.ftl b/service-cli/service-cli-runner/src/main/resources/template/uploader/stop.ftl similarity index 84% rename from service-cli/service-cli-runner/src/main/resources/template/cloud/stop-script.ftl rename to service-cli/service-cli-runner/src/main/resources/template/uploader/stop.ftl index 8381b03..dc80317 100644 --- a/service-cli/service-cli-runner/src/main/resources/template/cloud/stop-script.ftl +++ b/service-cli/service-cli-runner/src/main/resources/template/uploader/stop.ftl @@ -1,14 +1,14 @@ #!/bin/bash original_command="$0" -application_name="$1" +application_name="service-uploader.jar" function get_pid() { ID=$(ps ef | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{ print $2 }') if [[ -z "$ID" ]]; then ID=$(ps aux | grep "$application_name" | grep -v grep | grep -v $original_command | awk '{print $2}') if [[ -z "$ID" ]]; then - ID=$(${runtime.jdkPath}/bin/jps -lmvV | grep "$application_name" | awk '{print $1}') + ID=$(${runtime.jdkPath['jdk8']}/bin/jps -lmvV | grep "$application_name" | awk '{print $1}') fi fi echo $ID