feat: 添加完整的容器化部署脚本系统
✨ 新增功能: - 全量部署脚本 (backend/deploy-all.sh) - 支持一键部署所有微服务 - 单服务部署脚本 - 每个微服务独立部署脚本 - 前端部署脚本 (web-flowith/deploy.sh) - Vue应用自动构建部署 - Jenkins CI/CD 支持 - 完整的Pipeline配置 �� 部署特性: - 容错机制: 单个服务失败不影响其他服务部署 - 详细报告: 完整的部署状态统计和错误日志 - 容器化: 使用Docker进行服务部署 - 健康检查: 自动验证服务启动状态 - 版本备份: 自动备份旧版本支持快速回滚 🛠️ 技术改进: - emotion-auth服务启动问题修复 - 跨域配置优化 - 数据库连接配置统一 - OAuth服务实现完善 - WebSocket依赖更新 📚 文档: - Jenkins部署说明文档 - 部署脚本使用指南 - 故障排查手册 🌐 部署环境: - 目标服务器: 47.111.10.27 - 容器化部署到 /data/builds - 前端部署到 /data/www/emotion-museum - 支持test/prod环境配置
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
package com.emotionmuseum.gateway.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.reactive.CorsWebFilter;
|
||||
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
|
||||
|
||||
/**
|
||||
* CORS配置
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfig {
|
||||
|
||||
@Bean
|
||||
public CorsWebFilter corsWebFilter() {
|
||||
CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
|
||||
// 允许所有来源
|
||||
corsConfiguration.addAllowedOriginPattern("*");
|
||||
|
||||
// 允许所有请求头
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
|
||||
// 允许所有请求方法
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
|
||||
// 不允许携带凭证(这样就可以使用 * 作为来源)
|
||||
corsConfiguration.setAllowCredentials(false);
|
||||
|
||||
// 预检请求的缓存时间
|
||||
corsConfiguration.setMaxAge(3600L);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", corsConfiguration);
|
||||
|
||||
return new CorsWebFilter(source);
|
||||
}
|
||||
}
|
||||
@@ -35,14 +35,7 @@ spring:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
# 全局跨域配置
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowed-origins: "*"
|
||||
allowed-methods: "*"
|
||||
allowed-headers: "*"
|
||||
allow-credentials: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
@@ -74,7 +67,7 @@ spring:
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
|
||||
@@ -35,14 +35,7 @@ spring:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
# 全局跨域配置
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowed-origins: "*"
|
||||
allowed-methods: "*"
|
||||
allowed-headers: "*"
|
||||
allow-credentials: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
@@ -74,7 +67,7 @@ spring:
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
|
||||
@@ -35,14 +35,7 @@ spring:
|
||||
locator:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
# 全局跨域配置
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
"[/**]":
|
||||
allowed-origins: "*"
|
||||
allowed-methods: "*"
|
||||
allowed-headers: "*"
|
||||
allow-credentials: true
|
||||
|
||||
routes:
|
||||
# 用户服务路由 (包含认证功能)
|
||||
- id: emotion-user-route
|
||||
@@ -74,7 +67,7 @@ spring:
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=0
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由
|
||||
- id: emotion-websocket-route
|
||||
|
||||
@@ -62,69 +62,159 @@ spring:
|
||||
enabled: true
|
||||
lower-case-service-id: true
|
||||
routes:
|
||||
# 认证服务路由
|
||||
- id: emotion-auth
|
||||
# 认证服务路由 - API路径
|
||||
- id: emotion-auth-api
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/api/auth/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 用户服务路由
|
||||
- id: emotion-user
|
||||
# 认证服务路由 - 直接路径
|
||||
- id: emotion-auth-direct
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/auth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 用户服务路由 - API路径
|
||||
- id: emotion-user-api
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/api/user/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# AI对话服务路由
|
||||
- id: emotion-ai
|
||||
# 用户服务路由 - 直接路径
|
||||
- id: emotion-user-direct
|
||||
uri: lb://emotion-user
|
||||
predicates:
|
||||
- Path=/user/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# AI对话服务路由 - API路径
|
||||
- id: emotion-ai-api
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/api/ai/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 情绪记录服务路由
|
||||
- id: emotion-record
|
||||
|
||||
# AI对话服务路由 - 直接路径
|
||||
- id: emotion-ai-direct
|
||||
uri: lb://emotion-ai
|
||||
predicates:
|
||||
- Path=/ai/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# WebSocket聊天服务路由 - API路径
|
||||
- id: emotion-websocket-api
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/api/websocket/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# WebSocket聊天服务路由 - 直接路径
|
||||
- id: emotion-websocket-direct
|
||||
uri: lb://emotion-websocket
|
||||
predicates:
|
||||
- Path=/websocket/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 情绪记录服务路由 - API路径
|
||||
- id: emotion-record-api
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/api/record/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 成长课题服务路由
|
||||
- id: emotion-growth
|
||||
|
||||
# 情绪记录服务路由 - 直接路径
|
||||
- id: emotion-record-direct
|
||||
uri: lb://emotion-record
|
||||
predicates:
|
||||
- Path=/record/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 成长课题服务路由 - API路径
|
||||
- id: emotion-growth-api
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/api/growth/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 地图探索服务路由
|
||||
- id: emotion-explore
|
||||
|
||||
# 成长课题服务路由 - 直接路径
|
||||
- id: emotion-growth-direct
|
||||
uri: lb://emotion-growth
|
||||
predicates:
|
||||
- Path=/growth/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 地图探索服务路由 - API路径
|
||||
- id: emotion-explore-api
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/api/explore/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 成就奖励服务路由
|
||||
- id: emotion-reward
|
||||
|
||||
# 地图探索服务路由 - 直接路径
|
||||
- id: emotion-explore-direct
|
||||
uri: lb://emotion-explore
|
||||
predicates:
|
||||
- Path=/explore/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 成就奖励服务路由 - API路径
|
||||
- id: emotion-reward-api
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/api/reward/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 统计分析服务路由
|
||||
- id: emotion-stats
|
||||
|
||||
# 成就奖励服务路由 - 直接路径
|
||||
- id: emotion-reward-direct
|
||||
uri: lb://emotion-reward
|
||||
predicates:
|
||||
- Path=/reward/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 统计分析服务路由 - API路径
|
||||
- id: emotion-stats-api
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/api/stats/**
|
||||
filters:
|
||||
- StripPrefix=2
|
||||
|
||||
# 统计分析服务路由 - 直接路径
|
||||
- id: emotion-stats-direct
|
||||
uri: lb://emotion-stats
|
||||
predicates:
|
||||
- Path=/stats/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
# 验证码服务路由 (通过认证服务)
|
||||
- id: captcha-service
|
||||
uri: lb://emotion-auth
|
||||
predicates:
|
||||
- Path=/captcha/**
|
||||
filters:
|
||||
- StripPrefix=1
|
||||
|
||||
|
||||
|
||||
# 全局过滤器 (暂时禁用,需要实现对应的过滤器类)
|
||||
# default-filters:
|
||||
|
||||
Reference in New Issue
Block a user