Fix frontend URLs for production deployment and resolve database issues
- Update API base URL from localhost to https://api.hive.home.deepblack.cloud - Update WebSocket URL to https://hive.home.deepblack.cloud for proper TLS routing - Remove metadata field from Project model to fix SQLAlchemy conflict - Remove index from JSON expertise column in AgentRole to fix PostgreSQL indexing - Update push script to use local registry instead of Docker Hub - Add Gitea repository support and monitoring endpoints 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
142
backend/migrations/005_add_gitea_repositories.sql
Normal file
142
backend/migrations/005_add_gitea_repositories.sql
Normal file
@@ -0,0 +1,142 @@
|
||||
-- Migration to add Gitea repositories and update existing projects
|
||||
|
||||
-- Add provider field to projects table to distinguish between GitHub and Gitea
|
||||
ALTER TABLE projects ADD COLUMN provider VARCHAR(50) DEFAULT 'github';
|
||||
ALTER TABLE projects ADD COLUMN provider_base_url VARCHAR(255);
|
||||
ALTER TABLE projects ADD COLUMN ssh_port INTEGER DEFAULT 22;
|
||||
|
||||
-- Add Gitea-specific configuration
|
||||
ALTER TABLE projects ADD COLUMN gitea_enabled BOOLEAN DEFAULT false;
|
||||
ALTER TABLE projects ADD COLUMN webhook_secret VARCHAR(255);
|
||||
ALTER TABLE projects ADD COLUMN auto_assignment BOOLEAN DEFAULT true;
|
||||
|
||||
-- Update existing projects to mark them as GitHub
|
||||
UPDATE projects SET provider = 'github', provider_base_url = 'https://github.com' WHERE provider IS NULL;
|
||||
|
||||
-- Add Gitea repositories
|
||||
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,
|
||||
provider,
|
||||
provider_base_url,
|
||||
ssh_port,
|
||||
gitea_enabled,
|
||||
auto_assignment
|
||||
) VALUES
|
||||
(
|
||||
'hive-gitea',
|
||||
'Distributed task coordination system with AI agents (Gitea)',
|
||||
'active',
|
||||
'tony/hive',
|
||||
'ssh://git@192.168.1.113:2222/tony/hive.git',
|
||||
'tony',
|
||||
'hive',
|
||||
'master',
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'gitea',
|
||||
'http://192.168.1.113:3000',
|
||||
2222,
|
||||
true,
|
||||
true
|
||||
),
|
||||
(
|
||||
'bzzz-gitea',
|
||||
'P2P collaborative development coordination system (Gitea)',
|
||||
'active',
|
||||
'tony/bzzz',
|
||||
'ssh://git@192.168.1.113:2222/tony/bzzz.git',
|
||||
'tony',
|
||||
'bzzz',
|
||||
'main',
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
false,
|
||||
'gitea',
|
||||
'http://192.168.1.113:3000',
|
||||
2222,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
-- Create repository_config table for provider-specific configuration
|
||||
CREATE TABLE repository_config (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
project_id INTEGER REFERENCES projects(id) ON DELETE CASCADE,
|
||||
provider VARCHAR(50) NOT NULL,
|
||||
config_data JSONB NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT NOW(),
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Insert default Gitea configuration for our repositories
|
||||
INSERT INTO repository_config (project_id, provider, config_data)
|
||||
SELECT
|
||||
p.id,
|
||||
'gitea',
|
||||
jsonb_build_object(
|
||||
'base_url', p.provider_base_url,
|
||||
'owner', p.git_owner,
|
||||
'repository', p.git_repository,
|
||||
'task_label', 'bzzz-task',
|
||||
'in_progress_label', 'in-progress',
|
||||
'completed_label', 'completed',
|
||||
'base_branch', p.git_branch,
|
||||
'branch_prefix', 'bzzz/task-',
|
||||
'auto_assignment', p.auto_assignment,
|
||||
'ssh_port', p.ssh_port
|
||||
)
|
||||
FROM projects p
|
||||
WHERE p.provider = 'gitea';
|
||||
|
||||
-- Create task assignment log table
|
||||
CREATE TABLE task_assignments (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
project_id INTEGER REFERENCES projects(id),
|
||||
task_number INTEGER NOT NULL,
|
||||
agent_id VARCHAR(255) NOT NULL,
|
||||
agent_role VARCHAR(255),
|
||||
assignment_reason TEXT,
|
||||
status VARCHAR(50) DEFAULT 'assigned', -- assigned, in_progress, completed, failed
|
||||
assigned_at TIMESTAMP DEFAULT NOW(),
|
||||
started_at TIMESTAMP,
|
||||
completed_at TIMESTAMP,
|
||||
results JSONB,
|
||||
error_message TEXT
|
||||
);
|
||||
|
||||
-- Create indexes for task assignments
|
||||
CREATE INDEX idx_task_assignments_project ON task_assignments(project_id);
|
||||
CREATE INDEX idx_task_assignments_agent ON task_assignments(agent_id);
|
||||
CREATE INDEX idx_task_assignments_status ON task_assignments(status);
|
||||
CREATE INDEX idx_task_assignments_task ON task_assignments(project_id, task_number);
|
||||
|
||||
-- Create webhook events table for tracking repository events
|
||||
CREATE TABLE webhook_events (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
project_id INTEGER REFERENCES projects(id),
|
||||
event_type VARCHAR(100) NOT NULL,
|
||||
payload JSONB NOT NULL,
|
||||
processed BOOLEAN DEFAULT false,
|
||||
processed_at TIMESTAMP,
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Create indexes for webhook events
|
||||
CREATE INDEX idx_webhook_events_project ON webhook_events(project_id);
|
||||
CREATE INDEX idx_webhook_events_type ON webhook_events(event_type);
|
||||
CREATE INDEX idx_webhook_events_processed ON webhook_events(processed);
|
||||
CREATE INDEX idx_webhook_events_created ON webhook_events(created_at);
|
||||
30
backend/migrations/006_add_gitea_support.sql
Normal file
30
backend/migrations/006_add_gitea_support.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- Migration 006: Add Gitea and Multi-Provider Support
|
||||
-- This migration adds fields for supporting multiple Git providers like Gitea
|
||||
|
||||
-- Add new columns to projects table
|
||||
ALTER TABLE projects
|
||||
ADD COLUMN IF NOT EXISTS provider VARCHAR(50) DEFAULT 'github';
|
||||
|
||||
ALTER TABLE projects
|
||||
ADD COLUMN IF NOT EXISTS provider_base_url VARCHAR(255) NULL;
|
||||
|
||||
ALTER TABLE projects
|
||||
ADD COLUMN IF NOT EXISTS auto_assignment BOOLEAN DEFAULT true;
|
||||
|
||||
-- Rename metadata column to avoid SQLAlchemy conflict
|
||||
ALTER TABLE projects
|
||||
RENAME COLUMN metadata TO project_metadata;
|
||||
|
||||
-- Update existing records to have default provider
|
||||
UPDATE projects SET provider = 'github' WHERE provider IS NULL;
|
||||
|
||||
-- Create index for provider for better queries
|
||||
CREATE INDEX IF NOT EXISTS idx_projects_provider ON projects(provider);
|
||||
CREATE INDEX IF NOT EXISTS idx_projects_bzzz_enabled ON projects(bzzz_enabled);
|
||||
CREATE INDEX IF NOT EXISTS idx_projects_auto_assignment ON projects(auto_assignment);
|
||||
|
||||
-- Add comments for documentation
|
||||
COMMENT ON COLUMN projects.provider IS 'Git provider type: github, gitea, gitlab, etc.';
|
||||
COMMENT ON COLUMN projects.provider_base_url IS 'Base URL for self-hosted providers like Gitea';
|
||||
COMMENT ON COLUMN projects.auto_assignment IS 'Enable automatic task assignment to agents';
|
||||
COMMENT ON COLUMN projects.project_metadata IS 'Additional project metadata as JSON';
|
||||
Reference in New Issue
Block a user