From eb0fda80f2ef3d78244fccab7f276ed0a484dd4975d04db94356506693be2601 Mon Sep 17 00:00:00 2001 From: attiya <2413103649@qq.com> Date: Tue, 13 Jan 2026 16:54:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E5=85=B3=E9=83=A8=E7=BD=B2=E7=8E=AF?= =?UTF-8?q?=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ebike-gateway/src/main/docker/Dockerfile | 8 +- .../src/main/resources/application-prod.yml | 124 ++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) diff --git a/ebike-gateway/src/main/docker/Dockerfile b/ebike-gateway/src/main/docker/Dockerfile index da1b32d..911c8d6 100644 --- a/ebike-gateway/src/main/docker/Dockerfile +++ b/ebike-gateway/src/main/docker/Dockerfile @@ -2,9 +2,15 @@ # 使用官方Eclipse Temurin镜像作为基础镜像(JDK17兼容Spring Boot 3.x) FROM eclipse-temurin:17-jdk-jammy +# 设置工作目录 +WORKDIR /app + +# 创建日志目录 +RUN mkdir -p /app/logs && chmod 755 /app/logs + VOLUME /opt/docker-images -ADD ebike-gateway-0.0.1-SNAPSHOT.jar /ebike-gateway.jar +ADD ebike-gateway-0.0.1-SNAPSHOT.jar /app/ebike-gateway.jar # 设置JVM参数(根据实际需求调整) diff --git a/ebike-gateway/src/main/resources/application-prod.yml b/ebike-gateway/src/main/resources/application-prod.yml index 473a0f4..d943a88 100644 --- a/ebike-gateway/src/main/resources/application-prod.yml +++ b/ebike-gateway/src/main/resources/application-prod.yml @@ -0,0 +1,124 @@ +server: + port: 10010 +spring: + application: + name: ebike-gateway + servlet: + multipart: + max-file-size: 30MB + max-request-size: 100MB + file-size-threshold: 0B + jackson: + serialization: + write-dates-as-timestamps: false + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + cloud: + nacos: + server-addr: 47.109.141.125:8848 # nacos + username: nacos + password: 970529 + gateway: + # 跨域配置 + globalcors: + cors-configurations: + '[/**]': # 允许跨域访问的资源 + allowedOriginPatterns: "*" #跨域允许来源 + allowedHeaders: "*" + allowedMethods: "*" + allowCredentials: true + maxAge: 360000 + routes: + - id: ebike-gather # 路由标示,必须唯一 + uri: lb://ebike-gather # 路由的目标地址 + predicates: # 路由断言,判断请求是否符合规则 + - Path=/gather/** # 路径断言,判断路径是否是以/wuyu开头,如果是则符合 + - id: ebike-staff + uri: lb://ebike-staff + predicates: + - Path=/staff/** + filters: + - StripPrefix=1 # 去掉/user/部分 + - id: ebike-operations + uri: lb://ebike-operations + predicates: + - Path=/operations/** + filters: + - StripPrefix=1 + - id: ebike-user + uri: lb://ebike-user + predicates: + - Path=/user/** + filters: + - StripPrefix=1 + - id: ebike-payment + uri: lb://ebike-payment + predicates: + - Path=/payment/** + filters: + - StripPrefix=1 + + data: + # redis配置 + redis: + # Redis数据库索引(默认为0) + database: 1 + # Redis服务器地址 + host: 47.109.141.125 + # Redis服务器连接端口 + port: 6379 + # Redis服务器连接密码(默认为空) + password: 970529 + # 连接超时时间 + lettuce: + pool: + # 连接池最大连接数 + max-active: 200 + # 连接池最大阻塞等待时间(使用负值表示没有限制) + max-wait: -1ms + # 连接池中的最大空闲连接 + max-idle: 10 + # 连接池中的最小空闲连接 + min-idle: 0 +############## Sa-Token 配置 (文档: https://sa-token.cc) ############## +sa-token: + # token 名称(同时也是 cookie 名称) + token-name: Authorization + # token 有效期(单位:秒) 默认30天,-1 代表永久有效 + timeout: 2592000 + # token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结 + active-timeout: -1 + # 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录) + is-concurrent: false + # 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token) + is-share: false + # token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik) + token-style: random-32 + # 是否输出操作日志 + is-log: true + # 开启检查的登陆状态的开关 + is-check: true + +# 自定义加解密配置 +cdzy: + gateway: + secure: + request-switch: + enable: false + response-switch: + enable: false + +management: + endpoints: + web: + exposure: + include: health,info + endpoint: + health: + show-details: always + +logging: + file: + name: /app/logs/${spring.application.name}.log + pattern: + dateformat: yyyy-MM-dd HH:mm:ss.SSS # 包含毫秒 \ No newline at end of file