Files
aiotagro-mini/DEPLOYMENT.md
aiotagro 5ccd65cccc
Some checks failed
aagro-ui-admin CI / build (14.x) (push) Has been cancelled
aagro-ui-admin CI / build (16.x) (push) Has been cancelled
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
Initial commit with production configuration and deployment scripts
2025-10-04 18:14:03 +08:00

111 lines
2.5 KiB
Markdown
Raw Permalink 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.

# 项目部署说明
## 配置信息
- 数据库地址: 111.3.47.177:13306
- 数据库用户名: root
- 数据库密码: aiotagro
- 数据库名: vuepro
- Redis地址: 111.3.47.177:16379
- Redis密码: aiotagro
- 部署服务器: 192.168.0.95
- 服务器用户: root
- 服务器密码: aiotagro
- 部署目录: /data/java/aiotagro
## 环境要求
1. 本地环境:
- Maven 3.6+
- Putty工具集(pscp, plink)
2. 远程服务器:
- Java 8+
- 可访问数据库和Redis
## 部署步骤
### 1. 环境准备
1. 确保本地已安装Maven并配置环境变量
2. 下载并安装Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
3. 将Putty安装目录添加到系统PATH环境变量中
### 2. 执行部署
双击运行 `deploy.bat` 脚本即可自动完成以下操作:
1. Maven打包项目
2. 上传jar文件到远程服务器
3. 上传配置文件到远程服务器
4. 在远程服务器上启动应用
### 3. 手动部署(可选)
如果自动部署失败,可以手动执行以下步骤:
```bash
# 1. 打包项目
mvn clean package -Dmaven.test.skip=true
# 2. 找到生成的jar文件
ls aagro-server/target/*.jar
# 3. 上传文件到服务器
scp aagro-server/target/*.jar root@192.168.0.95:/data/java/aiotagro/
scp aagro-server/src/main/resources/application-prod.yaml root@192.168.0.95:/data/java/aiotagro/
# 4. 登录服务器并启动应用
ssh root@192.168.0.95
cd /data/java/aiotagro
nohup java -jar *.jar --spring.profiles.active=prod > app.log 2>&1 &
```
## 配置说明
已创建了 `application-prod.yaml` 配置文件,其中包含:
1. 数据库连接配置:
- 地址: 111.3.47.177:13306
- 数据库名: vuepro
- 用户名: root
- 密码: aiotagro
2. Redis连接配置:
- 地址: 111.3.47.177:16379
- 密码: aiotagro
3. 默认使用prod配置文件启动
## 验证部署
部署完成后,可以通过以下方式验证:
1. 查看应用日志:
```bash
ssh root@192.168.0.95
tail -f /data/java/aiotagro/app.log
```
2. 检查端口是否监听:
```bash
netstat -tuln | grep 48080
```
3. 访问接口:
```
http://192.168.0.95:48080/doc.html
```
## 常见问题
### 1. Maven命令未找到
确保已安装Maven并将其bin目录添加到PATH环境变量中
### 2. pscp命令未找到
确保已安装Putty并将其安装目录添加到PATH环境变量中
### 3. 连接服务器失败
检查网络连接和服务器SSH服务是否正常运行
### 4. 应用启动失败
检查应用日志确认数据库和Redis连接是否正常