Files
security-platform/START_BACKEND_GUIDE.md
BrunoGaoandClaude cff4e4608a feat: 实现配置管理和评分规则功能,完善前后端架构
主要功能更新:
- 新增配置管理模块:支持YAML配置文件的在线编辑、验证和保存
- 实现评分规则管理:支持YAML格式评分配置,简化条件配置流程
- 完善前后端通信:优化API路径配置,解决跨域和网络连接问题
- 新增组件架构:AppContent、ConfigManager、ScoringRules、ThreatGraph等核心组件
- 集成js-yaml库:支持前端YAML格式解析和编辑
- 修复UI渲染问题:解决Naive UI组件空值引用和布局问题

技术改进:
- 动态API地址配置,支持不同网络环境
- 增强错误处理和空值保护
- 优化表格布局和操作按钮排列
- 完善类型定义和接口规范

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-14 08:56:56 +08:00

2.7 KiB

Backend Startup Guide

This guide provides multiple ways to start the AI SOC Analyst backend server.

Quick Start Options

python run_backend.py

Features:

  • ✅ Automatic dependency checking and installation
  • ✅ Creates necessary directories
  • ✅ Smart application detection
  • ✅ Cross-platform compatibility
  • ✅ Enhanced error handling

2. Shell Script (Linux/Mac)

./start_backend.sh

Features:

  • ✅ Virtual environment creation/activation
  • ✅ Dependency management
  • ✅ Colorized output
  • ✅ Environment setup

3. Batch Script (Windows)

start_backend.bat

Features:

  • ✅ Windows-specific optimizations
  • ✅ Virtual environment handling
  • ✅ Error handling with pause

4. Manual Backend Startup

# Navigate to backend directory
cd backend

# Install dependencies
pip install -r requirements.txt

# Start with uvicorn (recommended)
uvicorn app.api_main:app --host 0.0.0.0 --port 8000 --reload

# Or start with Python directly
python app/main.py

5. Simple Development Script

cd backend
python run_dev.py

What These Scripts Do

  1. Environment Setup

    • Create virtual environment (if needed)
    • Install/update Python dependencies
    • Set up PYTHONPATH
  2. Directory Management

    • Create uploads directory
    • Verify project structure
  3. Server Startup

    • Start FastAPI with hot reload
    • Bind to all interfaces (0.0.0.0:8000)
    • Enable automatic code reloading

Access Points

Once started, the backend will be available at:

Troubleshooting

Port Already in Use

# Find process using port 8000
lsof -i :8000

# Kill the process
kill -9 <PID>

Dependencies Issues

# Manual dependency installation
cd backend
pip install -r requirements.txt

# Force reinstall
pip install --force-reinstall -r requirements.txt

Virtual Environment Issues

# Remove existing venv
rm -rf venv

# Run startup script again (will recreate venv)
./start_backend.sh

Development Tips

  • Use python run_backend.py for the most reliable startup experience
  • The server runs with hot reload - changes to code will auto-restart the server
  • Check the console output for any startup errors or warnings
  • Use Ctrl+C to gracefully stop the server

Environment Variables

The startup scripts will automatically handle:

  • PYTHONPATH - Set to include backend directory
  • Virtual environment activation
  • Upload directory creation

For custom configuration, create a .env file in the backend directory.