Files
serv_benchmark/backend/README.md
gilles soulier c6a8e8e83d feat: Complete MVP implementation of Linux BenchTools
 Features:
- Backend FastAPI complete (25 Python files)
  - 5 SQLAlchemy models (Device, HardwareSnapshot, Benchmark, Link, Document)
  - Pydantic schemas for validation
  - 4 API routers (benchmark, devices, links, docs)
  - Authentication with Bearer token
  - Automatic score calculation
  - File upload support

- Frontend web interface (13 files)
  - 4 HTML pages (Dashboard, Devices, Device Detail, Settings)
  - 7 JavaScript modules
  - Monokai dark theme CSS
  - Responsive design
  - Complete CRUD operations

- Client benchmark script (500+ lines Bash)
  - Hardware auto-detection
  - CPU, RAM, Disk, Network benchmarks
  - JSON payload generation
  - Robust error handling

- Docker deployment
  - Optimized Dockerfile
  - docker-compose with 2 services
  - Persistent volumes
  - Environment variables

- Documentation & Installation
  - Automated install.sh script
  - README, QUICKSTART, DEPLOYMENT guides
  - Complete API documentation
  - Project structure documentation

📊 Stats:
- ~60 files created
- ~5000 lines of code
- Full MVP feature set implemented

🚀 Ready for production deployment!

🤖 Generated with Claude Code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-07 14:46:10 +01:00

2.9 KiB

Linux BenchTools - Backend

Backend API FastAPI pour Linux BenchTools.

Structure

backend/
├── app/
│   ├── api/           # Endpoints API
│   ├── core/          # Configuration et sécurité
│   ├── models/        # Modèles SQLAlchemy
│   ├── schemas/       # Schémas Pydantic
│   ├── db/            # Configuration base de données
│   ├── utils/         # Utilitaires
│   └── main.py        # Application principale
├── data/              # Base SQLite (gitignored)
├── Dockerfile
└── requirements.txt

Installation locale (développement)

# Créer un environnement virtuel
python3 -m venv venv
source venv/bin/activate

# Installer les dépendances
pip install -r requirements.txt

# Définir les variables d'environnement
export API_TOKEN="your-secret-token"
export DATABASE_URL="sqlite:///./backend/data/data.db"
export UPLOAD_DIR="./uploads"

# Lancer le serveur
uvicorn app.main:app --reload --host 0.0.0.0 --port 8007

Endpoints API

Benchmarks

  • POST /api/benchmark - Soumettre un benchmark (auth required)
  • GET /api/benchmarks/{id} - Détails d'un benchmark

Devices

  • GET /api/devices - Liste des devices (pagination + recherche)
  • GET /api/devices/{id} - Détails d'un device
  • GET /api/devices/{id}/benchmarks - Historique benchmarks
  • PUT /api/devices/{id} - Modifier un device
  • GET /api/devices/{id}/links - Liens d'un device
  • POST /api/devices/{id}/links - Ajouter un lien
  • PUT /api/links/{id} - Modifier un lien
  • DELETE /api/links/{id} - Supprimer un lien

Documents

  • GET /api/devices/{id}/docs - Documents d'un device
  • POST /api/devices/{id}/docs - Upload document
  • GET /api/docs/{id}/download - Télécharger document
  • DELETE /api/docs/{id} - Supprimer document

Autres

  • GET /api/health - Health check
  • GET /api/stats - Statistiques globales

Documentation interactive

Une fois le serveur lancé, accédez à :

Variables d'environnement

Variable Description Défaut
API_TOKEN Token d'authentification CHANGE_ME
DATABASE_URL URL de la base SQLite sqlite:///./backend/data/data.db
UPLOAD_DIR Répertoire des uploads ./uploads
CORS_ORIGINS Origins CORS autorisées ["*"]

Authentification

L'API utilise un token Bearer simple pour l'endpoint POST /api/benchmark :

Authorization: Bearer YOUR_API_TOKEN

Base de données

SQLite avec 5 tables principales :

  • devices - Machines
  • hardware_snapshots - Snapshots hardware
  • benchmarks - Résultats de benchmarks
  • manufacturer_links - Liens constructeurs
  • documents - Documents uploadés

Développement

# Linter
flake8 app/

# Format code
black app/

# Type checking
mypy app/