From bf29f276293ec6a5f95618f0ff11c6c9daa08600 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Wed, 26 Aug 2026 09:33:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=94=9F=E4=BA=A7=E4=B8=8E?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83Nacos=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/scripts/publish-nacos.mjs | 28 ++- .gitea/workflows/publish-nacos.yml | 20 ++- .../生产与测试环境Nacos配置说明_20260826.md | 45 +++++ docs/运维配置与集成说明.md | 2 +- .../jayucloud-artlist/DEFAULT_GROUP/core.yaml | 138 +++++++++++++++ .../DEFAULT_GROUP/gateway.yaml | 132 ++++++++++++++ .../DEFAULT_GROUP/infra.yaml | 56 ++++++ .../DEFAULT_GROUP/logging.yaml | 4 + .../DEFAULT_GROUP/secret.yaml | 17 ++ .../jayucloud-salon/DEFAULT_GROUP/core.yaml | 138 +++++++++++++++ .../DEFAULT_GROUP/gateway.yaml | 163 ++++++++++++++++++ .../jayucloud-salon/DEFAULT_GROUP/infra.yaml | 56 ++++++ .../DEFAULT_GROUP/logging.yaml | 4 + .../jayucloud-salon/DEFAULT_GROUP/secret.yaml | 17 ++ 14 files changed, 808 insertions(+), 12 deletions(-) create mode 100644 docs/scripts/生产与测试环境Nacos配置说明_20260826.md create mode 100644 nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/core.yaml create mode 100644 nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/gateway.yaml create mode 100644 nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/infra.yaml create mode 100644 nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/logging.yaml create mode 100644 nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/secret.yaml create mode 100644 nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/core.yaml create mode 100644 nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml create mode 100644 nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/infra.yaml create mode 100644 nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/logging.yaml create mode 100644 nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/secret.yaml diff --git a/.gitea/scripts/publish-nacos.mjs b/.gitea/scripts/publish-nacos.mjs index 91edc15b..ea6ef183 100644 --- a/.gitea/scripts/publish-nacos.mjs +++ b/.gitea/scripts/publish-nacos.mjs @@ -3,15 +3,21 @@ import { readFile, readdir } from 'node:fs/promises'; import { join, relative, sep } from 'node:path'; const repositoryRoot = process.cwd(); -const configRoot = join(repositoryRoot, 'nacos', 'namespaces', 'prod'); -const nacosUrls = requiredEnvironment('NACOS_URLS').split(',').map((value) => value.trim()).filter(Boolean); -const username = requiredEnvironment('NACOS_USERNAME'); -const password = requiredEnvironment('NACOS_PASSWORD'); +const environment = requiredNacosEnvironment('NACOS_ENVIRONMENT'); +const configRoot = join(repositoryRoot, 'nacos', 'namespaces', environment); +const nacosUrls = requiredEnvironment(`NACOS_${environment.toUpperCase()}_URLS`).split(',').map((value) => value.trim()).filter(Boolean); +const username = requiredEnvironment(`NACOS_${environment.toUpperCase()}_USERNAME`); +const password = requiredEnvironment(`NACOS_${environment.toUpperCase()}_PASSWORD`); const group = 'DEFAULT_GROUP'; +const verificationNodeCount = environment === 'prod' ? 2 : 1; + +if (nacosUrls.length < verificationNodeCount) { + throw new Error(`${environment} 环境至少需要 ${verificationNodeCount} 个 Nacos 地址用于发布校验`); +} const configFiles = await collectYamlFiles(configRoot); if (configFiles.length === 0) { - throw new Error('nacos/namespaces/prod 下没有可发布的 YAML 配置'); + throw new Error(`nacos/namespaces/${environment} 下没有可发布的 YAML 配置`); } const token = await login(nacosUrls[0], username, password); @@ -23,8 +29,8 @@ for (const filePath of configFiles) { const [namespace, , dataId] = relativePath; const content = await readFile(filePath, 'utf8'); await publish(nacosUrls[0], token, namespace, group, dataId, content); - await verify(nacosUrls.slice(0, 2), token, namespace, group, dataId, content); - console.log(`已发布并校验 ${namespace}/${group}/${dataId}`); + await verify(nacosUrls.slice(0, verificationNodeCount), token, namespace, group, dataId, content); + console.log(`已发布并校验 ${environment}/${namespace}/${group}/${dataId}`); } function requiredEnvironment(name) { @@ -35,6 +41,14 @@ function requiredEnvironment(name) { return value; } +function requiredNacosEnvironment(name) { + const environment = requiredEnvironment(name); + if (environment !== 'prod' && environment !== 'sit') { + throw new Error(`不支持的 Nacos 发布环境:${environment};只允许 prod 或 sit`); + } + return environment; +} + async function collectYamlFiles(directory) { const entries = await readdir(directory, { withFileTypes: true }); const files = []; diff --git a/.gitea/workflows/publish-nacos.yml b/.gitea/workflows/publish-nacos.yml index 45a4d3e9..b1c50114 100644 --- a/.gitea/workflows/publish-nacos.yml +++ b/.gitea/workflows/publish-nacos.yml @@ -1,7 +1,15 @@ -name: 发布生产 Nacos 配置 +name: 发布 Nacos 配置 on: workflow_dispatch: + inputs: + environment: + description: 发布目标环境 + required: true + type: choice + options: + - sit + - prod jobs: publish: @@ -11,7 +19,11 @@ jobs: uses: actions/checkout@v4 - name: 发布并校验配置 env: - NACOS_URLS: ${{ secrets.NACOS_URLS }} - NACOS_USERNAME: ${{ secrets.NACOS_USERNAME }} - NACOS_PASSWORD: ${{ secrets.NACOS_PASSWORD }} + NACOS_ENVIRONMENT: ${{ inputs.environment }} + NACOS_PROD_URLS: ${{ secrets.NACOS_PROD_URLS }} + NACOS_PROD_USERNAME: ${{ secrets.NACOS_PROD_USERNAME }} + NACOS_PROD_PASSWORD: ${{ secrets.NACOS_PROD_PASSWORD }} + NACOS_SIT_URLS: ${{ secrets.NACOS_SIT_URLS }} + NACOS_SIT_USERNAME: ${{ secrets.NACOS_SIT_USERNAME }} + NACOS_SIT_PASSWORD: ${{ secrets.NACOS_SIT_PASSWORD }} run: node .gitea/scripts/publish-nacos.mjs diff --git a/docs/scripts/生产与测试环境Nacos配置说明_20260826.md b/docs/scripts/生产与测试环境Nacos配置说明_20260826.md new file mode 100644 index 00000000..0f1a34b4 --- /dev/null +++ b/docs/scripts/生产与测试环境Nacos配置说明_20260826.md @@ -0,0 +1,45 @@ +# 生产与测试环境 Nacos 配置说明 + +## 配置目录 + +Nacos 配置源按环境、命名空间和 Group 分离: + +```text +nacos/namespaces///DEFAULT_GROUP/.yaml +``` + +当前支持 `prod` 与 `sit` 环境,且每个环境均包含 `jayucloud-artlist`、`jayucloud-salon` 两个 namespace。每个 namespace 必须包含 `core.yaml`、`gateway.yaml`、`infra.yaml`、`secret.yaml` 和 `logging.yaml`。 + +## 环境差异 + +| 项目 | PROD | SIT | +| --- | --- | --- | +| Nacos | 三节点生产集群 | `192.168.10.103:8848` | +| MySQL | 生产 ProxySQL 入口 | `192.168.10.102:3306` | +| Redis | Sentinel `mymaster` | `192.168.10.101:6379` 单机 | +| RabbitMQ | `mq-prod.internal:5672` | `192.168.10.104:5672` | +| MinIO | `192.168.10.105:9000` | `192.168.5.15:9000` | +| 对象存储 Bucket | `jayucloud` | `jayucloud-sit` | + +SIT 的设计师库为 `jayucloud_artlist`,店务库为 `jayucloud_salon`。三个对象存储 Provider 在 SIT 均使用 `jayucloud-sit` Bucket;其他 Provider 参数沿用生产值。 + +## 应用启动变量 + +Core 和 Gateway 必须显式设置 `NACOS_SERVER_ADDR`、`NACOS_NAMESPACE`、`NACOS_GROUP`、`NACOS_USERNAME`、`NACOS_PASSWORD`。SIT 的 `NACOS_SERVER_ADDR` 固定为 `192.168.10.103:8848`;生产使用三个生产 Nacos 节点地址。两个端侧分别使用 `jayucloud-artlist` 与 `jayucloud-salon` namespace,Group 均为 `DEFAULT_GROUP`。 + +## Gitea Actions 发布 + +工作流 `.gitea/workflows/publish-nacos.yml` 必须手工选择 `sit` 或 `prod`。脚本只读取所选环境目录,发布到对应 Nacos 后校验配置摘要。 + +Gitea 仓库 Secrets 必须配置: + +- `NACOS_PROD_URLS`、`NACOS_PROD_USERNAME`、`NACOS_PROD_PASSWORD` +- `NACOS_SIT_URLS`、`NACOS_SIT_USERNAME`、`NACOS_SIT_PASSWORD` + +SIT 使用一个 Nacos 地址并在该节点回读校验;PROD 至少提供两个地址并在两个节点回读校验。Secrets 不得出现在 YAML、Git 提交、工作流日志或说明文档中。 + +## 发布前后检查 + +发布前检查所选环境的两个 namespace 均存在五个 Data ID,且 YAML 语法有效。确认 SIT RabbitMQ 已创建业务 vhost 与最小权限账号,并通过 `RABBITMQ_VHOST`、`RABBITMQ_USERNAME`、`RABBITMQ_PASSWORD` 注入。 + +发布后确认日志中每个 Data ID 都显示已发布并校验;随后启动对应 Core/Gateway,确认服务注册到所选 Nacos 环境并完成数据库、Redis、RabbitMQ 和 MinIO 连通性检查。 diff --git a/docs/运维配置与集成说明.md b/docs/运维配置与集成说明.md index 5a9cc4fd..d65595a6 100644 --- a/docs/运维配置与集成说明.md +++ b/docs/运维配置与集成说明.md @@ -11,7 +11,7 @@ 服务注册名为 `jc-artlist-core`、`jc-artlist-gateway`、`jc-salon-core`、`jc-salon-gateway`。设计师 Web/小程序不再包含管理入口;店务 Web 仅保留管理工作流。 -生产 Nacos 配置源位于 `nacos/namespaces/prod/`,发布流程为 `.gitea/workflows/publish-nacos.yml`。Nacos 元数据库使用 `192.168.10.200:3306/nacos`,业务数据库使用 `192.168.10.200:6033` 对应业务库。Redis、RabbitMQ 和对象存储的生产连接信息通过环境变量或 Gitea Secrets 注入,不在仓库提交敏感值。 +Nacos 配置源位于 `nacos/namespaces/prod/` 与 `nacos/namespaces/sit/`,发布流程为 `.gitea/workflows/publish-nacos.yml`。工作流必须手工选择环境,配置与凭据不跨环境复用。生产 Nacos 元数据库使用 `192.168.10.200:3306/nacos`,生产业务数据库使用 `192.168.10.200:6033` 对应业务库;SIT 业务数据库使用 `192.168.10.102:3306`。Redis、RabbitMQ 和对象存储的连接信息通过环境变量或 Gitea Secrets 注入,不在仓库提交敏感值。详细规则见 `docs/scripts/生产与测试环境Nacos配置说明_20260826.md`。 生产对象存储默认使用中心1 MinIO `http://192.168.10.105:9000`,中心2 `http://192.168.20.15:9000` 仅在灾备接管时切换。七牛云 Kodo 使用私有空间 `jayucloud`、`z2` 和 `https://img.yunail.art`;阿里云 OSS 使用私有桶 `jayucloud`、`cn-chengdu` 和 `https://oss-cn-chengdu.aliyuncs.com`。详细发布与验证要求见 `docs/scripts/生产对象存储与中间件配置调整说明_20260825.md`。 diff --git a/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/core.yaml b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/core.yaml new file mode 100644 index 00000000..b83f5c36 --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/core.yaml @@ -0,0 +1,138 @@ +spring: + datasource: + url: jdbc:mysql://192.168.10.102:3306/jayucloud_artlist?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + servlet: + multipart: + max-file-size: 5MB + max-request-size: 10MB + jackson: + time-zone: Asia/Shanghai + date-format: yyyy-MM-dd HH:mm:ss + +logging: + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" + +server: + servlet: + encoding: + charset: UTF-8 + force: true + enabled: true + timezone: Asia/Shanghai + +mybatis: + configuration: + map-underscore-to-camel-case: true + +fingertip-designer: + brand: + message-template-name: ${PLATFORM_MESSAGE_TEMPLATE_NAME:JayuCloud-Artlist} + manager-register-shop-description: ${PLATFORM_MANAGER_REGISTER_SHOP_DESCRIPTION:甲屿店务注册店铺} + security: + jwt: + issuer: jayucloud-artlist + access-token-expiration-seconds: 7200 + remember-me-access-token-expiration-seconds: 604800 + refresh-token-expiration-seconds: 604800 + clock-skew-seconds: 30 + signature: + enabled: true + window-seconds: 300 + nonce-retention-seconds: 600 + rate-limit: + login: + limit: 10 + window-seconds: 60 + send-code: + limit: 5 + window-seconds: 60 + reset-password: + limit: 5 + window-seconds: 600 + authenticated-write: + limit: 80 + window-seconds: 60 + order-create: + limit: 10 + window-seconds: 60 + cache: + local-max-size: 2048 + product-detail: + local-ttl-seconds: 120 + redis-ttl-seconds: 900 + product-list: + local-ttl-seconds: 60 + redis-ttl-seconds: 300 + product-search: + local-ttl-seconds: 60 + redis-ttl-seconds: 300 + shop: + local-ttl-seconds: 180 + redis-ttl-seconds: 900 + tag: + local-ttl-seconds: 300 + redis-ttl-seconds: 1200 + object-storage-file: + local-ttl-seconds: 300 + redis-ttl-seconds: 1800 + dashboard: + local-ttl-seconds: 30 + redis-ttl-seconds: 90 + slow-request: + enabled: true + threshold-ms: 300 + log-response-header-request-id: true + http-client: + connect-timeout-ms: 3000 + read-timeout-ms: 5000 + connection-request-timeout-ms: 1000 + max-total-connections: 200 + max-connections-per-route: 50 + +object-storage: + provider-order: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + replica-required-providers: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + primary-provider: MINIO + backup-provider: QINIU_KODO,ALIYUN_OSS + signed-url-expire-minutes: 60 + backup-queue-name: jayucloud-artlist.file.object-storage.backup.queue + backup-exchange-name: jayucloud-artlist.file.object-storage.backup.exchange + backup-routing-key: jayucloud-artlist.file.object-storage.backup + backup-retry-batch-limit: 500 + backup-retry-cron: "0 0 2 * * ?" + +qiniu: + kodo: + access-key: ${QINIU_KODO_ACCESS_KEY:} + secret-key: ${QINIU_KODO_SECRET_KEY:} + bucket-name: ${QINIU_KODO_BUCKET_NAME:jayucloud-sit} + domain: ${QINIU_KODO_DOMAIN:https://img.yunail.art} + zone: ${QINIU_KODO_ZONE:z2} + private-bucket: ${QINIU_KODO_PRIVATE_BUCKET:true} + signed-url-expire-minutes: ${QINIU_KODO_SIGNED_URL_EXPIRE_MINUTES:60} + +minio: + enabled: ${MINIO_ENABLED:false} + endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000} + bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit} + access-key: ${MINIO_ACCESS_KEY:} + secret-key: ${MINIO_SECRET_KEY:} + private-bucket: ${MINIO_PRIVATE_BUCKET:true} + signed-url-expire-minutes: ${MINIO_SIGNED_URL_EXPIRE_MINUTES:60} + +aliyun: + oss: + enabled: ${ALIYUN_OSS_ENABLED:false} + endpoint: ${ALIYUN_OSS_ENDPOINT:https://oss-cn-chengdu.aliyuncs.com} + region: ${ALIYUN_OSS_REGION:cn-chengdu} + bucket-name: ${ALIYUN_OSS_BUCKET_NAME:jayucloud-sit} + access-key-id: ${ALIYUN_OSS_ACCESS_KEY_ID:} + access-key-secret: ${ALIYUN_OSS_ACCESS_KEY_SECRET:} + signed-url-expire-minutes: ${ALIYUN_OSS_SIGNED_URL_EXPIRE_MINUTES:60} diff --git a/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/gateway.yaml new file mode 100644 index 00000000..7ff5a640 --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/gateway.yaml @@ -0,0 +1,132 @@ +spring: + cloud: + gateway: + routes: + # 前台API路由 + - id: product-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/product/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: product-like-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/product-like/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: shop-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/shop/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: user-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/user/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: comment-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/comment/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: balance-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/balance/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: tag-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/tag/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: file-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/file/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: permission-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/permission/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: coupon-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/coupon/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: cart-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/cart/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: order-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/order/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: wishlist-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/wishlist/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: nail-artist-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/nail-artist/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: legal-agreement-route + uri: lb://jc-artlist-core + predicates: + - Path=/api/legal-agreement/** + filters: + - RewritePath=/api/(?.*), /${remaining} + # 前台API兜底路由,避免 Core 新增模块后 Gateway 未同步导致 404 + - id: frontend-fallback-route + order: 100 + uri: lb://jc-artlist-core + predicates: + - Path=/api/** + filters: + - RewritePath=/api/(?.*), /${remaining} + +fingertip-designer: + security: + jwt: + issuer: fingertip-designer + clock-skew-seconds: 30 + gateway: + whitelist: + - /api/user/login + - /api/user/register + - /api/user/check/** + - /api/user/refresh-token + - /api/user/send-verification-code + - /api/user/phone-login + - /api/user/wechat-mini/** + - /api/user/reset-password-by-phone + - /api/nail-artist/profile/** + - /api/nail-artist/*/availability + - /api/nail-artist/*/reviews + - /api/shop/list + - /api/shop/list/simple + - /api/legal-agreement/current + - /api/legal-agreement/current/** + - /api/health/** + - /api/error + slow-request: + enabled: true + threshold-ms: 300 + log-response-header-request-id: true diff --git a/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/infra.yaml b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/infra.yaml new file mode 100644 index 00000000..5fea2aab --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/infra.yaml @@ -0,0 +1,56 @@ +spring: + redis: + host: ${REDIS_HOST:192.168.10.101} + port: ${REDIS_PORT:6379} + username: ${REDIS_USERNAME:xiaowang} + password: ${REDIS_PASSWORD} + database: ${REDIS_DATABASE:0} + rabbitmq: + addresses: ${RABBITMQ_ADDRESSES:192.168.10.104:5672} + virtual-host: ${RABBITMQ_VHOST} + username: ${RABBITMQ_USERNAME} + password: ${RABBITMQ_PASSWORD} + publisher-confirm-type: correlated + publisher-returns: true + listener: + simple: + acknowledge-mode: manual + auto-startup: true + +database: + business: + jdbc-url: ${BUSINESS_JDBC_URL} + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD} + +object-storage: + primary-provider: ${OBJECT_STORAGE_PRIMARY_PROVIDER:MINIO} + provider-order: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + +minio: + enabled: ${MINIO_ENABLED:true} + endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000} + bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit} + access-key: ${MINIO_ACCESS_KEY} + secret-key: ${MINIO_SECRET_KEY} + +qiniu: + kodo: + bucket-name: ${QINIU_KODO_BUCKET_NAME:jayucloud-sit} + access-key: ${QINIU_KODO_ACCESS_KEY} + secret-key: ${QINIU_KODO_SECRET_KEY} + domain: ${QINIU_KODO_DOMAIN:https://img.yunail.art} + zone: ${QINIU_KODO_ZONE:z2} + private-bucket: ${QINIU_KODO_PRIVATE_BUCKET:true} + +aliyun: + oss: + enabled: ${ALIYUN_OSS_ENABLED:true} + endpoint: ${ALIYUN_OSS_ENDPOINT:https://oss-cn-chengdu.aliyuncs.com} + region: ${ALIYUN_OSS_REGION:cn-chengdu} + bucket-name: ${ALIYUN_OSS_BUCKET_NAME:jayucloud-sit} + access-key-id: ${ALIYUN_OSS_ACCESS_KEY_ID} + access-key-secret: ${ALIYUN_OSS_ACCESS_KEY_SECRET} diff --git a/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/logging.yaml b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/logging.yaml new file mode 100644 index 00000000..83b867a9 --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/logging.yaml @@ -0,0 +1,4 @@ +logging: + level: + root: INFO + com.xiaowang.fingertipdesigner: INFO diff --git a/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/secret.yaml b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/secret.yaml new file mode 100644 index 00000000..e597387b --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-artlist/DEFAULT_GROUP/secret.yaml @@ -0,0 +1,17 @@ +security: + nacos: + username: ${NACOS_USERNAME} + password: ${NACOS_PASSWORD} + database: + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD} + redis: + password: ${REDIS_PASSWORD} + rabbitmq: + username: ${RABBITMQ_USERNAME} + password: ${RABBITMQ_PASSWORD} + +spring: + datasource: + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD} diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/core.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/core.yaml new file mode 100644 index 00000000..c951f94a --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/core.yaml @@ -0,0 +1,138 @@ +spring: + datasource: + url: jdbc:mysql://192.168.10.102:3306/jayucloud_salon?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai + servlet: + multipart: + max-file-size: 5MB + max-request-size: 10MB + jackson: + time-zone: Asia/Shanghai + date-format: yyyy-MM-dd HH:mm:ss + +logging: + pattern: + console: "%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n" + +server: + servlet: + encoding: + charset: UTF-8 + force: true + enabled: true + timezone: Asia/Shanghai + +mybatis: + configuration: + map-underscore-to-camel-case: true + +fingertip-designer: + brand: + message-template-name: ${PLATFORM_MESSAGE_TEMPLATE_NAME:JayuCloud-Salon} + manager-register-shop-description: ${PLATFORM_MANAGER_REGISTER_SHOP_DESCRIPTION:甲屿店务注册店铺} + security: + jwt: + issuer: jayucloud-salon + access-token-expiration-seconds: 7200 + remember-me-access-token-expiration-seconds: 604800 + refresh-token-expiration-seconds: 604800 + clock-skew-seconds: 30 + signature: + enabled: true + window-seconds: 300 + nonce-retention-seconds: 600 + rate-limit: + login: + limit: 10 + window-seconds: 60 + send-code: + limit: 5 + window-seconds: 60 + reset-password: + limit: 5 + window-seconds: 600 + authenticated-write: + limit: 80 + window-seconds: 60 + order-create: + limit: 10 + window-seconds: 60 + cache: + local-max-size: 2048 + product-detail: + local-ttl-seconds: 120 + redis-ttl-seconds: 900 + product-list: + local-ttl-seconds: 60 + redis-ttl-seconds: 300 + product-search: + local-ttl-seconds: 60 + redis-ttl-seconds: 300 + shop: + local-ttl-seconds: 180 + redis-ttl-seconds: 900 + tag: + local-ttl-seconds: 300 + redis-ttl-seconds: 1200 + object-storage-file: + local-ttl-seconds: 300 + redis-ttl-seconds: 1800 + dashboard: + local-ttl-seconds: 30 + redis-ttl-seconds: 90 + slow-request: + enabled: true + threshold-ms: 300 + log-response-header-request-id: true + http-client: + connect-timeout-ms: 3000 + read-timeout-ms: 5000 + connection-request-timeout-ms: 1000 + max-total-connections: 200 + max-connections-per-route: 50 + +object-storage: + provider-order: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + replica-required-providers: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + primary-provider: MINIO + backup-provider: QINIU_KODO,ALIYUN_OSS + signed-url-expire-minutes: 60 + backup-queue-name: jayucloud-salon.file.object-storage.backup.queue + backup-exchange-name: jayucloud-salon.file.object-storage.backup.exchange + backup-routing-key: jayucloud-salon.file.object-storage.backup + backup-retry-batch-limit: 500 + backup-retry-cron: "0 0 2 * * ?" + +qiniu: + kodo: + access-key: ${QINIU_KODO_ACCESS_KEY:} + secret-key: ${QINIU_KODO_SECRET_KEY:} + bucket-name: ${QINIU_KODO_BUCKET_NAME:jayucloud-sit} + domain: ${QINIU_KODO_DOMAIN:https://img.yunail.art} + zone: ${QINIU_KODO_ZONE:z2} + private-bucket: ${QINIU_KODO_PRIVATE_BUCKET:true} + signed-url-expire-minutes: ${QINIU_KODO_SIGNED_URL_EXPIRE_MINUTES:60} + +minio: + enabled: ${MINIO_ENABLED:false} + endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000} + bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit} + access-key: ${MINIO_ACCESS_KEY:} + secret-key: ${MINIO_SECRET_KEY:} + private-bucket: ${MINIO_PRIVATE_BUCKET:true} + signed-url-expire-minutes: ${MINIO_SIGNED_URL_EXPIRE_MINUTES:60} + +aliyun: + oss: + enabled: ${ALIYUN_OSS_ENABLED:false} + endpoint: ${ALIYUN_OSS_ENDPOINT:https://oss-cn-chengdu.aliyuncs.com} + region: ${ALIYUN_OSS_REGION:cn-chengdu} + bucket-name: ${ALIYUN_OSS_BUCKET_NAME:jayucloud-sit} + access-key-id: ${ALIYUN_OSS_ACCESS_KEY_ID:} + access-key-secret: ${ALIYUN_OSS_ACCESS_KEY_SECRET:} + signed-url-expire-minutes: ${ALIYUN_OSS_SIGNED_URL_EXPIRE_MINUTES:60} diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml new file mode 100644 index 00000000..9c91bc17 --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/gateway.yaml @@ -0,0 +1,163 @@ +spring: + cloud: + gateway: + routes: + # 前台API路由 + - id: product-route + uri: lb://jc-salon-core + predicates: + - Path=/api/product/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: product-like-route + uri: lb://jc-salon-core + predicates: + - Path=/api/product-like/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: shop-route + uri: lb://jc-salon-core + predicates: + - Path=/api/shop/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: user-route + uri: lb://jc-salon-core + predicates: + - Path=/api/user/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: comment-route + uri: lb://jc-salon-core + predicates: + - Path=/api/comment/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: balance-route + uri: lb://jc-salon-core + predicates: + - Path=/api/balance/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: tag-route + uri: lb://jc-salon-core + predicates: + - Path=/api/tag/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: file-route + uri: lb://jc-salon-core + predicates: + - Path=/api/file/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: permission-route + uri: lb://jc-salon-core + predicates: + - Path=/api/permission/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: coupon-route + uri: lb://jc-salon-core + predicates: + - Path=/api/coupon/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: cart-route + uri: lb://jc-salon-core + predicates: + - Path=/api/cart/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: order-route + uri: lb://jc-salon-core + predicates: + - Path=/api/order/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: wishlist-route + uri: lb://jc-salon-core + predicates: + - Path=/api/wishlist/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: nail-artist-route + uri: lb://jc-salon-core + predicates: + - Path=/api/nail-artist/** + filters: + - RewritePath=/api/(?.*), /${remaining} + - id: legal-agreement-route + uri: lb://jc-salon-core + predicates: + - Path=/api/legal-agreement/** + filters: + - RewritePath=/api/(?.*), /${remaining} + # 后台管理API路由(/api/admin/** 格式) + - id: admin-api-route + order: -10 + uri: lb://jc-salon-core + predicates: + - Path=/api/admin/** + filters: + - RewritePath=/api/admin/(?.*), /admin/${remaining} + # 后台管理API路由(/admin/api/** 格式) + - id: admin-route + order: -9 + uri: lb://jc-salon-core + predicates: + - Path=/admin/api/** + filters: + - RewritePath=/admin/api/(?.*), /admin/${remaining} + - id: admin-auth-compat-route + order: -8 + uri: lb://jc-salon-core + predicates: + - Path=/admin/auth/** + # 前台API兜底路由,避免 Core 新增模块后 Gateway 未同步导致 404 + - id: frontend-fallback-route + order: 100 + uri: lb://jc-salon-core + predicates: + - Path=/api/** + filters: + - RewritePath=/api/(?.*), /${remaining} + +fingertip-designer: + security: + jwt: + issuer: fingertip-designer + clock-skew-seconds: 30 + gateway: + whitelist: + - /api/user/login + - /api/user/register + - /api/user/check/** + - /api/user/refresh-token + - /api/user/send-verification-code + - /api/user/phone-login + - /api/user/wechat-mini/** + - /api/user/reset-password-by-phone + - /api/nail-artist/profile/** + - /api/nail-artist/*/availability + - /api/nail-artist/*/reviews + - /api/shop/list + - /api/shop/list/simple + - /api/legal-agreement/current + - /api/legal-agreement/current/** + - /api/health/** + - /api/error + - /api/admin/auth/login + - /api/admin/auth/login-shops/** + - /api/admin/auth/refresh + - /api/admin/auth/register + - /admin/auth/login + - /admin/auth/login-shops/** + - /admin/auth/refresh + - /admin/api/auth/login + - /admin/api/auth/login-shops/** + - /admin/api/auth/refresh + slow-request: + enabled: true + threshold-ms: 300 + log-response-header-request-id: true diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/infra.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/infra.yaml new file mode 100644 index 00000000..5fea2aab --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/infra.yaml @@ -0,0 +1,56 @@ +spring: + redis: + host: ${REDIS_HOST:192.168.10.101} + port: ${REDIS_PORT:6379} + username: ${REDIS_USERNAME:xiaowang} + password: ${REDIS_PASSWORD} + database: ${REDIS_DATABASE:0} + rabbitmq: + addresses: ${RABBITMQ_ADDRESSES:192.168.10.104:5672} + virtual-host: ${RABBITMQ_VHOST} + username: ${RABBITMQ_USERNAME} + password: ${RABBITMQ_PASSWORD} + publisher-confirm-type: correlated + publisher-returns: true + listener: + simple: + acknowledge-mode: manual + auto-startup: true + +database: + business: + jdbc-url: ${BUSINESS_JDBC_URL} + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD} + +object-storage: + primary-provider: ${OBJECT_STORAGE_PRIMARY_PROVIDER:MINIO} + provider-order: + - MINIO + - QINIU_KODO + - ALIYUN_OSS + +minio: + enabled: ${MINIO_ENABLED:true} + endpoint: ${MINIO_ENDPOINT:http://192.168.5.15:9000} + bucket-name: ${MINIO_BUCKET_NAME:jayucloud-sit} + access-key: ${MINIO_ACCESS_KEY} + secret-key: ${MINIO_SECRET_KEY} + +qiniu: + kodo: + bucket-name: ${QINIU_KODO_BUCKET_NAME:jayucloud-sit} + access-key: ${QINIU_KODO_ACCESS_KEY} + secret-key: ${QINIU_KODO_SECRET_KEY} + domain: ${QINIU_KODO_DOMAIN:https://img.yunail.art} + zone: ${QINIU_KODO_ZONE:z2} + private-bucket: ${QINIU_KODO_PRIVATE_BUCKET:true} + +aliyun: + oss: + enabled: ${ALIYUN_OSS_ENABLED:true} + endpoint: ${ALIYUN_OSS_ENDPOINT:https://oss-cn-chengdu.aliyuncs.com} + region: ${ALIYUN_OSS_REGION:cn-chengdu} + bucket-name: ${ALIYUN_OSS_BUCKET_NAME:jayucloud-sit} + access-key-id: ${ALIYUN_OSS_ACCESS_KEY_ID} + access-key-secret: ${ALIYUN_OSS_ACCESS_KEY_SECRET} diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/logging.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/logging.yaml new file mode 100644 index 00000000..83b867a9 --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/logging.yaml @@ -0,0 +1,4 @@ +logging: + level: + root: INFO + com.xiaowang.fingertipdesigner: INFO diff --git a/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/secret.yaml b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/secret.yaml new file mode 100644 index 00000000..e597387b --- /dev/null +++ b/nacos/namespaces/sit/jayucloud-salon/DEFAULT_GROUP/secret.yaml @@ -0,0 +1,17 @@ +security: + nacos: + username: ${NACOS_USERNAME} + password: ${NACOS_PASSWORD} + database: + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD} + redis: + password: ${REDIS_PASSWORD} + rabbitmq: + username: ${RABBITMQ_USERNAME} + password: ${RABBITMQ_PASSWORD} + +spring: + datasource: + username: ${BUSINESS_DB_USERNAME} + password: ${BUSINESS_DB_PASSWORD}