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>
This commit is contained in:
0
backend/app/db/__init__.py
Normal file
0
backend/app/db/__init__.py
Normal file
14
backend/app/db/base.py
Normal file
14
backend/app/db/base.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""
|
||||
Linux BenchTools - Database Base
|
||||
"""
|
||||
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
# Import all models here for Alembic/migrations
|
||||
from app.models.device import Device # noqa
|
||||
from app.models.hardware_snapshot import HardwareSnapshot # noqa
|
||||
from app.models.benchmark import Benchmark # noqa
|
||||
from app.models.manufacturer_link import ManufacturerLink # noqa
|
||||
from app.models.document import Document # noqa
|
||||
31
backend/app/db/init_db.py
Normal file
31
backend/app/db/init_db.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""
|
||||
Linux BenchTools - Database Initialization
|
||||
"""
|
||||
|
||||
import os
|
||||
from app.db.base import Base
|
||||
from app.db.session import engine
|
||||
from app.core.config import settings
|
||||
|
||||
|
||||
def init_db():
|
||||
"""
|
||||
Initialize database:
|
||||
- Create all tables
|
||||
- Create upload directory if it doesn't exist
|
||||
"""
|
||||
# Create upload directory
|
||||
os.makedirs(settings.UPLOAD_DIR, exist_ok=True)
|
||||
|
||||
# Create database directory if using SQLite
|
||||
if "sqlite" in settings.DATABASE_URL:
|
||||
db_path = settings.DATABASE_URL.replace("sqlite:///", "")
|
||||
db_dir = os.path.dirname(db_path)
|
||||
if db_dir:
|
||||
os.makedirs(db_dir, exist_ok=True)
|
||||
|
||||
# Create all tables
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
print(f"✅ Database initialized: {settings.DATABASE_URL}")
|
||||
print(f"✅ Upload directory created: {settings.UPLOAD_DIR}")
|
||||
29
backend/app/db/session.py
Normal file
29
backend/app/db/session.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""
|
||||
Linux BenchTools - Database Session
|
||||
"""
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from app.core.config import settings
|
||||
|
||||
# Create engine
|
||||
engine = create_engine(
|
||||
settings.DATABASE_URL,
|
||||
connect_args={"check_same_thread": False} if "sqlite" in settings.DATABASE_URL else {},
|
||||
echo=False, # Set to True for SQL query logging during development
|
||||
)
|
||||
|
||||
# Create SessionLocal class
|
||||
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||
|
||||
|
||||
# Dependency to get DB session
|
||||
def get_db():
|
||||
"""
|
||||
Database session dependency for FastAPI
|
||||
"""
|
||||
db = SessionLocal()
|
||||
try:
|
||||
yield db
|
||||
finally:
|
||||
db.close()
|
||||
Reference in New Issue
Block a user