修复生产Nacos配置解析并重发Core
This commit is contained in:
+78
@@ -0,0 +1,78 @@
|
||||
package com.xiaowang.jayucloud.core.config;
|
||||
|
||||
import org.springframework.context.ApplicationContextInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 将中间件顶层配置映射到 Spring Boot 自动配置使用的标准前缀。
|
||||
*/
|
||||
public final class MiddlewareEnvironmentPostProcessor
|
||||
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
|
||||
|
||||
private static final String ALIAS_SOURCE_NAME = "jayuCloudMiddlewareAliases";
|
||||
|
||||
@Override
|
||||
public void initialize(ConfigurableApplicationContext applicationContext) {
|
||||
applyAliases(applicationContext.getEnvironment());
|
||||
}
|
||||
|
||||
void applyAliases(ConfigurableEnvironment environment) {
|
||||
Map<String, Object> aliases = new LinkedHashMap<>();
|
||||
copyPrefix(environment, aliases, "mysql", "spring.datasource", Set.of("mysql.mybatis", "mysql.mybatis-plus"));
|
||||
copyPrefix(environment, aliases, "mysql.mybatis", "mybatis", Set.of());
|
||||
copyPrefix(environment, aliases, "mysql.mybatis-plus", "mybatis-plus", Set.of());
|
||||
copyPrefix(environment, aliases, "redis", "spring.redis", Set.of());
|
||||
copyPrefix(environment, aliases, "rabbitmq", "spring.rabbitmq", Set.of());
|
||||
if (!aliases.isEmpty()) {
|
||||
environment.getPropertySources().addFirst(new MapPropertySource(ALIAS_SOURCE_NAME, aliases));
|
||||
}
|
||||
}
|
||||
|
||||
private void copyPrefix(
|
||||
ConfigurableEnvironment environment,
|
||||
Map<String, Object> aliases,
|
||||
String sourcePrefix,
|
||||
String targetPrefix,
|
||||
Set<String> excludedPrefixes
|
||||
) {
|
||||
for (PropertySource<?> propertySource : environment.getPropertySources()) {
|
||||
if (ALIAS_SOURCE_NAME.equals(propertySource.getName())
|
||||
|| !(propertySource instanceof EnumerablePropertySource<?> enumerablePropertySource)) {
|
||||
continue;
|
||||
}
|
||||
for (String propertyName : enumerablePropertySource.getPropertyNames()) {
|
||||
if (!propertyName.equals(sourcePrefix) && !propertyName.startsWith(sourcePrefix + ".")) {
|
||||
continue;
|
||||
}
|
||||
if (isExcluded(propertyName, excludedPrefixes)) {
|
||||
continue;
|
||||
}
|
||||
String suffix = propertyName.substring(sourcePrefix.length());
|
||||
String targetName = targetPrefix + suffix;
|
||||
if (!aliases.containsKey(targetName)) {
|
||||
Object value = propertySource.getProperty(propertyName);
|
||||
if (value != null) {
|
||||
aliases.put(targetName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isExcluded(String propertyName, Set<String> excludedPrefixes) {
|
||||
for (String excludedPrefix : excludedPrefixes) {
|
||||
if (propertyName.equals(excludedPrefix) || propertyName.startsWith(excludedPrefix + ".")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -17,7 +17,7 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
@Configuration
|
||||
@Validated
|
||||
@ConfigurationProperties(prefix = "aliyun.oss")
|
||||
@ConfigurationProperties(prefix = "object-storage.aliyun.oss")
|
||||
public class AliyunOssConfig {
|
||||
|
||||
@NotNull
|
||||
@@ -37,7 +37,7 @@ public class AliyunOssConfig {
|
||||
private Integer signedUrlExpireMinutes;
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
@ConditionalOnProperty(prefix = "aliyun.oss", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = "object-storage.aliyun.oss", name = "enabled", havingValue = "true")
|
||||
public OSS aliyunOssClient() {
|
||||
if (!StringUtils.hasText(endpoint)
|
||||
|| !StringUtils.hasText(accessKeyId)
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
@Configuration
|
||||
@Validated
|
||||
@ConfigurationProperties(prefix = "minio")
|
||||
@ConfigurationProperties(prefix = "object-storage.minio")
|
||||
public class MinioStorageConfig {
|
||||
|
||||
@NotNull
|
||||
@@ -37,7 +37,7 @@ public class MinioStorageConfig {
|
||||
private Integer signedUrlExpireMinutes;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "minio", name = "enabled", havingValue = "true")
|
||||
@ConditionalOnProperty(prefix = "object-storage.minio", name = "enabled", havingValue = "true")
|
||||
public MinioClient minioClient() {
|
||||
if (!StringUtils.hasText(endpoint)
|
||||
|| !StringUtils.hasText(accessKey)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import javax.validation.constraints.NotNull;
|
||||
@Data
|
||||
@Configuration
|
||||
@Validated
|
||||
@ConfigurationProperties(prefix = "qiniu.kodo")
|
||||
@ConfigurationProperties(prefix = "object-storage.qiniu.kodo")
|
||||
public class QiniuKodoConfig {
|
||||
|
||||
@NotBlank
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.context.ApplicationContextInitializer=\
|
||||
com.xiaowang.jayucloud.core.config.MiddlewareEnvironmentPostProcessor
|
||||
@@ -40,15 +40,9 @@ spring:
|
||||
password: ${NACOS_PASSWORD:}
|
||||
# Core 与 Gateway 共享的公共配置文件。
|
||||
shared-configs:
|
||||
- data-id: datasource.yaml
|
||||
- data-id: common.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: infra.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: secret.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: logging.yaml
|
||||
- data-id: middleware.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.xiaowang.jayucloud.core.config;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class MiddlewareEnvironmentPostProcessorTest {
|
||||
|
||||
@Test
|
||||
void mapsMiddlewareBlocksToSpringBootPrefixes() {
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.getPropertySources().addLast(new MapPropertySource(
|
||||
"middleware",
|
||||
Map.of(
|
||||
"mysql.url", "jdbc:mysql://127.0.0.1:3306/jayu_cloud",
|
||||
"mysql.druid.initial-size", "2",
|
||||
"mysql.mybatis.configuration.map-underscore-to-camel-case", "true",
|
||||
"mysql.mybatis-plus.mapper-locations", "classpath:mapper/*.xml",
|
||||
"redis.sentinel.master", "mymaster",
|
||||
"redis.sentinel.nodes[0]", "127.0.0.1:26379",
|
||||
"rabbitmq.addresses", "127.0.0.1:5672"
|
||||
)
|
||||
));
|
||||
|
||||
new MiddlewareEnvironmentPostProcessor().applyAliases(environment);
|
||||
|
||||
assertThat(environment.getProperty("spring.datasource.url"))
|
||||
.isEqualTo("jdbc:mysql://127.0.0.1:3306/jayu_cloud");
|
||||
assertThat(environment.getProperty("spring.datasource.druid.initial-size"))
|
||||
.isEqualTo("2");
|
||||
assertThat(environment.getProperty("mybatis.configuration.map-underscore-to-camel-case"))
|
||||
.isEqualTo("true");
|
||||
assertThat(environment.getProperty("mybatis-plus.mapper-locations"))
|
||||
.isEqualTo("classpath:mapper/*.xml");
|
||||
assertThat(environment.getProperty("spring.datasource.mybatis.configuration.map-underscore-to-camel-case"))
|
||||
.isNull();
|
||||
assertThat(environment.getProperty("spring.redis.sentinel.master"))
|
||||
.isEqualTo("mymaster");
|
||||
assertThat(environment.getProperty("spring.redis.sentinel.nodes[0]"))
|
||||
.isEqualTo("127.0.0.1:26379");
|
||||
assertThat(environment.getProperty("spring.rabbitmq.addresses"))
|
||||
.isEqualTo("127.0.0.1:5672");
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package com.xiaowang.jayucloud.gateway.config;
|
||||
|
||||
import org.springframework.context.ApplicationContextInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.EnumerablePropertySource;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 将中间件顶层配置映射到 Spring Boot 自动配置使用的标准前缀。
|
||||
*/
|
||||
public final class MiddlewareEnvironmentPostProcessor
|
||||
implements ApplicationContextInitializer<ConfigurableApplicationContext> {
|
||||
|
||||
private static final String ALIAS_SOURCE_NAME = "jayuCloudMiddlewareAliases";
|
||||
|
||||
@Override
|
||||
public void initialize(ConfigurableApplicationContext applicationContext) {
|
||||
applyAliases(applicationContext.getEnvironment());
|
||||
}
|
||||
|
||||
void applyAliases(ConfigurableEnvironment environment) {
|
||||
Map<String, Object> aliases = new LinkedHashMap<>();
|
||||
copyPrefix(environment, aliases, "mysql", "spring.datasource", Set.of("mysql.mybatis", "mysql.mybatis-plus"));
|
||||
copyPrefix(environment, aliases, "mysql.mybatis", "mybatis", Set.of());
|
||||
copyPrefix(environment, aliases, "mysql.mybatis-plus", "mybatis-plus", Set.of());
|
||||
copyPrefix(environment, aliases, "redis", "spring.redis", Set.of());
|
||||
copyPrefix(environment, aliases, "rabbitmq", "spring.rabbitmq", Set.of());
|
||||
if (!aliases.isEmpty()) {
|
||||
environment.getPropertySources().addFirst(new MapPropertySource(ALIAS_SOURCE_NAME, aliases));
|
||||
}
|
||||
}
|
||||
|
||||
private void copyPrefix(
|
||||
ConfigurableEnvironment environment,
|
||||
Map<String, Object> aliases,
|
||||
String sourcePrefix,
|
||||
String targetPrefix,
|
||||
Set<String> excludedPrefixes
|
||||
) {
|
||||
for (PropertySource<?> propertySource : environment.getPropertySources()) {
|
||||
if (ALIAS_SOURCE_NAME.equals(propertySource.getName())
|
||||
|| !(propertySource instanceof EnumerablePropertySource<?> enumerablePropertySource)) {
|
||||
continue;
|
||||
}
|
||||
for (String propertyName : enumerablePropertySource.getPropertyNames()) {
|
||||
if (!propertyName.equals(sourcePrefix) && !propertyName.startsWith(sourcePrefix + ".")) {
|
||||
continue;
|
||||
}
|
||||
if (isExcluded(propertyName, excludedPrefixes)) {
|
||||
continue;
|
||||
}
|
||||
String suffix = propertyName.substring(sourcePrefix.length());
|
||||
String targetName = targetPrefix + suffix;
|
||||
if (!aliases.containsKey(targetName)) {
|
||||
Object value = propertySource.getProperty(propertyName);
|
||||
if (value != null) {
|
||||
aliases.put(targetName, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isExcluded(String propertyName, Set<String> excludedPrefixes) {
|
||||
for (String excludedPrefix : excludedPrefixes) {
|
||||
if (propertyName.equals(excludedPrefix) || propertyName.startsWith(excludedPrefix + ".")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
org.springframework.context.ApplicationContextInitializer=\
|
||||
com.xiaowang.jayucloud.gateway.config.MiddlewareEnvironmentPostProcessor
|
||||
@@ -34,15 +34,9 @@ spring:
|
||||
password: ${NACOS_PASSWORD:}
|
||||
# Core 与 Gateway 共享的公共配置文件。
|
||||
shared-configs:
|
||||
- data-id: datasource.yaml
|
||||
- data-id: common.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: infra.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: secret.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
- data-id: logging.yaml
|
||||
- data-id: middleware.yaml
|
||||
group: ${NACOS_GROUP:DEFAULT_GROUP}
|
||||
refresh: true
|
||||
|
||||
+2
-4
@@ -56,10 +56,8 @@ class AuthGlobalFilterWhitelistTest {
|
||||
|
||||
assertThat(yaml)
|
||||
.contains("name: gateway")
|
||||
.contains("data-id: datasource.yaml")
|
||||
.contains("data-id: infra.yaml")
|
||||
.contains("data-id: secret.yaml")
|
||||
.contains("data-id: logging.yaml");
|
||||
.contains("data-id: common.yaml")
|
||||
.contains("data-id: middleware.yaml");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1279,3 +1279,11 @@ rtk node -e "const fs=require('fs');const path=require('path');let n=0;function
|
||||
- 当前可验证状态:本机到 `192.168.5.110:3306` 的 TCP 连接成功;MySQL TCP 只读校验确认目标为 `hostname=centos7`、`port=3306`、`version=8.0.45`。
|
||||
- 本次未变更:MySQL 数据、Nacos 配置、应用服务、Nginx、Redis、RabbitMQ、对象存储和 SQL 文件。
|
||||
- 后续关注:新增维护机直连生产 MySQL 前,先确认实际源地址,再同步登记到 `docs/生产环境服务器信息总表.md` 和 `docs/项目变更记录.md`。
|
||||
|
||||
## 2026-07-23 Nacos 重组与生产 Core 当前状态
|
||||
|
||||
- 已完成:开发、生产 Nacos 已统一使用 `common.yaml`、`middleware.yaml`、`core.yaml`、`gateway.yaml` 四个 dataId;生产 MinIO 已切换为 `https://minio.yunail.art`,开发仍使用 `http://wcy111.top:9000`。
|
||||
- 已完成:修复 `middleware.yaml` 中 Druid `exclusions` 未引用导致的 SnakeYAML 1.30 alias 解析错误,并重新发布开发、生产配置。
|
||||
- 已完成:生产三台 Core 已更新到 SHA-256 `D01041661200AD571CAE78DCC367A69A2EB6BF1B6968660AA30E7C81AE7946FB`;三台 Core、三台 Gateway 均已通过本机健康检查,Nacos 注册均为 3/3 healthy。
|
||||
- 当前可验证状态:`https://yunail.art/health/check`、`https://yunail.art/api/shop/list`、`https://minio.yunail.art/minio/health/live` 均返回 200。
|
||||
- 后续关注:店铺列表当前没有返回实际图片 URL,需在存在真实图片记录时继续验证“接口返回 signed URL -> 浏览器/小程序加载 -> MinIO 反代”的完整链路;不要把空列表的 200 响应当成图片渲染验收。
|
||||
|
||||
@@ -681,3 +681,12 @@
|
||||
- 发布验证:`JY-core01`、`JY-core02`、`JY-core03` 已滚动更新 `jayu-cloud-core`,三台 `/opt/jayu-cloud/core/JY-Core.jar` 与 `/opt/jayu-cloud/core/app.jar` SHA-256 均为 `bf1e1aa3647148e06530551558f66b68fc4f31eac75a35a5d5310830ef0dd1bb`。
|
||||
- 健康验证:三台 Core 均为 `active/enabled`,本机 `/health/check` 均返回 `JY-Core is running`,最近错误日志计数均为 0;公网 `https://yunail.art/health/check` 与 `https://yunail.art/api/shop/list` 均返回 200。
|
||||
- 未执行项:本次未执行 SQL、未发布 Gateway、未发布 Web 静态资源、未修改 Nacos 与 Nginx;店务小程序更新由用户处理。
|
||||
|
||||
## 2026-07-23 Nacos 重组与生产图片链路配置验收
|
||||
|
||||
- 配置验收:开发 `JayuCloud-Dev`、生产 `jayu-cloud` 均存在 `common.yaml`、`middleware.yaml`、`core.yaml`、`gateway.yaml`,四份配置使用 SnakeYAML 1.30 解析通过。
|
||||
- 对象存储验收:开发 MinIO endpoint 为 `http://wcy111.top:9000`、bucket 为 `jayucloud-dev`;生产 MinIO endpoint 为 `https://minio.yunail.art`、bucket 为 `jayucloud`;生产三台 Nacos 回读内容一致。
|
||||
- 中间件验收:生产 Redis Sentinel 节点为 3 个字符串 `host:port` 值;Gateway 路由为 19 条且全部指向 `lb://jy-core`。
|
||||
- 根因验收:Core01 的原始失败为 `middleware.yaml` 第 32 行未引用的 `*` 开头标量,修复后最近启动窗口不再出现 SnakeYAML 解析错误或 datasource 初始化错误。
|
||||
- 发布验收:三台 Core 的 `JY-Core.jar` SHA-256 均为 `D01041661200AD571CAE78DCC367A69A2EB6BF1B6968660AA30E7C81AE7946FB`;生产 Nacos 中 `jy-core`、`jy-gateway` 均为 3/3 healthy。
|
||||
- 公网验收:`https://yunail.art/health/check`、`https://yunail.art/api/shop/list`、`https://minio.yunail.art/minio/health/live` 均返回 HTTP 200。当前店铺列表响应没有实际图片 URL 字段,因此未伪造具体图片渲染成功结论;对象存储入口和服务配置已恢复,后续有真实图片数据时再做浏览器图片请求验收。
|
||||
|
||||
@@ -905,3 +905,12 @@ messagehub:
|
||||
- 本地开发不再通过 `http://dev.yunail.art:18888` 转发接口,避免 OpenClash fake-ip 或软路由端口转发影响 `/api`、`/admin/api` 请求。
|
||||
- 修改 `.env.development` 后需要重启 Vite 开发服务,已启动进程不会自动重新读取该配置。
|
||||
- 验证方式:确认本机 `http://127.0.0.1:80/health/check` 返回成功,再启动设计师网页端并访问 `/api/shop/list/simple`、`/api/legal-agreement/current`、`/admin/api/auth/login-shops/dianzhang` 等代理接口。
|
||||
|
||||
### 2026-07-23 Nacos 配置板块化与对象存储入口
|
||||
|
||||
- Core 与 Gateway 的共享配置统一加载 `common.yaml`、`middleware.yaml`;服务独有配置分别使用 `core.yaml`、`gateway.yaml`。
|
||||
- `common.yaml` 只放共享业务参数和日志;`middleware.yaml` 按 `mysql`、`redis`、`rabbitmq`、`object-storage` 分板块维护完整中间件配置。
|
||||
- 开发 namespace `JayuCloud-Dev` 的 MinIO endpoint 为 `http://wcy111.top:9000`,bucket 为 `jayucloud-dev`;生产 namespace `jayu-cloud` 的 MinIO endpoint 为 `https://minio.yunail.art`,bucket 为 `jayucloud`。七牛 Kodo 和阿里云 OSS 的 endpoint、凭据结构与环境原配置保持一致,仅 bucket 按环境区分。
|
||||
- 本次修复前,`middleware.yaml` 中 Druid `exclusions` 值以 `*` 开头但未加 YAML 引号,SnakeYAML 1.30 会将其识别为 alias 并报 `while scanning an alias`。以后发布 Nacos YAML 前必须使用真实运行版本的 SnakeYAML 做语法校验,尤其检查 `*`、`&`、`!`、`%`、`@`、反引号等保留前缀。
|
||||
- 修复后开发、生产四个 dataId 均已用 SnakeYAML 1.30 解析通过;生产三台 Nacos 节点的 `middleware.yaml` 内容 SHA-256 前 12 位均为 `808BAF98BBB5`。
|
||||
- 配置变更后必须回读四个 dataId、核对对象存储 endpoint/bucket、Redis Sentinel 节点类型、Gateway 路由数量和 `lb://jy-core` 目标,再滚动重启 Core/Gateway。
|
||||
|
||||
@@ -427,3 +427,13 @@
|
||||
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
||||
- 影响范围:影响 `JY-Salon-WeChat/app.json`、`pages/shop-settings/`、新增 `pages/shop-profile-edit/` 和 `pages/shop-tags/`;不影响后端、接口契约和预约业务。
|
||||
- 验证方式:三个新增/修改页面 JavaScript 语法检查通过,四份 JSON 配置可解析,相关文件 `git diff --check` 通过;GitNexus `impact` 对 `shop-settings.loadSettings` 返回 LOW 风险、3 个直接依赖、0 个受影响流程;微信开发者工具已确认 `pages/shop-settings/index` 主页面数据加载、`pages/shop-profile-edit/index` 档案二级页路由与表单数据、`pages/shop-tags/index` 标签二级页路由与表单数据,并通过页面方法验证营业安排弹层打开及常规排班状态;截图通道偶发超时,但连接健康检查为 connected 且 `needsRecovery=false`,不影响页面数据和路由断言。
|
||||
|
||||
## 2026-07-23 Nacos 配置重组、YAML 修复与生产 Core 发布
|
||||
|
||||
- 变更原因:按用户要求将开发、生产 Nacos 配置统一整理为 `core.yaml`、`gateway.yaml`、`common.yaml`、`middleware.yaml` 四个 dataId,并将生产 MinIO 公网入口改为 `https://minio.yunail.art`。
|
||||
- 处理方式:Core/Gateway bootstrap 统一加载 `common.yaml`、`middleware.yaml`;中间件配置按 `mysql`、`redis`、`rabbitmq`、`object-storage` 分板块;对象存储配置前缀统一为 `object-storage.minio`、`object-storage.qiniu.kodo`、`object-storage.aliyun.oss`;增加中间件别名映射以兼容 Spring Boot、MyBatis、Redis 和 RabbitMQ 自动配置。
|
||||
- 开发配置:`JayuCloud-Dev` 的 MinIO endpoint 为 `http://wcy111.top:9000`,三个对象存储 bucket 为 `jayucloud-dev`。
|
||||
- 生产配置:`jayu-cloud` 的 MinIO endpoint 为 `https://minio.yunail.art`,三个对象存储 bucket 为 `jayucloud`;生产三台 Nacos 节点回读的 `middleware.yaml` SHA-256 前 12 位均为 `808BAF98BBB5`。
|
||||
- 根因与修复:生产 Core01 启动日志定位到 `middleware.yaml` 第 32 行 Druid `exclusions` 的 `*` 前缀未加引号,SnakeYAML 1.30 报 `while scanning an alias`;修正 YAML 标量生成规则后,开发、生产四个 dataId 均通过真实 SnakeYAML 1.30 校验,并重新发布到两套 namespace。
|
||||
- 后端发布:Core 新 JAR SHA-256 为 `D01041661200AD571CAE78DCC367A69A2EB6BF1B6968660AA30E7C81AE7946FB`,三台生产 Core 均已滚动更新;Gateway 保持已发布 SHA `C0251518B48CC49282305C905696D6E04AD915040DE551560A8AEC05B259F9BE`。
|
||||
- 验证结果:生产 `jy-core`、`jy-gateway` 均为 3/3 healthy;三台 Core 和三台 Gateway 为 `active/enabled`;`https://yunail.art/health/check`、`https://yunail.art/api/shop/list`、`https://minio.yunail.art/minio/health/live` 均返回 200;本次不涉及 SQL、数据库结构、Nginx 和网页静态资源。
|
||||
|
||||
@@ -518,3 +518,15 @@
|
||||
以后避免:不要在 `(...)`、`@{}` 或字符串插值中直接嵌入 `if` 语句;多步 PowerShell 操作按“执行 -> 赋值 -> 输出”分步写。
|
||||
|
||||
验证方式:先单独检查 `Test-Path` 和 `Get-Content`,确认视觉 companion 的 `state/server-info` 存在且可读,再访问浏览器 URL。
|
||||
|
||||
## 2026-07-23 Nacos YAML 中以保留字符开头的标量必须引用
|
||||
|
||||
问题:生产 Core01 启动时出现 `middleware.yaml` 的 SnakeYAML `while scanning an alias`,随后伴随 datasource 初始化失败。
|
||||
|
||||
原因:Druid `exclusions` 值为 `*.js,*.gif,*.jpg,...`,自定义 YAML 生成器把它按普通标量输出;SnakeYAML 1.30 将开头的 `*` 解释为 alias 标记。
|
||||
|
||||
处理方式:生成 YAML 标量时,对 `*`、`&`、`!`、`%`、`@`、反引号等保留前缀统一使用 JSON/YAML 双引号;重新发布开发、生产 `middleware.yaml`,并用生产实际使用的 SnakeYAML 1.30 对四个 dataId 做内存校验。
|
||||
|
||||
以后避免:任何 Nacos YAML 发布前都要做真实解析校验,不能只依赖宽松的自定义解析器;配置发布后还要逐节点回读,确认集群内容一致,再滚动重启应用。
|
||||
|
||||
验证方式:开发、生产 `common.yaml`、`middleware.yaml`、`core.yaml`、`gateway.yaml` 均通过 SnakeYAML 1.30;生产三台 Nacos 的 `middleware.yaml` SHA-256 前 12 位一致;三台 Core 重启后无新的 YAML 解析错误,Nacos 注册为 3/3 healthy。
|
||||
|
||||
@@ -81,3 +81,11 @@
|
||||
- 下一步:保持当前暂存范围,提交本次中文 commit。
|
||||
- 当前阻塞点:无。
|
||||
- 最近一次重要操作结果:微信开发者工具运行态验证已通过,`pages/shop-settings/index` 可见“标签设置”区,`pages/appointment-form/index` 可打开手工预约面板并显示标签输入/添加控件;GitNexus staged `detect-changes` 结果为 low risk、0 affected processes。
|
||||
|
||||
## 2026-07-23 Nacos 重组与生产 Core 修复
|
||||
|
||||
- 已完成:定位生产 Core01 的 SnakeYAML 根因,`middleware.yaml` 第 32 行 Druid `exclusions` 的 `*` 开头标量未加引号。
|
||||
- 已完成:修正生成规则并重新发布开发、生产四个 Nacos dataId;开发 MinIO 为 `http://wcy111.top:9000`,生产 MinIO 为 `https://minio.yunail.art`。
|
||||
- 已完成:使用 SnakeYAML 1.30 校验两套环境四份配置;生产三台 Nacos `middleware.yaml` 内容一致;Gateway 19 条路由全部指向 `lb://jy-core`。
|
||||
- 已完成:生产三台 Core 滚动发布新 SHA `D01041661200AD571CAE78DCC367A69A2EB6BF1B6968660AA30E7C81AE7946FB`,生产 Core/Gateway 均为 3/3 healthy,公网健康、店铺列表和 MinIO 健康接口均返回 200。
|
||||
- 当前注意:店铺列表当前未返回实际图片 URL,图片最终渲染仍需在存在真实图片记录时做 signed URL 和浏览器/小程序加载验收。
|
||||
|
||||
Reference in New Issue
Block a user