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 d43260a..4250fc0 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 @@ -108,6 +108,12 @@ public class RunnerApplication implements ApplicationRunner { deployPlans = mapper.readValue(new String(Files.readAllBytes(planPath)), new TypeReference>>() {}); } + ImmutableList clusters = Lists.mutable.of(runtimeInfo.getYarn().getSyncClusters().split(",")) + .withAll(Lists.mutable.of(runtimeInfo.getYarn().getCompactionClusters().split(","))) + .collect(n -> runtimeInfo.getYarn().getStoreCluster() + n) + .distinct() + .toImmutable(); + TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH)); Template deployTemplate = engine.getTemplate("cloud/deploy.ftl"); for (ServiceInfoWrapper serviceInfo : serviceInfoList) { @@ -180,33 +186,6 @@ public class RunnerApplication implements ApplicationRunner { Files.write(logScriptFile, logScript.getBytes()); } - ImmutableList clusters = Lists.mutable.of(runtimeInfo.getYarn().getSyncClusters().split(",")) - .withAll(Lists.mutable.of(runtimeInfo.getYarn().getCompactionClusters().split(","))) - .collect(n -> runtimeInfo.getYarn().getStoreCluster() + n) - .distinct() - .toImmutable(); - Template downloadConfigTemplate = engine.getTemplate("cloud/download-config.ftl"); - String downloadConfigScript = downloadConfigTemplate.render(MapUtil.builder() - .put("currentPath", absolutRootPath) - .put("runtime", runtimeInfo) - .put("classpath", clusters) - .build()); - Path downloadConfigScriptFile = Paths.get(root.toString(), "download-config.sh"); - Files.deleteIfExists(downloadConfigScriptFile); - Files.write(downloadConfigScriptFile, downloadConfigScript.getBytes()); - - Template deployConfigTemplate = engine.getTemplate("cloud/deploy-config.ftl"); - String deployConfigScript = deployConfigTemplate.render(MapUtil.builder() - .put("currentPath", absolutRootPath) - .put("runtime", runtimeInfo) - .put("hosts", hostInfoList - .collect(HostInfoWrapper::getHostnameIp) - .toSortedList((o1, o2) -> Comparator.naturalOrder().compare(o1.getIp(), o2.getIp()))) - .build()); - Path deployConfigScriptFile = Paths.get(root.toString(), "deploy-config.sh"); - Files.deleteIfExists(deployConfigScriptFile); - Files.write(deployConfigScriptFile, deployConfigScript.getBytes()); - ClassPathResource stopFile = new ClassPathResource("script/stop.sh"); String stopScript = new String(IoUtil.readBytes(stopFile.getInputStream())); Files.write(Paths.get(root.toString(), "stop.sh"), stopScript.getBytes()); 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 ad12d2e..e2b9fdc 100644 --- a/service-cli/service-cli-runner/src/main/resources/application.yml +++ b/service-cli/service-cli-runner/src/main/resources/application.yml @@ -28,8 +28,6 @@ deploy: - "service-hudi-launcher" source-jar: service-launcher-runner-b2b1-1.0.0-SNAPSHOT.jar replicas: 6 - classpath: - - ${deploy.runtime.conf-path}/b2b1 environments: connector_hadoop_kerberos-principal: ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM connector_hadoop_kerberos-keytab-path: ${deploy.runtime.kerberos-keytab-path} @@ -51,8 +49,6 @@ deploy: - "service-hudi-launcher" source-jar: service-launcher-runner-b2b5-1.0.0-SNAPSHOT.jar replicas: 6 - classpath: - - ${deploy.runtime.conf-path}/b2b5 environments: connector_hadoop_kerberos-principal: ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM connector_hadoop_kerberos-keytab-path: ${deploy.runtime.kerberos-keytab-path} @@ -74,8 +70,6 @@ deploy: - "service-hudi-launcher" source-jar: service-launcher-runner-b2a4-1.0.0-SNAPSHOT.jar replicas: 6 - classpath: - - ${deploy.runtime.conf-path}/b2a4 environments: connector_hadoop_kerberos-principal: ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM connector_hadoop_kerberos-keytab-path: ${deploy.runtime.kerberos-keytab-path} @@ -97,8 +91,6 @@ deploy: - "service-hudi-launcher" source-jar: service-launcher-runner-b2b12-1.0.0-SNAPSHOT.jar replicas: 6 - classpath: - - ${deploy.runtime.conf-path}/b2b12 environments: connector_hadoop_kerberos-principal: ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM connector_hadoop_kerberos-keytab-path: ${deploy.runtime.kerberos-keytab-path} @@ -162,8 +154,6 @@ deploy: - "service" source-jar: service-executor-manager-1.0.0-SNAPSHOT.jar replicas: 5 - classpath: - - ${deploy.runtime.conf-path}/b2b12 environments: connector_hadoop_kerberos-principal: ${deploy.runtime.user}/$\{hostname}.hdp.dc@ECLD.COM connector_hadoop_kerberos-keytab-path: ${deploy.runtime.kerberos-keytab-path} diff --git a/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy-config.ftl b/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy-config.ftl deleted file mode 100644 index 7af9fe0..0000000 --- a/service-cli/service-cli-runner/src/main/resources/template/cloud/deploy-config.ftl +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -<#list hosts as host> -echo ${host.ip} ${host.hostname} -ssh ${host.ip} 'bash -s' < ${currentPath}/download-config.sh - 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 c0ae93c..eff7841 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 @@ -24,7 +24,7 @@ hostname=`ssh $host 'hostname'` hostname_full=`ssh $host 'hostname -f'` 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" 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}=${environments[key]?string} -Xbootclasspath/a:${classpath} -jar ${runtime.jarPath}/${info.name}.jar<#noparse> --datetime=${datetime} --hostname=${hostname} --deploy.datetime=${datetime} --deploy.ip=${host} --deploy.hostname=${hostname} --deploy.hostname-full=${hostname_full} --deploy.start-time=${start_time} --logging.parent=${log_path} --loki.url=${loki_url} --spring.cloud.zookeeper.connect-string=${zk_url} --spring.security.meta.authority='${security_authority}' --spring.security.meta.username='${security_username}' --spring.security.meta.darkcode='${security_darkcode}' --yarn-cluster.sync-clusters=${sync_clusters} --yarn-cluster.compaction-clusters=${compaction_clusters} <#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} <#list environments?keys as key>-D${key}=${environments[key]?string} -jar ${runtime.jarPath}/${info.name}.jar<#noparse> --datetime=${datetime} --hostname=${hostname} --deploy.datetime=${datetime} --deploy.ip=${host} --deploy.hostname=${hostname} --deploy.hostname-full=${hostname_full} --deploy.start-time=${start_time} --logging.parent=${log_path} --loki.url=${loki_url} --spring.cloud.zookeeper.connect-string=${zk_url} --spring.security.meta.authority='${security_authority}' --spring.security.meta.username='${security_username}' --spring.security.meta.darkcode='${security_darkcode}' --yarn-cluster.sync-clusters=${sync_clusters} --yarn-cluster.compaction-clusters=${compaction_clusters} <#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/download-config.ftl b/service-cli/service-cli-runner/src/main/resources/template/cloud/download-config.ftl deleted file mode 100644 index cb34b95..0000000 --- a/service-cli/service-cli-runner/src/main/resources/template/cloud/download-config.ftl +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -config_names=( -<#list classpath as cp> - ${cp} - -) - -for config_name in <#noparse>${config_names[@]} -do - conf_path=${runtime.confPath}/<#noparse>${config_name} - tar_path=<#noparse>${conf_path}.tar.gz - rm -rf <#noparse>${conf_path} - mkdir -p <#noparse>${conf_path} - curl -s ftp://yyy:QeY\!68\)4nH1@132.121.122.15:2222/<#noparse>${config_name}.tar.gz -o <#noparse>${tar_path} - tar -zxf <#noparse>${tar_path} -C <#noparse>${conf_path} - rm -rf <#noparse>${tar_path} -done