From 70ed2fcae0b98b29821884a486d84c911e66e924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 18 Jun 2026 21:21:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20bugcollect-service?= =?UTF-8?q?=20=E6=94=AF=E6=8C=81=E4=B8=80=E9=94=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docker-compose.yml: 新增 bugcollect-service(profile: bugcollect) - nginx/conf.d/xuqm.conf: 新增 /api/bugcollect/ 代理规则 - .env.example: 新增 bugcollect profile 和 ENABLE_BUGCOLLECT 开关 Co-Authored-By: Claude --- .env.example | 1 + config/nginx/conf.d/xuqm.conf | 10 ++++++++++ docker-compose.yml | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/.env.example b/.env.example index 8bf193f..c55187f 100644 --- a/.env.example +++ b/.env.example @@ -63,6 +63,7 @@ ENABLE_IM=true ENABLE_PUSH=true ENABLE_UPDATE=true ENABLE_LICENSE=true +ENABLE_BUGCOLLECT=true # ============================================================================= # MySQL 配置 diff --git a/config/nginx/conf.d/xuqm.conf b/config/nginx/conf.d/xuqm.conf index b9f835c..270dc32 100644 --- a/config/nginx/conf.d/xuqm.conf +++ b/config/nginx/conf.d/xuqm.conf @@ -57,6 +57,16 @@ server { proxy_read_timeout 3600s; } + # Bug 收集 — 必须在通用 /api/ 之前 + location /api/bugcollect/ { + set $svc bugcollect-service; + proxy_pass http://$svc:9006; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_read_timeout 60s; + } + # License — 必须在通用 /api/ 之前 location /api/license/ { set $svc license-service; diff --git a/docker-compose.yml b/docker-compose.yml index 9c38f6c..e30bd68 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -180,3 +180,31 @@ services: SPRING_DATASOURCE_URL: "jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT:-3306}/${MYSQL_DATABASE:-xuqm_private}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true" SPRING_DATASOURCE_USERNAME: "${MYSQL_USERNAME:-xuqm}" restart: unless-stopped + + # --------------------------------------------------------------------------- + # Bug 收集服务(可选) + # 端口:9006(内部),nginx 代理 /api/bugcollect/* + # 使用独立数据库(xuqm_bugcollect),Flyway 自动建表 + # --------------------------------------------------------------------------- + bugcollect-service: + image: ${REGISTRY}/xuqm-bugcollect-service:${IMAGE_TAG} + profiles: ["bugcollect"] + ports: + - "127.0.0.1:${SVC_PORT_BUGCOLLECT:-11232}:9006" + environment: + JAVA_TOOL_OPTIONS: "-Xms128m -Xmx512m -XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0" + SPRING_PROFILES_ACTIVE: "prod" + SPRING_DATASOURCE_URL: "jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT:-3306}/${BUGCOLLECT_DB:-xuqm_bugcollect}?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true" + SPRING_DATASOURCE_USERNAME: "${MYSQL_USERNAME:-xuqm}" + SPRING_DATASOURCE_PASSWORD: "${MYSQL_PASSWORD}" + SPRING_DATA_REDIS_HOST: "${REDIS_HOST}" + SPRING_DATA_REDIS_PORT: "${REDIS_PORT:-6379}" + SPRING_DATA_REDIS_DATABASE: "${REDIS_DATABASE:-0}" + SERVER_PORT: "9006" + JWT_SECRET: "${JWT_SECRET:-xuqm-bugcollect-jwt-secret}" + SPRING_FLYWAY_IGNORE_MIGRATION_PATTERNS: "*:Missing" + deploy: + resources: + limits: + memory: 512m + restart: unless-stopped