xj94bnz3s/out.txt

148 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CCT Cloud Service 部署指南
## 📋 前置要求
- **Java 11** 或更高版本
- **Maven 3.6+** (用于编译)
- **MySQL 8.0+** (数据库)
- **Windows 操作系统** (使用Windows服务部署)
## 🚀 快速部署(3步)
### 第一步:编译打包
双击运行 `1-编译打包.bat`
或者手动执行:
```bash
mvn clean package -DskipTests
copy target\cct-cloud-service-0.0.1-SNAPSHOT.jar 部署\cct-cloud-service.jar
```
### 第二步:安装Windows服务
双击运行 `2-安装服务.bat`
⚠️ **注意**: 需要**管理员权限**
### 第三步:启动服务
双击运行 `3-启动服务.bat`
✅ 完成!访问 http://localhost:8081 验证服务
---
## 📝 配置说明
### 修改数据库配置
编辑 `application-prod.properties`:
```properties
# 修改数据库连接信息
spring.datasource.url=jdbc:mysql://你的数据库地址:3306/cct_cloud?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=你的密码
```
### 修改JWT密钥(生产环境必须修改!)
```properties
jwt.secret=你的生产环境密钥
```
### 修改端口
```properties
server.port=8081
```
---
## 🔧 日常管理脚本
| 脚本 | 功能 | 说明 |
|------|------|------|
| `0-快速启动(前台模式).bat` | 前台启动 | 测试用,关闭窗口即停止 |
| `1-编译打包.bat` | 编译项目 | 生成jar包 |
| `2-安装服务.bat` | 安装Windows服务 | 需要管理员权限 |
| `3-启动服务.bat` | 启动服务 | 启动已安装的服务 |
| `4-停止服务.bat` | 停止服务 | 停止运行中的服务 |
| `5-查看日志.bat` | 查看日志 | 显示最新日志 |
| `6-检查服务状态.bat` | 检查状态 | 查看服务运行状态 |
| `7-卸载服务.bat` | 卸载服务 | 移除Windows服务 |
---
## 📊 服务访问地址
| 服务 | 地址 |
|------|------|
| 主服务 | http://localhost:8081 |
| Swagger文档 | http://localhost:8081/swagger-ui.html |
| API文档 | http://localhost:8081/v3/api-docs |
---
## 🔍 故障排查
### 服务无法启动
1. 检查Java是否安装: `java -version`
2. 查看日志: 运行 `5-查看日志.bat`
3. 检查数据库连接是否正常
4. 检查端口8081是否被占用
### 端口占用
修改 `application-prod.properties` 中的 `server.port`
### 权限问题
确保以**管理员身份**运行安装和卸载脚本
---
## 📁 部署目录结构
```
部署/
├── 0-快速启动(前台模式).bat # 快速测试启动
├── 1-编译打包.bat # 编译打包
├── 2-安装服务.bat # 安装Windows服务
├── 3-启动服务.bat # 启动服务
├── 4-停止服务.bat # 停止服务
├── 5-查看日志.bat # 查看日志
├── 6-检查服务状态.bat # 检查状态
├── 7-卸载服务.bat # 卸载服务
├── application-prod.properties # 生产环境配置
├── cct-cloud-service.xml # WinSW服务配置
├── WinSW.exe # Windows服务包装器(运行时自动复制)
└── cct-cloud-service.jar # 应用jar包(编译后生成)
└── logs/ # 日志目录(自动创建)
```
---
## 🔄 更新部署流程
当代码更新后,按以下步骤更新:
1. 停止服务: `4-停止服务.bat`
2. 重新编译: `1-编译打包.bat`
3. 启动服务: `3-启动服务.bat`
---
## ⚠️ 安全建议
1. **生产环境必须修改JWT密钥**
2. **修改数据库密码为强密码**
3. **配置SSL证书启用HTTPS**
4. **限制数据库访问IP**
5. **定期备份数据库**
---
## 📞 技术支持
如有问题,请查看日志文件或联系技术团队。