cleanup file structure
This commit is contained in:
@@ -282,9 +282,11 @@ def check_component_health(component_name: str, check_function) -> Dict[str, Any
|
||||
"""
|
||||
try:
|
||||
result = check_function()
|
||||
# Ensure details is always a dictionary
|
||||
details = result if isinstance(result, dict) else {"status": result}
|
||||
return {
|
||||
"status": "healthy",
|
||||
"details": result,
|
||||
"details": details,
|
||||
"last_check": datetime.utcnow().isoformat()
|
||||
}
|
||||
except Exception as e:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Text
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Text, JSON, Boolean
|
||||
from sqlalchemy.sql import func
|
||||
from ..core.database import Base
|
||||
|
||||
@@ -9,6 +9,24 @@ class Project(Base):
|
||||
name = Column(String, unique=True, index=True, nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
status = Column(String, default="active") # e.g., active, completed, archived
|
||||
|
||||
# GitHub Integration Fields
|
||||
github_repo = Column(String, nullable=True) # owner/repo format
|
||||
git_url = Column(String, nullable=True)
|
||||
git_owner = Column(String, nullable=True)
|
||||
git_repository = Column(String, nullable=True)
|
||||
git_branch = Column(String, default="main")
|
||||
|
||||
# Bzzz Configuration
|
||||
bzzz_enabled = Column(Boolean, default=False)
|
||||
ready_to_claim = Column(Boolean, default=False)
|
||||
private_repo = Column(Boolean, default=False)
|
||||
github_token_required = Column(Boolean, default=False)
|
||||
|
||||
# Additional metadata
|
||||
metadata = Column(JSON, nullable=True)
|
||||
tags = Column(JSON, nullable=True)
|
||||
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
|
||||
|
||||
@@ -258,6 +258,11 @@ class ComponentStatus(BaseModel):
|
||||
status: StatusEnum = Field(..., description="Component status")
|
||||
details: Optional[Dict[str, Any]] = Field(None, description="Additional status details")
|
||||
last_check: datetime = Field(default_factory=datetime.utcnow, description="Last status check time")
|
||||
|
||||
class Config:
|
||||
json_encoders = {
|
||||
datetime: lambda v: v.isoformat() if v else None
|
||||
}
|
||||
|
||||
|
||||
class SystemStatusResponse(BaseResponse):
|
||||
|
||||
@@ -459,8 +459,8 @@ class ProjectService:
|
||||
print("DEBUG: Attempting to connect to database...")
|
||||
# Connect to database
|
||||
conn = psycopg2.connect(
|
||||
host="192.168.1.27",
|
||||
port=5433,
|
||||
host="postgres",
|
||||
port=5432,
|
||||
database="hive",
|
||||
user="hive",
|
||||
password="hivepass"
|
||||
|
||||
@@ -116,8 +116,52 @@ CREATE INDEX idx_tasks_status_priority ON tasks(status, priority DESC, created_a
|
||||
CREATE INDEX idx_agent_metrics_timestamp ON agent_metrics(timestamp);
|
||||
CREATE INDEX idx_agent_metrics_agent_time ON agent_metrics(agent_id, timestamp);
|
||||
CREATE INDEX idx_alerts_unresolved ON alerts(resolved, created_at) WHERE resolved = false;
|
||||
CREATE INDEX idx_projects_name ON projects(name);
|
||||
CREATE INDEX idx_projects_bzzz_enabled ON projects(bzzz_enabled) WHERE bzzz_enabled = true;
|
||||
CREATE INDEX idx_projects_ready_to_claim ON projects(ready_to_claim) WHERE ready_to_claim = true;
|
||||
|
||||
-- Project Management for Bzzz Integration
|
||||
CREATE TABLE projects (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(255) UNIQUE NOT NULL,
|
||||
description TEXT,
|
||||
status VARCHAR(50) DEFAULT 'active',
|
||||
github_repo VARCHAR(255),
|
||||
git_url VARCHAR(255),
|
||||
git_owner VARCHAR(255),
|
||||
git_repository VARCHAR(255),
|
||||
git_branch VARCHAR(255) DEFAULT 'main',
|
||||
bzzz_enabled BOOLEAN DEFAULT false,
|
||||
ready_to_claim BOOLEAN DEFAULT false,
|
||||
private_repo BOOLEAN DEFAULT false,
|
||||
github_token_required BOOLEAN DEFAULT false,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Refresh Tokens for Authentication
|
||||
CREATE TABLE refresh_tokens (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
|
||||
token_hash VARCHAR(255) NOT NULL,
|
||||
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Token Blacklist for Security
|
||||
CREATE TABLE token_blacklist (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
token_hash VARCHAR(255) NOT NULL,
|
||||
expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
|
||||
blacklisted_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Sample data
|
||||
INSERT INTO users (email, hashed_password, role) VALUES
|
||||
('admin@hive.local', '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/lewohT6ZErjH.2T.2', 'admin'),
|
||||
('developer@hive.local', '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/lewohT6ZErjH.2T.2', 'developer');
|
||||
|
||||
-- Sample project data
|
||||
INSERT INTO projects (name, description, status, github_repo, git_url, git_owner, git_repository, git_branch, bzzz_enabled, ready_to_claim, private_repo, github_token_required) VALUES
|
||||
('hive', 'Distributed task coordination system with AI agents', 'active', 'anthonyrawlins/hive', 'https://github.com/anthonyrawlins/hive.git', 'anthonyrawlins', 'hive', 'main', true, true, false, false),
|
||||
('bzzz', 'P2P collaborative development coordination system', 'active', 'anthonyrawlins/bzzz', 'https://github.com/anthonyrawlins/bzzz.git', 'anthonyrawlins', 'bzzz', 'main', true, true, false, false);
|
||||
|
||||
@@ -95,35 +95,35 @@ services:
|
||||
- "traefik.http.services.hive-frontend.loadbalancer.passhostheader=true"
|
||||
|
||||
# N8N Workflow Automation
|
||||
n8n:
|
||||
image: n8nio/n8n
|
||||
volumes:
|
||||
- /rust/containers/n8n/data:/home/node/.n8n
|
||||
- /rust/containers/n8n/import:/home/node/import
|
||||
environment:
|
||||
- N8N_REDIS_HOST=redis
|
||||
- N8N_REDIS_PORT=6379
|
||||
- N8N_REDIS_PASSWORD=hivepass
|
||||
- N8N_QUEUE_BULL_REDIS_HOST=redis
|
||||
- N8N_QUEUE_BULL_REDIS_PORT=6379
|
||||
- N8N_QUEUE_BULL_REDIS_PASSWORD=hivepass
|
||||
networks:
|
||||
- hive-network
|
||||
- tengig
|
||||
ports:
|
||||
- 5678:5678
|
||||
deploy:
|
||||
placement:
|
||||
constraints: []
|
||||
# n8n:
|
||||
# image: n8nio/n8n
|
||||
# volumes:
|
||||
# - /rust/containers/n8n/data:/home/node/.n8n
|
||||
# - /rust/containers/n8n/import:/home/node/import
|
||||
# environment:
|
||||
# - N8N_REDIS_HOST=redis
|
||||
# - N8N_REDIS_PORT=6379
|
||||
# - N8N_REDIS_PASSWORD=hivepass
|
||||
# - N8N_QUEUE_BULL_REDIS_HOST=redis
|
||||
# - N8N_QUEUE_BULL_REDIS_PORT=6379
|
||||
# - N8N_QUEUE_BULL_REDIS_PASSWORD=hivepass
|
||||
# networks:
|
||||
# - hive-network
|
||||
# - tengig
|
||||
# ports:
|
||||
# - 5678:5678
|
||||
# deploy:
|
||||
# placement:
|
||||
# constraints: []
|
||||
# - node.hostname == walnut
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.n8n.rule=Host(`n8n.home.deepblack.cloud`)"
|
||||
- "traefik.http.routers.n8n.entrypoints=web-secured"
|
||||
- "traefik.http.routers.n8n.tls.certresolver=letsencryptresolver"
|
||||
- "traefik.http.services.n8n.loadbalancer.server.port=5678"
|
||||
- "traefik.http.services.n8n.loadbalancer.passhostheader=true"
|
||||
- "traefik.docker.network=tengig"
|
||||
# labels:
|
||||
# - "traefik.enable=true"
|
||||
# - "traefik.http.routers.n8n.rule=Host(`n8n.home.deepblack.cloud`)"
|
||||
# - "traefik.http.routers.n8n.entrypoints=web-secured"
|
||||
# - "traefik.http.routers.n8n.tls.certresolver=letsencryptresolver"
|
||||
# - "traefik.http.services.n8n.loadbalancer.server.port=5678"
|
||||
# - "traefik.http.services.n8n.loadbalancer.passhostheader=true"
|
||||
# - "traefik.docker.network=tengig"
|
||||
|
||||
# PostgreSQL Database
|
||||
postgres:
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
"react-router-dom": "^6.28.0",
|
||||
"reactflow": "^11.11.4",
|
||||
"recharts": "^2.8.0",
|
||||
"socket.io-client": "^4.8.1",
|
||||
"socket.io-client": "^4.7.5",
|
||||
"sonner": "^2.0.6",
|
||||
"tailwind-merge": "^2.2.0",
|
||||
"zod": "^3.22.0",
|
||||
|
||||
Reference in New Issue
Block a user