kangda-robot-backend/ruoyi-fastapi-backend/SERVICE_MANAGEMENT.md
haotian 234121a503 ```
feat(ragflow): 添加 RAGFlow 配置支持并优化环境变量加载逻辑

- 在 `.env.prod` 中新增 RAGFlow 相关配置项,包括服务地址和 API Key
- `config/env.py` 中引入 `RAGFlowSettings` 类,继承 `BaseSettings` 以支持配置读取
- 为 `app_docs_url` 等字段添加 Optional 类型标注,提升类型安全性
- 改进 `.env` 文件加载机制,优先从项目根目录读取,并增加手动解析兜底逻辑
- 优化 ragflow controller 异常响应处理,返回更明确的错误信息
```
2025-12-15 11:10:58 +08:00

1.9 KiB

Ruoyi FastAPI Backend Service Management

This project includes scripts to manage the backend application as a systemd service.

Files included:

  • start_backend.sh - Script to start the backend application
  • ruoyi-fastapi-backend.service - Systemd service configuration file
  • install_service.sh - Script to install the service
  • README.md - This file

How to install and use the service:

1. Install the service (as root):

sudo ./install_service.sh

2. Start the service:

sudo systemctl start ruoyi-fastapi-backend

3. Check the service status:

sudo systemctl status ruoyi-fastapi-backend

4. Enable the service to start automatically on boot:

sudo systemctl enable ruoyi-fastapi-backend

5. Additional service management commands:

# Stop the service
sudo systemctl stop ruoyi-fastapi-backend

# Restart the service
sudo systemctl restart ruoyi-fastapi-backend

# Disable auto-start on boot
sudo systemctl disable ruoyi-fastapi-backend

# View service logs
sudo journalctl -u ruoyi-fastapi-backend -f

Configuration:

The service is configured to run as the admin-root user with the development environment by default. To change the environment to production, edit the ruoyi-fastapi-backend.service file and change:

  • ExecStart=/home/admin-root/haotian/康达瑞贝斯机器人后台/kangda-robot-backend/ruoyi-fastapi-backend/start_backend.sh dev to:
  • ExecStart=/home/admin-root/haotian/康达瑞贝斯机器人后台/kangda-robot-backend/ruoyi-fastapi-backend/start_backend.sh prod

Then reload the service with:

sudo systemctl daemon-reload
sudo systemctl restart ruoyi-fastapi-backend

The start_backend.sh script:

  • Activates the fastapi_python conda environment
  • Changes to the project directory
  • Starts the application with the specified environment (dev by default)
  • Can be run directly with: ./start_backend.sh [dev|prod]