docs(test): Add development environment smoke test notes
This commit is contained in:
@@ -0,0 +1,989 @@
|
|||||||
|
# 基于Spring Cloud的高可用在线视频平台项目架构
|
||||||
|
|
||||||
|
## 技术栈选型
|
||||||
|
|
||||||
|
根据2024年最新技术栈和Spring Cloud Alibaba 2023.0.1.0版本,选用以下组件:
|
||||||
|
|
||||||
|
- **框架基础**:
|
||||||
|
- Spring Boot 3.2.4
|
||||||
|
- Spring Cloud 2023.0.1
|
||||||
|
- Spring Cloud Alibaba 2023.0.1.0
|
||||||
|
|
||||||
|
- **核心组件**:
|
||||||
|
- Nacos 2.3.2 (服务注册与配置中心)
|
||||||
|
- Sentinel 1.8.6 (流量控制)
|
||||||
|
- Seata 2.0.0 (分布式事务)
|
||||||
|
- RocketMQ 5.1.4 (消息队列)
|
||||||
|
|
||||||
|
- **其他组件**:
|
||||||
|
- Spring Cloud Gateway (API网关)
|
||||||
|
- OpenFeign (服务调用)
|
||||||
|
- Spring Security + OAuth2 + JWT (安全认证)
|
||||||
|
- MySQL 8.0 (主数据库)
|
||||||
|
- Redis 7.0 (缓存)
|
||||||
|
- MinIO (分布式文件存储)
|
||||||
|
- FFmpeg (视频处理)
|
||||||
|
- Prometheus + Grafana (监控)
|
||||||
|
- Docker + DockerCompose (容器化部署)
|
||||||
|
|
||||||
|
## IntelliJ IDEA 创建步骤
|
||||||
|
|
||||||
|
### 1. 创建父工程 (Maven项目)
|
||||||
|
|
||||||
|
1. 打开IntelliJ IDEA,选择"File" -> "New" -> "Project"
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写项目信息:
|
||||||
|
- GroupId: `com.nuaa.video`
|
||||||
|
- ArtifactId: `video-platform`
|
||||||
|
- Version: `1.0.0`
|
||||||
|
4. 点击"Finish"创建项目
|
||||||
|
|
||||||
|
5. 修改父工程pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>3.2.4</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>video-platform</name>
|
||||||
|
<description>基于Spring Cloud的高可用在线视频平台</description>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<spring-cloud.version>2023.0.1</spring-cloud.version>
|
||||||
|
<spring-cloud-alibaba.version>2023.0.1.0</spring-cloud-alibaba.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring Cloud -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud Alibaba -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||||
|
<version>${spring-cloud-alibaba.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>video-common</module>
|
||||||
|
<module>video-gateway</module>
|
||||||
|
<module>video-auth</module>
|
||||||
|
<module>video-user</module>
|
||||||
|
<module>video-content</module>
|
||||||
|
<module>video-comment</module>
|
||||||
|
<module>video-recommend</module>
|
||||||
|
<module>video-admin</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 创建公共模块 (video-common)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-common`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-common的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Lombok -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Starter Web -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Starter Validation -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud Alibaba Nacos Discovery -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud OpenFeign -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MyBatis Plus -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.5</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MySQL Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>8.0.33</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Redis -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- MinIO -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.minio</groupId>
|
||||||
|
<artifactId>minio</artifactId>
|
||||||
|
<version>8.5.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Hutool工具包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.26</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- JWT -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-api</artifactId>
|
||||||
|
<version>0.12.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-impl</artifactId>
|
||||||
|
<version>0.12.3</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
|
<artifactId>jjwt-jackson</artifactId>
|
||||||
|
<version>0.12.3</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. 创建API网关模块 (video-gateway)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-gateway`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-gateway的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-gateway</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring Cloud Gateway -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud Alibaba Nacos Discovery -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Cloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Sentinel Gateway适配 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot Actuator -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9000
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-gateway
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
gateway:
|
||||||
|
discovery:
|
||||||
|
locator:
|
||||||
|
enabled: true
|
||||||
|
lower-case-service-id: true
|
||||||
|
routes:
|
||||||
|
- id: video-auth
|
||||||
|
uri: lb://video-auth
|
||||||
|
predicates:
|
||||||
|
- Path=/auth/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: video-user
|
||||||
|
uri: lb://video-user
|
||||||
|
predicates:
|
||||||
|
- Path=/user/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: video-content
|
||||||
|
uri: lb://video-content
|
||||||
|
predicates:
|
||||||
|
- Path=/content/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: video-comment
|
||||||
|
uri: lb://video-comment
|
||||||
|
predicates:
|
||||||
|
- Path=/comment/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: video-recommend
|
||||||
|
uri: lb://video-recommend
|
||||||
|
predicates:
|
||||||
|
- Path=/recommend/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
- id: video-admin
|
||||||
|
uri: lb://video-admin
|
||||||
|
predicates:
|
||||||
|
- Path=/admin/**
|
||||||
|
filters:
|
||||||
|
- StripPrefix=1
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8719
|
||||||
|
eager: true
|
||||||
|
scg:
|
||||||
|
fallback:
|
||||||
|
mode: response
|
||||||
|
response-body: '{"code":500,"message":"服务不可用,请稍后再试"}'
|
||||||
|
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`GatewayApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.gateway;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class GatewayApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(GatewayApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 创建认证服务模块 (video-auth)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-auth`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-auth的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-auth</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Security OAuth2 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Security OAuth2 Authorization Server -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-oauth2-authorization-server</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9001
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-auth
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8720
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_auth?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 0
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
||||||
|
jwt:
|
||||||
|
secret: video-platform-secret-key-2024-nuaa
|
||||||
|
expiration: 86400
|
||||||
|
token-header: Authorization
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`AuthApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.auth;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class AuthApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AuthApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. 创建用户服务模块 (video-user)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-user`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-user的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-user</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9002
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-user
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8721
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_user?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 1
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`UserApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.user;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class UserApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(UserApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. 创建内容服务模块 (video-content)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-content`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-content的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-content</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RocketMQ -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.rocketmq</groupId>
|
||||||
|
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||||
|
<version>2.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- FFmpeg -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.bramp.ffmpeg</groupId>
|
||||||
|
<artifactId>ffmpeg</artifactId>
|
||||||
|
<version>0.7.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9003
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-content
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8722
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_content?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 2
|
||||||
|
rocketmq:
|
||||||
|
name-server: localhost:9876
|
||||||
|
producer:
|
||||||
|
group: video-content-group
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
||||||
|
minio:
|
||||||
|
endpoint: http://localhost:9000
|
||||||
|
accessKey: minioadmin
|
||||||
|
secretKey: minioadmin
|
||||||
|
bucketName: video-platform
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`ContentApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.content;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class ContentApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ContentApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. 创建评论服务模块 (video-comment)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-comment`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-comment的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-comment</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9004
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-comment
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8723
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_comment?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 3
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`CommentApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.comment;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class CommentApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(CommentApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. 创建推荐服务模块 (video-recommend)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-recommend`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-recommend的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-recommend</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 机器学习相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.spark</groupId>
|
||||||
|
<artifactId>spark-mllib_2.12</artifactId>
|
||||||
|
<version>3.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 数据计算 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-math3</artifactId>
|
||||||
|
<version>3.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9005
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-recommend
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8724
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_recommend?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 4
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`RecommendApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.recommend;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class RecommendApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(RecommendApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9. 创建管理后台模块 (video-admin)
|
||||||
|
|
||||||
|
1. 右键父工程 -> New -> Module
|
||||||
|
2. 选择"Maven",点击"Next"
|
||||||
|
3. 填写模块信息:
|
||||||
|
- Name: `video-admin`
|
||||||
|
- Parent: `com.nuaa.video:video-platform`
|
||||||
|
4. 点击"Finish"
|
||||||
|
|
||||||
|
5. 修改video-admin的pom.xml:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>video-platform</artifactId>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>video-admin</artifactId>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nuaa.video</groupId>
|
||||||
|
<artifactId>video-common</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
|
```
|
||||||
|
|
||||||
|
6. 创建application.yml:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
server:
|
||||||
|
port: 9006
|
||||||
|
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: video-admin
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
namespace: public
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
sentinel:
|
||||||
|
transport:
|
||||||
|
dashboard: localhost:8080
|
||||||
|
port: 8725
|
||||||
|
eager: true
|
||||||
|
datasource:
|
||||||
|
url: jdbc:mysql://localhost:3306/video_admin?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||||
|
username: root
|
||||||
|
password: root
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
redis:
|
||||||
|
host: localhost
|
||||||
|
port: 6379
|
||||||
|
password:
|
||||||
|
database: 5
|
||||||
|
|
||||||
|
mybatis-plus:
|
||||||
|
mapper-locations: classpath:mapper/*.xml
|
||||||
|
configuration:
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
```
|
||||||
|
|
||||||
|
7. 创建主启动类`AdminApplication.java`:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package com.nuaa.video.admin;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableDiscoveryClient
|
||||||
|
public class AdminApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
## 开发环境步骤
|
||||||
|
|
||||||
|
**安装JDK 17**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Ubuntu/Debian
|
||||||
|
sudo apt install openjdk-17-jdk
|
||||||
|
|
||||||
|
# CentOS/RHEL
|
||||||
|
sudo yum install java-17-openjdk-devel
|
||||||
|
```
|
||||||
|
|
||||||
|
**安装Docker和Docker Compose**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 安装Docker
|
||||||
|
curl -fsSL https://get.docker.com | sh
|
||||||
|
sudo systemctl enable --now docker
|
||||||
|
|
||||||
|
# 安装Docker Compose
|
||||||
|
sudo curl -L "https://github.com/docker/compose/releases/download/v2.23.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||||
|
sudo chmod +x /usr/local/bin/docker-compose
|
||||||
|
```
|
||||||
|
|
||||||
|
**安装MySQL 8.0**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name mysql8 -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=video_auth -v /data/mysql:/var/lib/mysql mysql:8.0 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
|
```
|
||||||
|
|
||||||
|
**安装Redis 7.0**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name redis7 -p 6379:6379 redis:7.0-alpine
|
||||||
|
```
|
||||||
|
|
||||||
|
**RocketMQ 5.1.4**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 先安装NameServer
|
||||||
|
docker run -d --name rmqnamesrv -p 9876:9876 apache/rocketmq:5.1.4 sh mqnamesrv
|
||||||
|
|
||||||
|
# 再安装Broker
|
||||||
|
docker run -d --name rmqbroker --link rmqnamesrv:namesr -p 10909:10909 -p 10911:10911 -e "NAMESRV_ADDR=namesrv:9876" -e "JAVA_OPTS=-Duser.home=/opt" apache/rocketmq:5.1.4 sh mqbroker -c /home/rocketmq/rocketmq-5.1.4/conf/broker.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
**minio**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name minio -p 9002:9000 -p 9001:9001 -v /data/minio:/data -e "MINIO_ROOT_USER=minioadmin" -e "MINIO_ROOT_PASSWORD=minioadmin" quay.io/minio/minio server /data --console-address ":9001"
|
||||||
|
```
|
||||||
|
|
||||||
|
**安装Nacos 2.3.2**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name nacos -p 8848:8848 -p 9848:9848 -p 9849:9849 -e MODE=standalone -e JVM_XMS=512m -e JVM_XMX=512m nacos/nacos-server:v2.3.2
|
||||||
|
```
|
||||||
|
|
||||||
|
**Sentinel Dashboard 1.8.6**
|
||||||
|
|
||||||
|
#### **使用官方发布的 JAR 包自行构建镜像**
|
||||||
|
|
||||||
|
1. **创建 `Dockerfile`**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
FROM eclipse-temurin:8-jre
|
||||||
|
|
||||||
|
# 下载 Sentinel 1.8.6 官方 JAR
|
||||||
|
RUN wget -O /sentinel-dashboard.jar \
|
||||||
|
https://github.com/alibaba/Sentinel/releases/download/1.8.6/sentinel-dashboard-1.8.6.jar
|
||||||
|
|
||||||
|
# 设置时区(可选)
|
||||||
|
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
CMD ["java", "-Dserver.port=8080", "-Dcsp.sentinel.dashboard.server=localhost:8080", "-jar", "/sentinel-dashboard.jar"]
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **构建镜像**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t sentinel-dashboard:1.8.6 .
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **运行容器**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -d --name sentinel -p 8080:8080 sentinel-dashboard:1.8.6
|
||||||
|
```
|
||||||
|
|
||||||
+2
-2
@@ -773,10 +773,10 @@ INSERT IGNORE INTO `admin_user_role` (`admin_id`, `role_id`) VALUES
|
|||||||
|
|
||||||
-- 初始化系统配置
|
-- 初始化系统配置
|
||||||
INSERT IGNORE INTO `admin_system_config` (`config_key`, `config_value`, `description`) VALUES
|
INSERT IGNORE INTO `admin_system_config` (`config_key`, `config_value`, `description`) VALUES
|
||||||
('site_name', '南航在线视频平台', '网站名称'),
|
('site_name', '高可用在线视频平台', '网站名称'),
|
||||||
('site_logo', '/static/logo.png', '网站Logo'),
|
('site_logo', '/static/logo.png', '网站Logo'),
|
||||||
('site_favicon', '/static/favicon.ico', '网站图标'),
|
('site_favicon', '/static/favicon.ico', '网站图标'),
|
||||||
('site_copyright', 'Copyright © 2024 南京航空航天大学', '版权信息'),
|
('site_copyright', 'Copyright © 2024 XXXXXX', '版权信息'),
|
||||||
('video_upload_limit', '1024', '视频上传大小限制(MB)'),
|
('video_upload_limit', '1024', '视频上传大小限制(MB)'),
|
||||||
('video_review_enabled', '1', '视频审核开关(0:关闭,1:开启)'),
|
('video_review_enabled', '1', '视频审核开关(0:关闭,1:开启)'),
|
||||||
('comment_review_enabled', '0', '评论审核开关(0:关闭,1:开启)'),
|
('comment_review_enabled', '0', '评论审核开关(0:关闭,1:开启)'),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ spring:
|
|||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
server-addr: 127.0.0.1:8848
|
server-addr: 5.180.253.115:8848
|
||||||
namespace: public
|
namespace: public
|
||||||
group: DEFAULT_GROUP
|
group: DEFAULT_GROUP
|
||||||
gateway:
|
gateway:
|
||||||
@@ -54,7 +54,7 @@ spring:
|
|||||||
- StripPrefix=1
|
- StripPrefix=1
|
||||||
sentinel:
|
sentinel:
|
||||||
transport:
|
transport:
|
||||||
dashboard: localhost:8080
|
dashboard: 5.180.253.115:8080
|
||||||
port: 8719
|
port: 8719
|
||||||
eager: true
|
eager: true
|
||||||
scg:
|
scg:
|
||||||
|
|||||||
Reference in New Issue
Block a user