🚀 Release Hive Platform v1.1 - Complete Authentication & Architecture Overhaul
Major Features: ✅ JWT Bearer Token authentication system with secure token management ✅ API key generation and management with scoped permissions ✅ Complete user management (registration, login, logout, password change) ✅ Frontend authentication components and context integration Backend Architecture Improvements: ✅ CORS configuration via environment variables (CORS_ORIGINS) ✅ Dependency injection pattern for unified coordinator ✅ Database schema fixes with UUID support and SQLAlchemy compliance ✅ Task persistence replaced in-memory storage with database-backed system ✅ Service separation following Single Responsibility Principle ✅ Fixed SQLAlchemy metadata column naming conflicts Infrastructure & Testing: ✅ Comprehensive Jest unit testing and Playwright e2e testing infrastructure ✅ GitHub Actions CI/CD pipeline integration ✅ Enhanced API clients matching PROJECT_PLAN.md specifications ✅ Docker Swarm deployment with proper networking and service connectivity Database & Security: ✅ UUID-based user models with proper validation ✅ Unified database schema with authentication tables ✅ Token blacklisting and refresh token management ✅ Secure password hashing with bcrypt ✅ API key scoping and permissions system API Enhancements: ✅ Authentication endpoints (/api/auth/*) ✅ Task management with database persistence ✅ Enhanced monitoring and health check endpoints ✅ Comprehensive error handling and validation Deployment: ✅ Successfully deployed to Docker Swarm at https://hive.home.deepblack.cloud ✅ All services operational with proper networking ✅ Environment-based configuration support 🛠️ Technical Debt Resolved: - Fixed global coordinator instances with proper dependency injection - Replaced hardcoded CORS origins with environment variables - Unified User model schema conflicts across authentication system - Implemented database persistence for critical task storage - Created comprehensive testing infrastructure This release transforms Hive from a development prototype into a production-ready distributed AI orchestration platform with enterprise-grade authentication, proper architectural patterns, and robust deployment infrastructure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,18 +5,18 @@ from contextlib import asynccontextmanager
|
||||
import json
|
||||
import asyncio
|
||||
import uvicorn
|
||||
import os
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import socketio
|
||||
|
||||
from .core.unified_coordinator_refactored import UnifiedCoordinatorRefactored as UnifiedCoordinator
|
||||
from .core.database import engine, get_db, init_database_with_retry, test_database_connection
|
||||
from .api import agents, workflows, executions, monitoring, projects, tasks, cluster, distributed_workflows, cli_agents, auth
|
||||
from .models.user import Base
|
||||
from .models import agent, project # Import the new agent and project models
|
||||
|
||||
# Global unified coordinator instance
|
||||
unified_coordinator = UnifiedCoordinator()
|
||||
# Global unified coordinator instance (will be initialized in lifespan)
|
||||
unified_coordinator: UnifiedCoordinator = None
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
@@ -36,6 +36,11 @@ async def lifespan(app: FastAPI):
|
||||
from .core.init_db import initialize_database
|
||||
initialize_database()
|
||||
|
||||
# Initialize coordinator instance
|
||||
print("🔧 Initializing unified coordinator...")
|
||||
global unified_coordinator
|
||||
unified_coordinator = UnifiedCoordinator()
|
||||
|
||||
# Test database connection
|
||||
if not test_database_connection():
|
||||
raise Exception("Database connection test failed")
|
||||
@@ -77,20 +82,28 @@ app = FastAPI(
|
||||
lifespan=lifespan
|
||||
)
|
||||
|
||||
# Enhanced CORS configuration for production
|
||||
# Enhanced CORS configuration with environment variable support
|
||||
cors_origins = os.getenv("CORS_ORIGINS", "http://localhost:3000,http://localhost:3001,https://hive.home.deepblack.cloud,http://hive.home.deepblack.cloud")
|
||||
allowed_origins = [origin.strip() for origin in cors_origins.split(",")]
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=[
|
||||
"http://localhost:3000",
|
||||
"http://localhost:3001",
|
||||
"https://hive.home.deepblack.cloud",
|
||||
"http://hive.home.deepblack.cloud"
|
||||
],
|
||||
allow_origins=allowed_origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Dependency injection for unified coordinator
|
||||
def get_coordinator() -> UnifiedCoordinator:
|
||||
"""Dependency injection for getting the unified coordinator instance"""
|
||||
if unified_coordinator is None:
|
||||
raise HTTPException(status_code=503, detail="Coordinator not initialized")
|
||||
return unified_coordinator
|
||||
|
||||
# Import API routers
|
||||
from .api import agents, workflows, executions, monitoring, projects, tasks, cluster, distributed_workflows, cli_agents, auth
|
||||
|
||||
# Include API routes
|
||||
app.include_router(auth.router, prefix="/api/auth", tags=["authentication"])
|
||||
app.include_router(agents.router, prefix="/api", tags=["agents"])
|
||||
@@ -103,8 +116,11 @@ app.include_router(cluster.router, prefix="/api", tags=["cluster"])
|
||||
app.include_router(distributed_workflows.router, tags=["distributed-workflows"])
|
||||
app.include_router(cli_agents.router, tags=["cli-agents"])
|
||||
|
||||
# Set coordinator reference in tasks module
|
||||
tasks.set_coordinator(unified_coordinator)
|
||||
# Override dependency functions in API modules with our coordinator instance
|
||||
agents.get_coordinator = get_coordinator
|
||||
tasks.get_coordinator = get_coordinator
|
||||
distributed_workflows.get_coordinator = get_coordinator
|
||||
cli_agents.get_coordinator = get_coordinator
|
||||
|
||||
# Socket.IO server setup
|
||||
sio = socketio.AsyncServer(
|
||||
|
||||
Reference in New Issue
Block a user