docs(deployment): 更新部署文档并添加自动化部署脚本

- 更新了 DEPLOYMENT.md 文档,增加了更多部署细节和说明
- 添加了 Linux 和 Windows 平台的自动化部署脚本
- 更新了 README.md,增加了部署相关说明
- 调整了 .env 文件配置,以适应新的部署流程
- 移除了部分不必要的代码和配置
This commit is contained in:
2025-09-10 14:16:27 +08:00
parent 18fe719f94
commit b2d940e014
114 changed files with 6990 additions and 247 deletions

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jiebanke</groupId>
<artifactId>backend-java</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>gateway-service</artifactId>
<packaging>jar</packaging>
<dependencies>
<!-- Spring Cloud Gateway -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>
<!-- Eureka Client -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<!-- JWT -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,34 @@
package com.jiebanke.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("auth-service", r -> r.path("/api/auth/**")
.uri("lb://auth-service"))
.route("user-service", r -> r.path("/api/users/**")
.uri("lb://user-service"))
.route("travel-service", r -> r.path("/api/travel/**")
.uri("lb://travel-service"))
.route("animal-service", r -> r.path("/api/animals/**")
.uri("lb://animal-service"))
.route("order-service", r -> r.path("/api/orders/**")
.uri("lb://order-service"))
.route("promotion-service", r -> r.path("/api/promotion/**")
.uri("lb://promotion-service"))
.build();
}
}

View File

@@ -0,0 +1,38 @@
server:
port: 8080
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: auth-service
uri: lb://auth-service
predicates:
- Path=/api/auth/**
- id: user-service
uri: lb://user-service
predicates:
- Path=/api/users/**
- id: travel-service
uri: lb://travel-service
predicates:
- Path=/api/travel/**
- id: animal-service
uri: lb://animal-service
predicates:
- Path=/api/animals/**
- id: order-service
uri: lb://order-service
predicates:
- Path=/api/orders/**
- id: promotion-service
uri: lb://promotion-service
predicates:
- Path=/api/promotion/**
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/

View File

@@ -0,0 +1,38 @@
server:
port: 8080
spring:
application:
name: gateway-service
cloud:
gateway:
routes:
- id: auth-service
uri: lb://auth-service
predicates:
- Path=/api/auth/**
- id: user-service
uri: lb://user-service
predicates:
- Path=/api/users/**
- id: travel-service
uri: lb://travel-service
predicates:
- Path=/api/travel/**
- id: animal-service
uri: lb://animal-service
predicates:
- Path=/api/animals/**
- id: order-service
uri: lb://order-service
predicates:
- Path=/api/orders/**
- id: promotion-service
uri: lb://promotion-service
predicates:
- Path=/api/promotion/**
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/