mirror of
https://github.com/hpd840321/starRiverProperty.git
synced 2026-06-09 08:20:31 +08:00
feat: add service config templates and extraction script
Former-commit-id: 1de24b7eb79676d1aba9d799a58c5a753290cf52
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
| 目录 | JAR | 端口(见配置首行) |
|
||||
|------|-----|-------------------|
|
||||
| `v1-legacy/` | `cw-elevator-application-V1.0.0.20211103.jar` | **18080** |
|
||||
| `v2-maven/` | `cw-elevator-application-2.0.0.jar` | **18081** |
|
||||
| `v2-maven/` | `cw-elevator-application-2.0.7.jar` | **18081** |
|
||||
|
||||
**`application.properties`**:在验证环境常用的 JDBC / Redis / Ribbon / Kafka / 端口等覆盖(数据库为生产还原时,请把 **jdbc-url、账号** 指到承载还原库的实例)。
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
## 一次性同步 JAR
|
||||
|
||||
在 **`deploy/`** 下执行(需已存在 V1 原始 JAR;V2 优先用 `releases/v2.0.0/`,否则用 `cw-elevator-application-starter/target/`):
|
||||
在 **`deploy/`** 下执行(需已存在 V1 原始 JAR;V2 优先用 **`releases/cw-elevator-application-V<版本>.<日期>/`** 中最新的同名 JAR,其次兼容旧路径 `releases/v<版本>/`,否则用 `cw-elevator-application-starter/target/`):
|
||||
|
||||
```bash
|
||||
./sync-jars.sh
|
||||
@@ -60,7 +60,7 @@ cd v2-maven && ./run.sh
|
||||
|
||||
### Feign `ninca-crk-std`(Ribbon)
|
||||
|
||||
在 **`spring.cloud.consul.discovery.enabled=false`**(与 V1 对齐)时,不从 Consul 拉 **`ninca-crk-std`** 实例,需在 **`application.properties`** 中配置 **Ribbon 静态列表**(`ninca-crk-std.ribbon.*` 与 `ninca-crk-std.ip`),按环境改成可访问的 **`主机:端口`**。Maven 构建的 `cw-elevator-application-2.0.0.jar` 另含 `NincaCrkStdRibbonConfiguration`,避免 Edgware 下静态列表被忽略。
|
||||
在 **`spring.cloud.consul.discovery.enabled=false`**(与 V1 对齐)时,不从 Consul 拉 **`ninca-crk-std`** 实例,需在 **`application.properties`** 中配置 **Ribbon 静态列表**(`ninca-crk-std.ribbon.*` 与 `ninca-crk-std.ip`),按环境改成可访问的 **`主机:端口`**。Maven 构建的 `cw-elevator-application-2.0.7.jar` 另含 `NincaCrkStdRibbonConfiguration`,避免 Edgware 下静态列表被忽略。
|
||||
|
||||
## Redis 与 `SPRING_APPLICATION_JSON`
|
||||
|
||||
@@ -100,6 +100,17 @@ fat JAR 的 `classpath:/application.properties` 会带内网旧 **host** 与 **p
|
||||
- 额外 JVM:
|
||||
`ELEVATOR_JAVA_OPTS="-Xmx512m" ./run.sh`
|
||||
|
||||
## 发布包与「星中心」扁平目录对齐
|
||||
|
||||
执行 `./scripts/release-cw-elevator-application.sh <版本>` 生成的 **`releases/cw-elevator-application-V<版本>.<日期>/`**(日期默认当天 `YYYYMMDD`,可用 **`RELEASE_DATE_LABEL`** 覆盖)除 **`ddl/`** 外,**发布根目录**(与历史运行包 **`cw-elevator-application-V1.0.0.20211103`** 同层习惯)包含:
|
||||
|
||||
- **`bootstrap.properties`、`application.properties`、`application-access-control.properties`**(与 `deploy/v2-maven/` 同源;与 JAR、`start.sh` 同目录,**不再单独建 `config/`**)。
|
||||
- **`start.sh` / `stop.sh`**(对齐现场启停脚本)、**`cw-elevator-application.service`**(`WorkingDirectory`/`ExecStart` 中占位路径默认为 `/path/to/cw-elevator-application`,部署前请替换为实际目录)。
|
||||
- **`run.sh`**、**`common-java.sh`**(供 `run.sh` source)。
|
||||
- **`collect_elevator_runtime_evidence.sh`**:与仓库根 `scripts/` 同源,置于发布包根目录;现场只读采集进程参数、配置快照、日志关键行、Consul 健康与 KV,输出 `tar.gz`(用法见脚本头注释)。
|
||||
|
||||
默认还会生成同名 **`releases/cw-elevator-application-V<版本>.<日期>.zip**`;不需要 zip 时:`RELEASE_MAKE_ZIP=0 ./scripts/release-cw-elevator-application.sh <版本>`。
|
||||
|
||||
## Shell 脚本换行(若出现 `bash\r`)
|
||||
|
||||
在 Windows 或某些编辑器下保存成 **CRLF** 会导致 `#!/usr/bin/env bash\r`。仓库根已有 **`.editorconfig`** 约束 `*.sh` 使用 **LF**;若再出现可执行:
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=cw-elevator-application __REL_VER__ (Maven V2 fat jar)
|
||||
After=network.target remote-fs.target nss-lookup.target
|
||||
|
||||
[Service]
|
||||
# 将 WorkingDirectory、ExecStart、ExecStop 中的路径占位改为实际部署绝对路径(与 JAR、start.sh、properties 同目录)。
|
||||
PIDFile=/run/cw-elevator-application-__REL_VER__.pid
|
||||
ExecStartPre=/bin/rm -f /run/cw-elevator-application-__REL_VER__.pid
|
||||
ExecStart=/bin/bash __DEPLOY_DIR__/start.sh
|
||||
ExecStop=/bin/bash __DEPLOY_DIR__/stop.sh
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
KillSignal=SIGQUIT
|
||||
TimeoutStopSec=5
|
||||
KillMode=process
|
||||
PrivateTmp=true
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
WorkingDirectory=__DEPLOY_DIR__
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
# 与「星中心」V1 部署习惯对齐:本脚本与 __JAR_NAME__、bootstrap/application*.properties 位于同一目录。
|
||||
# 覆盖 JVM:设置环境变量 ELEVATOR_JAVA_OPTS(可选);指定 Java:JAVA_HOME 或 JAVA_CMD。
|
||||
set -euo pipefail
|
||||
dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
cd "$dir"
|
||||
JAR="__JAR_NAME__"
|
||||
if [[ ! -f "$JAR" ]]; then
|
||||
echo "ERROR: 未找到 ${JAR}(当前目录 $(pwd))" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -n "${JAVA_CMD:-}" ]]; then
|
||||
JAVA_EXEC="$JAVA_CMD"
|
||||
elif [[ -n "${JAVA_HOME:-}" && -x "${JAVA_HOME}/bin/java" ]]; then
|
||||
JAVA_EXEC="${JAVA_HOME}/bin/java"
|
||||
else
|
||||
JAVA_EXEC="/usr/lib/jvm/java-8-openjdk-amd64/bin/java"
|
||||
fi
|
||||
if [[ -z "${ELEVATOR_JAVA_OPTS:-}" ]]; then
|
||||
ELEVATOR_JAVA_OPTS="-Xmx3072m -Xms3072m -Xmn1024m"
|
||||
fi
|
||||
# shellcheck disable=SC2086
|
||||
exec "$JAVA_EXEC" $ELEVATOR_JAVA_OPTS -jar "$JAR"
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# 停止与本目录 __JAR_NAME__ 对应的 Java 进程(仅匹配命令行中含该 JAR 名的进程)。
|
||||
set -euo pipefail
|
||||
JAR="__JAR_NAME__"
|
||||
# shellcheck disable=SC2009
|
||||
pid=$(ps -ef | grep '[j]ava' | grep "$JAR" | awk '{print $2}' || true)
|
||||
if [[ -n "${pid}" ]]; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
@@ -12,8 +12,21 @@ MAVEN="$(cd "$DEPLOY/.." && pwd)"
|
||||
REPO="$(cd "$MAVEN/.." && pwd)"
|
||||
|
||||
V1_SRC="${REPO}/cw-elevator-application-V1.0.0.20211103/cw-elevator-application-V1.0.0.20211103.jar"
|
||||
V2_REL="${MAVEN}/releases/v2.0.0/cw-elevator-application-2.0.0.jar"
|
||||
V2_TGT="${MAVEN}/cw-elevator-application-starter/target/cw-elevator-application-2.0.0.jar"
|
||||
V2_VER="${V2_VER:-2.0.7}"
|
||||
V2_JAR_NAME="cw-elevator-application-${V2_VER}.jar"
|
||||
V2_TGT="${MAVEN}/cw-elevator-application-starter/target/${V2_JAR_NAME}"
|
||||
# 发布目录命名:cw-elevator-application-V<版本>.<YYYYMMDD>/(与 V1 运行包风格一致)
|
||||
V2_BUNDLE="$(ls -1dt "${MAVEN}/releases"/cw-elevator-application-V"${V2_VER}".* 2>/dev/null | head -1 || true)"
|
||||
V2_REL=""
|
||||
if [[ -n "${V2_BUNDLE}" ]]; then
|
||||
V2_REL="${V2_BUNDLE}/${V2_JAR_NAME}"
|
||||
fi
|
||||
if [[ -z "${V2_REL}" || ! -f "${V2_REL}" ]]; then
|
||||
V2_LEGACY="${MAVEN}/releases/v${V2_VER}/${V2_JAR_NAME}"
|
||||
if [[ -f "${V2_LEGACY}" ]]; then
|
||||
V2_REL="${V2_LEGACY}"
|
||||
fi
|
||||
fi
|
||||
PATCH_V1_DATA="${PARITY_PATCH_V1_DATA:-0}"
|
||||
DATA_NEW="${MAVEN}/cw-elevator-application-data/target/cw-elevator-application-data-2.0-SNAPSHOT.jar"
|
||||
|
||||
@@ -29,13 +42,14 @@ if [[ -f "$V2_TGT" ]]; then
|
||||
elif [[ -f "$V2_REL" ]]; then
|
||||
V2_SRC="$V2_REL"
|
||||
else
|
||||
echo "ERROR: 未找到 V2 JAR(请先 mvn package 或放入 releases):" >&2
|
||||
echo " $V2_TGT 或 $V2_REL" >&2
|
||||
echo "ERROR: 未找到 V2 JAR(请先 mvn package,或运行 scripts/release-cw-elevator-application.sh ${V2_VER}):" >&2
|
||||
echo " ${V2_TGT}" >&2
|
||||
echo " 或 releases/cw-elevator-application-V${V2_VER}.<日期>/${V2_JAR_NAME}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install -m0644 "$V1_SRC" "${DEPLOY}/v1-legacy/cw-elevator-application-V1.0.0.20211103.jar"
|
||||
install -m0644 "$V2_SRC" "${DEPLOY}/v2-maven/cw-elevator-application-2.0.0.jar"
|
||||
install -m0644 "$V2_SRC" "${DEPLOY}/v2-maven/${V2_JAR_NAME}"
|
||||
|
||||
V1_OUT="${DEPLOY}/v1-legacy/cw-elevator-application-V1.0.0.20211103.jar"
|
||||
if [[ "$PATCH_V1_DATA" == "1" ]]; then
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# 来源:星河湾星中星/星中心/cw-elevator-application-V1.0.0.20211103/application-access-control.properties(生产门禁 access-control 参数)
|
||||
# profile=access-control 时与本目录 application.properties 合并加载;勿随意删减与分表相关项。
|
||||
# \u56FE\u7247\u524D\u7F00
|
||||
cloudwalk.elevator.common.relativePrefix=/cwos-portal/portal/fileManager/imgByPath?path=
|
||||
# \u6570\u636E\u5E93sharding\u914D\u7F6E
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# 与 V1 运行包 cw-elevator-application-V1.0.0.20211103/bootstrap.properties 中 Consul 段对齐。
|
||||
# Dubbo/ZooKeeper:V1 fat-jar 内含 dubbo 注册地址,本 Maven V2 工程未使用 Dubbo,故不写 zookeeper 段。
|
||||
# Consul 宿主机按本环境(局域网 Docker)覆盖。
|
||||
spring.cloud.consul.host=192.168.3.12
|
||||
server.port=16112
|
||||
server.tomcat.uri-encoding=UTF-8
|
||||
spring.application.name=elevator-app
|
||||
spring.profiles.active=access-control
|
||||
# consul\u914D\u7F6E
|
||||
spring.cloud.consul.host=371bfca4972c43d2aefcf302d0a4a277
|
||||
spring.cloud.consul.port=8500
|
||||
spring.cloud.consul.enabled=true
|
||||
spring.cloud.consul.discovery.register=true
|
||||
@@ -10,5 +12,7 @@ spring.cloud.consul.discovery.prefer-ip-address=true
|
||||
spring.cloud.consul.discovery.instance-id=${spring.application.name}-${spring.cloud.client.ipAddress}:${server.port}
|
||||
spring.cloud.consul.discovery.ip-address=${spring.cloud.client.ipAddress}
|
||||
spring.cloud.consul.discovery.deregister=false
|
||||
|
||||
spring.profiles.active=access-control
|
||||
# zookeeper\u914D\u7F6E
|
||||
dubbo.registry.address=zookeeper://10.0.22.207:2181
|
||||
dubbo.protocol.port=16107
|
||||
dubbo.provider.version=1.0
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+56
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="true">
|
||||
<property name="CONTEXT_NAME" value="api.1.0.0"/>
|
||||
<contextName>${CONTEXT_NAME}</contextName>
|
||||
|
||||
<springProperty scope="context" name="fileName" source="logging.file" defaultValue="default"/>
|
||||
|
||||
<!--myibatis log configure-->
|
||||
<logger name="com.apache.ibatis" level="DEBUG"/>
|
||||
<logger name="java.sql.Connection" level="DEBUG"/>
|
||||
<logger name="java.sql.Statement" level="DEBUG"/>
|
||||
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="S" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %-5level %logger{50}:%line - %msg%n</pattern>
|
||||
<!-- 设置字符集 -->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="R" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${LOG_PATH}/${fileName}.log</File>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名-->
|
||||
<FileNamePattern>${LOG_PATH}/${fileName}.%d{yyyy-MM-dd}.%i.log</FileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>7</MaxHistory>
|
||||
<!--日志文件大小 -->
|
||||
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%thread] %-5level %logger{50}:%line - %msg%n</pattern>
|
||||
<!-- 设置字符集 -->
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
|
||||
<!--日志文件最大的大小-->
|
||||
<!-- <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> -->
|
||||
<!-- <MaxFileSize>10MB</MaxFileSize> -->
|
||||
<!-- </triggeringPolicy> -->
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="S"/>
|
||||
<appender-ref ref="R"/>
|
||||
</root>
|
||||
</configuration>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
Manifest-Version: 1.0
|
||||
Implementation-Title: cw-elevator-application-starter
|
||||
Implementation-Version: 2.0-SNAPSHOT
|
||||
Archiver-Version: Plexus Archiver
|
||||
Built-By: zebra
|
||||
Implementation-Vendor-Id: cn.cloudwalk.elevator
|
||||
Spring-Boot-Version: 1.5.17.RELEASE
|
||||
Implementation-Vendor: Pivotal Software, Inc.
|
||||
Main-Class: org.springframework.boot.loader.JarLauncher
|
||||
Start-Class: cn.cloudwalk.elevator.ElevatorApplication
|
||||
Spring-Boot-Classes: BOOT-INF/classes/
|
||||
Spring-Boot-Lib: BOOT-INF/lib/
|
||||
Created-By: Apache Maven 3.9.10
|
||||
Build-Jdk: 1.8.0_482
|
||||
Implementation-URL: http://projects.spring.io/spring-boot/cw-elevator-
|
||||
application-reactor/cw-elevator-application-starter/
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
#Generated by Apache Maven
|
||||
#Wed Apr 29 12:15:25 CST 2026
|
||||
version=2.0-SNAPSHOT
|
||||
groupId=cn.cloudwalk.elevator
|
||||
artifactId=cw-elevator-application-starter
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>cn.cloudwalk.elevator</groupId>
|
||||
<artifactId>cw-elevator-application-reactor</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>cw-elevator-application-starter</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>cw-elevator-application-starter</name>
|
||||
<description>可执行 Spring Boot 入口:repackage 为单 JAR 发布包(对齐历史 V1 starter 形态)。</description>
|
||||
|
||||
<properties>
|
||||
<alibaba.eclipse.codestyle.path>${project.basedir}/../../docs/style/alibaba-eclipse-codestyle.xml</alibaba.eclipse.codestyle.path>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk</groupId>
|
||||
<artifactId>cloudwalk-device-sdk-protocol-entity</artifactId>
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.cloudwalk.elevator</groupId>
|
||||
<artifactId>cw-elevator-application-web</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${elevator.release.finalName}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>net.revelc.code.formatter</groupId>
|
||||
<artifactId>formatter-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -2,14 +2,23 @@
|
||||
# 与当前目录下 application.properties 同路径启动 V2(maven 构建)包。
|
||||
# 默认优先系统 JDK 8;若只有 JDK11+ 会自动附加 --add-opens。
|
||||
# ELEVATOR_USE_ENV_JAVA=1 ./run.sh 使用当前 JAVA_HOME(如 Conda)。
|
||||
# 发布包内脚本与 JAR、properties 均位于发布根目录(与 cw-elevator-application-V1.0.0.20211103 布局一致)。
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
# shellcheck source=../common-java.sh
|
||||
source "$(cd "$(dirname "$0")" && pwd)/../common-java.sh"
|
||||
source "${SCRIPT_DIR}/../common-java.sh"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
JAR="cw-elevator-application-2.0.0.jar"
|
||||
if [[ ! -f "$JAR" ]]; then
|
||||
echo "缺少 $JAR,请在 deploy 目录执行: ./sync-jars.sh" >&2
|
||||
JAR=""
|
||||
for candidate in $(ls -1t cw-elevator-application-*.jar 2>/dev/null || true); do
|
||||
if [[ "${candidate}" == *.jar.original ]]; then
|
||||
continue
|
||||
fi
|
||||
JAR="${candidate}"
|
||||
break
|
||||
done
|
||||
if [[ -z "${JAR}" || ! -f "${JAR}" ]]; then
|
||||
echo "缺少 cw-elevator-application-*.jar,请在 deploy 目录执行: ./sync-jars.sh" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -24,16 +33,6 @@ while IFS= read -r line; do
|
||||
[[ -n "$line" ]] && OPEN_FLAGS+=("$line")
|
||||
done < <(_jdk8_open_flags "$JAVA")
|
||||
|
||||
# 同 v1:由 redis-override.properties 合并出 SPRING_APPLICATION_JSON。
|
||||
if ! command -v python3 >/dev/null 2>&1; then
|
||||
echo "需要 python3(deploy/merge-redis-json.sh)。请安装 python3。" >&2
|
||||
exit 1
|
||||
fi
|
||||
MERGE="$(cd "$(dirname "$0")" && pwd)/../merge-redis-json.sh"
|
||||
if [[ ! -x "$MERGE" ]]; then
|
||||
chmod +x "$MERGE" 2>/dev/null || true
|
||||
fi
|
||||
export SPRING_APPLICATION_JSON="$("$MERGE" "$PWD/redis-override.properties")"
|
||||
# 强制走 Consul:不再注入本地 application*.properties / redis-override.properties。
|
||||
# shellcheck disable=SC2086
|
||||
exec "$JAVA" "${OPEN_FLAGS[@]}" ${ELEVATOR_JAVA_OPTS:-} -jar "$JAR" \
|
||||
--spring.config.location=file:./application.properties,file:./application-access-control.properties,file:./redis-override.properties
|
||||
exec "$JAVA" "${OPEN_FLAGS[@]}" ${ELEVATOR_JAVA_OPTS:-} -jar "$JAR"
|
||||
|
||||
Reference in New Issue
Block a user