irg/Isometquick-server/使用说明.md

4.3 KiB
Raw Blame History

Isometric Room Generator (IRG) 服务管理 - 使用说明

🚀 一键脚本 - irg.sh

这是一个简化的一键服务管理脚本,整合了所有功能。

基本用法

# 进入项目目录
cd Isometquick-server

# 添加执行权限Linux/Mac
chmod +x irg.sh

# 首次使用(自动安装并启动)
./irg.sh

# 或者手动安装
./irg.sh install

服务管理命令

# 启动服务
./irg.sh start

# 停止服务
./irg.sh stop

# 重启服务
./irg.sh restart

# 查看状态
./irg.sh status

# 查看日志
./irg.sh logs

# 实时查看日志
./irg.sh logs -f

# 日志轮转
./irg.sh rotate

# 显示帮助
./irg.sh help

服务状态说明

正常运行时会显示:

  • IRG服务正在运行
  • 端口 8003 正在监听
  • API健康检查通过
  • PID、内存、CPU使用情况

服务地址:

文件说明

  • irg.pid - 进程ID文件
  • /data/Isometquick/logs/isometquick.log - 服务日志文件
  • venv/ - Python虚拟环境目录
  • /data/Isometquick/ - 渲染输出目录

故障排除

  1. 服务启动失败

    ./irg.sh logs
    

    查看错误日志

  2. 端口被占用

    netstat -tlnp | grep 8003
    

    检查端口占用情况

  3. 虚拟环境问题

    rm -rf venv
    ./irg.sh install
    

    重新创建虚拟环境

  4. 权限问题

    sudo chown -R $USER:$USER /data/Isometquick/
    

    修复输出目录权限

完整的部署流程

# 1. 进入项目目录
cd Isometquick-server

# 2. 首次部署(一键完成)
./irg.sh

# 3. 检查状态
./irg.sh status

# 4. 测试API
curl http://localhost:8003/health

日常维护

# 重启服务
./irg.sh restart

# 查看运行状态
./irg.sh status

# 查看最新日志
./irg.sh logs

# 停止服务
./irg.sh stop

# 日志轮转(清理旧日志)
./irg.sh rotate

🧪 测试客户端

使用 test_client.py 测试API功能

# 基本渲染测试
python test_client.py

# 测试不同视图
python test_client.py views

# 测试不同道具类型
python test_client.py props

# 测试房间尺寸调整
python test_client.py dimensions

道具类型说明

  • prop_type: 0 - 无道具
  • prop_type: 1 - 落地窗使用archimesh插件
  • prop_type: 2 - 拱门使用isometric_room_gen插件
  • prop_type: 3 - 门使用archimesh插件

视图类型说明

  • view_type: 1 - 正视图相机位置x=width/2, y=1, z=height
  • view_type: 2 - 侧视图相机位置x=width-1, y=1, z=height

🔍 进程管理

查看进程

# 查看服务进程
ps aux | grep -i irg

# 查看Python进程
ps aux | grep python | grep start.py

# 查看端口占用
netstat -tlnp | grep 8003

手动停止进程

# 通过PID文件停止
if [ -f "irg.pid" ]; then
    kill $(cat irg.pid)
    rm irg.pid
fi

# 强制停止所有相关进程
pkill -f "python.*start.py"

💡 使用建议

  1. 推荐使用 irg.sh - 功能完整且简单易用
  2. 首次使用直接运行 ./irg.sh 会自动安装并启动
  3. 定期重启服务 保持最佳性能
  4. 监控日志文件 及时发现问题
  5. 备份配置文件 避免意外丢失
  6. 使用道具功能 创建更丰富的房间场景

🎯 快速上手

# 一键启动(推荐)
cd Isometquick-server && ./irg.sh

# 检查状态
./irg.sh status

# 测试API
python test_client.py

# 访问API文档
# 浏览器打开: http://localhost:8003/docs

示例API请求

import requests

# 创建渲染任务
request_data = {
    "room": {
        "length": 7.0,      # 房间长度(Y轴)
        "width": 4.0,       # 房间宽度(X轴)
        "height": 3.0,      # 房间高度(Z轴)
        "prop_type": 1      # 1=落地窗
    },
    "camera": {
        "height": 1.3,      # 相机高度
        "view_type": 2,     # 2=侧视图
        "rotation_angle": 45.0
    },
    "render": {
        "resolution_x": 1080,
        "resolution_y": 2400,
        "engine": "eevee"   # 固定为EEVEE
    }
}

response = requests.post("http://localhost:8003/render", json=request_data)
print(response.json())

就这么简单!🎉