diff --git a/config/genesis/genesis_ait_devnet.yaml b/config/genesis/genesis_ait_devnet.yaml new file mode 100644 index 00000000..bc84098d --- /dev/null +++ b/config/genesis/genesis_ait_devnet.yaml @@ -0,0 +1,25 @@ +genesis: + chain_id: "ait-devnet" + chain_type: "main" + purpose: "development" + name: "AITBC Development Network" + description: "Development network for AITBC multi-chain testing" + timestamp: "2026-03-06T18:00:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 10000000 + gas_price: 1000000000 + consensus: + algorithm: "poa" + validators: + - "ait1devproposer000000000000000000000000000000" + accounts: + - address: "aitbc1genesis" + balance: "1000000" + type: "regular" + - address: "aitbc1faucet" + balance: "100000" + type: "faucet" + parameters: + block_time: 5 + max_block_size: 1048576 + min_stake: 1000 diff --git a/config/genesis/genesis_brother_chain_1773403269.yaml b/config/genesis/genesis_brother_chain_1773403269.yaml new file mode 100644 index 00000000..90cb20fe --- /dev/null +++ b/config/genesis/genesis_brother_chain_1773403269.yaml @@ -0,0 +1,29 @@ +genesis: + chain_id: aitbc-brother-chain + chain_type: topic + purpose: brother-connection + name: AITBC Brother Chain + description: Side chain for aitbc1 brother connection + consensus: + algorithm: poa + block_time: 3 + max_validators: 21 + privacy: + visibility: private + access_control: invite-only + require_invitation: true + parameters: + max_block_size: 1048576 + max_gas_per_block: 10000000 + min_gas_price: 1000000000 + accounts: + - address: aitbc1genesis + balance: '2100000000' + type: genesis + - address: aitbc1aitbc1_simple_simple + balance: '500' + type: gift + metadata: + recipient: aitbc1 + gift_from: aitbc_main_chain + contracts: [] diff --git a/config/genesis/genesis_enhanced_devnet.yaml b/config/genesis/genesis_enhanced_devnet.yaml new file mode 100644 index 00000000..38a59483 --- /dev/null +++ b/config/genesis/genesis_enhanced_devnet.yaml @@ -0,0 +1,249 @@ +genesis: + chain_id: "aitbc-enhanced-devnet" + chain_type: "enhanced" + purpose: "development-with-new-features" + name: "AITBC Enhanced Development Network" + description: "Enhanced development network with AI trading, surveillance, analytics, and multi-chain features" + timestamp: "2026-03-07T11:00:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 15000000 + gas_price: 1000000000 + consensus: + algorithm: "poa" + validators: + - "ait1devproposer000000000000000000000000000000" + - "ait1aivalidator00000000000000000000000000000" + - "ait1surveillance0000000000000000000000000000" + accounts: + # Core system accounts + - address: "aitbc1genesis" + balance: "10000000" + type: "genesis" + metadata: + purpose: "Genesis account with initial supply" + features: ["governance", "staking", "validation"] + - address: "aitbc1faucet" + balance: "1000000" + type: "faucet" + metadata: + purpose: "Development faucet for testing" + distribution_rate: "100 per hour" + - address: "aitbc1treasury" + balance: "5000000" + type: "treasury" + metadata: + purpose: "Treasury for ecosystem rewards" + features: ["rewards", "staking", "governance"] + - address: "aitbc1aiengine" + balance: "2000000" + type: "service" + metadata: + purpose: "AI Trading Engine operational account" + service_type: "ai_trading_engine" + features: ["trading", "analytics", "prediction"] + - address: "aitbc1surveillance" + balance: "1500000" + type: "service" + metadata: + purpose: "AI Surveillance service account" + service_type: "ai_surveillance" + features: ["monitoring", "risk_assessment", "compliance"] + - address: "aitbc1analytics" + balance: "1000000" + type: "service" + metadata: + purpose: "Advanced Analytics service account" + service_type: "advanced_analytics" + features: ["real_time_analytics", "reporting", "metrics"] + - address: "aitbc1marketplace" + balance: "2000000" + type: "service" + metadata: + purpose: "Global Marketplace service account" + service_type: "global_marketplace" + features: ["trading", "liquidity", "cross_chain"] + - address: "aitbc1enterprise" + balance: "3000000" + type: "service" + metadata: + purpose: "Enterprise Integration service account" + service_type: "enterprise_api_gateway" + features: ["api_gateway", "multi_tenant", "security"] + - address: "aitbc1multimodal" + balance: "1500000" + type: "service" + metadata: + purpose: "Multi-modal AI service account" + service_type: "multimodal_agent" + features: ["gpu_acceleration", "modality_optimization", "fusion"] + - address: "aitbc1zkproofs" + balance: "1000000" + type: "service" + metadata: + purpose: "Zero-Knowledge Proofs service account" + service_type: "zk_proofs" + features: ["zk_circuits", "verification", "privacy"] + - address: "aitbc1crosschain" + balance: "2000000" + type: "service" + metadata: + purpose: "Cross-chain bridge service account" + service_type: "cross_chain_bridge" + features: ["bridge", "atomic_swap", "reputation"] + # Developer and testing accounts + - address: "aitbc1developer1" + balance: "500000" + type: "developer" + metadata: + purpose: "Primary developer testing account" + permissions: ["full_access", "service_deployment"] + - address: "aitbc1developer2" + balance: "300000" + type: "developer" + metadata: + purpose: "Secondary developer testing account" + permissions: ["testing", "debugging"] + - address: "aitbc1tester" + balance: "200000" + type: "tester" + metadata: + purpose: "Automated testing account" + permissions: ["testing_only"] + # Smart contracts deployed at genesis + contracts: + - name: "AITBCToken" + address: "0x0000000000000000000000000000000000001000" + type: "ERC20" + metadata: + symbol: "AITBC-E" + decimals: 18 + initial_supply: "21000000000000000000000000" + purpose: "Enhanced network token with chain-specific isolation" + - name: "AISurveillanceRegistry" + address: "0x0000000000000000000000000000000000001001" + type: "Registry" + metadata: + purpose: "Registry for AI surveillance patterns and alerts" + features: ["pattern_registration", "alert_management", "risk_scoring"] + - name: "AnalyticsOracle" + address: "0x0000000000000000000000000000000000001002" + type: "Oracle" + metadata: + purpose: "Oracle for advanced analytics data feeds" + features: ["price_feeds", "market_data", "performance_metrics"] + - name: "CrossChainBridge" + address: "0x0000000000000000000000000000000000001003" + type: "Bridge" + metadata: + purpose: "Cross-chain bridge for asset transfers" + features: ["atomic_swaps", "reputation_system", "chain_isolation"] + - name: "EnterpriseGateway" + address: "0x0000000000000000000000000000000000001004" + type: "Gateway" + metadata: + purpose: "Enterprise API gateway with multi-tenant support" + features: ["api_management", "tenant_isolation", "security"] + # Enhanced network parameters + parameters: + block_time: 3 # Faster blocks for enhanced features + max_block_size: 2097152 # 2MB blocks for more transactions + min_stake: 1000 + max_validators: 100 + block_reward: "2000000000000000000" # 2 AITBC per block + stake_reward_rate: "0.05" # 5% annual reward rate + governance_threshold: "0.51" # 51% for governance decisions + surveillance_threshold: "0.75" # 75% for surveillance alerts + analytics_retention: 86400 # 24 hours retention for analytics data + cross_chain_fee: "10000000000000000" # 0.01 AITBC for cross-chain transfers + enterprise_min_stake: 10000 # Higher stake for enterprise validators + # Privacy and security settings + privacy: + access_control: "permissioned" + require_invitation: false + visibility: "public" + encryption: "enabled" + zk_proofs: "enabled" + audit_logging: "enabled" + # Feature flags for new services + features: + ai_trading_engine: true + ai_surveillance: true + advanced_analytics: true + enterprise_integration: true + multi_modal_ai: true + zk_proofs: true + cross_chain_bridge: true + global_marketplace: true + adaptive_learning: true + performance_monitoring: true + # Service endpoints configuration + services: + ai_trading_engine: + port: 8010 + enabled: true + config: + models: ["mean_reversion", "momentum", "arbitrage"] + risk_threshold: 0.02 + max_positions: 100 + ai_surveillance: + port: 8011 + enabled: true + config: + risk_models: ["isolation_forest", "neural_network"] + alert_threshold: 0.85 + retention_days: 30 + advanced_analytics: + port: 8012 + enabled: true + config: + indicators: ["rsi", "macd", "bollinger", "volume"] + update_interval: 60 + history_retention: 86400 + enterprise_gateway: + port: 8013 + enabled: true + config: + max_tenants: 1000 + rate_limit: 1000 + auth_required: true + multimodal_ai: + port: 8014 + enabled: true + config: + gpu_acceleration: true + modalities: ["text", "image", "audio"] + fusion_model: "transformer_based" + zk_proofs: + port: 8015 + enabled: true + config: + circuit_types: ["receipt", "identity", "compliance"] + verification_speed: "fast" + memory_optimization: true + # Network configuration + network: + max_peers: 50 + min_peers: 5 + boot_nodes: + - "ait1bootnode0000000000000000000000000000000:8008" + - "ait1bootnode0000000000000000000000000000001:8008" + propagation_timeout: 30 + sync_mode: "fast" + # Governance settings + governance: + voting_period: 604800 # 7 days + execution_delay: 86400 # 1 day + proposal_threshold: "1000000000000000000000000" # 1000 AITBC + quorum_rate: "0.40" # 40% quorum + emergency_pause: true + multi_signature: true + # Economic parameters + economics: + total_supply: "21000000000000000000000000" # 21 million AITBC + inflation_rate: "0.02" # 2% annual inflation + burn_rate: "0.01" # 1% burn rate + treasury_allocation: "0.20" # 20% to treasury + staking_allocation: "0.30" # 30% to staking rewards + ecosystem_allocation: "0.25" # 25% to ecosystem + team_allocation: "0.15" # 15% to team + community_allocation: "0.10" # 10% to community diff --git a/config/genesis/genesis_enhanced_local.yaml b/config/genesis/genesis_enhanced_local.yaml new file mode 100644 index 00000000..87018136 --- /dev/null +++ b/config/genesis/genesis_enhanced_local.yaml @@ -0,0 +1,68 @@ +description: Enhanced genesis for AITBC with new features +genesis: + chain_id: "aitbc-enhanced-devnet" + chain_type: "topic" + purpose: "development-with-new-features" + name: "AITBC Enhanced Development Network" + description: "Enhanced development network with AI trading, surveillance, analytics, and multi-chain features" + timestamp: "2026-03-07T11:15:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 15000000 + gas_price: 1000000000 + consensus: + algorithm: "poa" + validators: + - "ait1devproposer000000000000000000000000000000" + - "ait1aivalidator00000000000000000000000000000" + - "ait1surveillance0000000000000000000000000000" + accounts: + - address: "aitbc1genesis" + balance: "10000000" + type: "genesis" + - address: "aitbc1faucet" + balance: "1000000" + type: "faucet" + - address: "aitbc1aiengine" + balance: "2000000" + type: "service" + - address: "aitbc1surveillance" + balance: "1500000" + type: "service" + - address: "aitbc1analytics" + balance: "1000000" + type: "service" + - address: "aitbc1marketplace" + balance: "2000000" + type: "service" + - address: "aitbc1enterprise" + balance: "3000000" + type: "service" + parameters: + block_time: 3 + max_block_size: 2097152 + min_stake: 1000 + block_reward: "2000000000000000000" + features: + ai_trading_engine: true + ai_surveillance: true + advanced_analytics: true + enterprise_integration: true + multi_modal_ai: true + zk_proofs: true + cross_chain_bridge: true + global_marketplace: true + adaptive_learning: true + performance_monitoring: true + services: + ai_trading_engine: + port: 8010 + enabled: true + ai_surveillance: + port: 8011 + enabled: true + advanced_analytics: + port: 8012 + enabled: true + enterprise_gateway: + port: 8013 + enabled: true diff --git a/config/genesis/genesis_enhanced_template.yaml b/config/genesis/genesis_enhanced_template.yaml new file mode 100644 index 00000000..13a49e37 --- /dev/null +++ b/config/genesis/genesis_enhanced_template.yaml @@ -0,0 +1,85 @@ +description: Enhanced genesis template for AITBC with new features +genesis: + accounts: + - address: "aitbc1genesis" + balance: "10000000" + - address: "aitbc1faucet" + balance: "1000000" + chain_type: topic + consensus: + algorithm: poa + authorities: + - "ait1devproposer000000000000000000000000000000" + - "ait1aivalidator00000000000000000000000000000" + - "ait1surveillance0000000000000000000000000000" + block_time: 3 + max_validators: 100 + contracts: [] + description: Enhanced development network with AI trading, surveillance, analytics, and multi-chain features + name: AITBC Enhanced Development Network + parameters: + block_reward: '2000000000000000000' + max_block_size: 2097152 + max_gas_per_block: 15000000 + min_gas_price: 1000000000 + min_stake: 1000 + governance_threshold: "0.51" + surveillance_threshold: "0.75" + cross_chain_fee: "10000000000000000" + privacy: + access_control: permissioned + require_invitation: false + visibility: public + encryption: "enabled" + zk_proofs: "enabled" + audit_logging: "enabled" + purpose: development-with-new-features + features: + ai_trading_engine: true + ai_surveillance: true + advanced_analytics: true + enterprise_integration: true + multi_modal_ai: true + zk_proofs: true + cross_chain_bridge: true + global_marketplace: true + adaptive_learning: true + performance_monitoring: true + services: + ai_trading_engine: + port: 8010 + enabled: true + config: + models: ["mean_reversion", "momentum", "arbitrage"] + risk_threshold: 0.02 + max_positions: 100 + ai_surveillance: + port: 8011 + enabled: true + config: + risk_models: ["isolation_forest", "neural_network"] + alert_threshold: 0.85 + retention_days: 30 + advanced_analytics: + port: 8012 + enabled: true + config: + indicators: ["rsi", "macd", "bollinger", "volume"] + update_interval: 60 + history_retention: 86400 + enterprise_gateway: + port: 8013 + enabled: true + config: + max_tenants: 1000 + rate_limit: 1000 + auth_required: true + economics: + total_supply: "21000000000000000000000000" + inflation_rate: "0.02" + burn_rate: "0.01" + treasury_allocation: "0.20" + staking_allocation: "0.30" + ecosystem_allocation: "0.25" + team_allocation: "0.15" + community_allocation: "0.10" diff --git a/config/genesis/genesis_prod.yaml b/config/genesis/genesis_prod.yaml new file mode 100644 index 00000000..adb7f6c8 --- /dev/null +++ b/config/genesis/genesis_prod.yaml @@ -0,0 +1,296 @@ +genesis: + chain_id: ait-mainnet + chain_type: enhanced + purpose: development-with-new-features + name: AITBC Mainnet + description: Enhanced development network with AI trading, surveillance, analytics, + and multi-chain features + timestamp: '2026-03-07T11:00:00Z' + parent_hash: '0x0000000000000000000000000000000000000000000000000000000000000000' + gas_limit: 15000000 + gas_price: 1000000000 + consensus: + algorithm: poa + validators: + - ait1devproposer000000000000000000000000000000 + - ait1aivalidator00000000000000000000000000000 + - ait1surveillance0000000000000000000000000000 + accounts: + - address: aitbc1genesis + balance: '10000000' + type: genesis + metadata: + purpose: Genesis account with initial supply + features: + - governance + - staking + - validation + - address: aitbc1treasury + balance: '5000000' + type: treasury + metadata: + purpose: Treasury for ecosystem rewards + features: + - rewards + - staking + - governance + - address: aitbc1aiengine + balance: '2000000' + type: service + metadata: + purpose: AI Trading Engine operational account + service_type: ai_trading_engine + features: + - trading + - analytics + - prediction + - address: aitbc1surveillance + balance: '1500000' + type: service + metadata: + purpose: AI Surveillance service account + service_type: ai_surveillance + features: + - monitoring + - risk_assessment + - compliance + - address: aitbc1analytics + balance: '1000000' + type: service + metadata: + purpose: Advanced Analytics service account + service_type: advanced_analytics + features: + - real_time_analytics + - reporting + - metrics + - address: aitbc1marketplace + balance: '2000000' + type: service + metadata: + purpose: Global Marketplace service account + service_type: global_marketplace + features: + - trading + - liquidity + - cross_chain + - address: aitbc1enterprise + balance: '3000000' + type: service + metadata: + purpose: Enterprise Integration service account + service_type: enterprise_api_gateway + features: + - api_gateway + - multi_tenant + - security + - address: aitbc1multimodal + balance: '1500000' + type: service + metadata: + purpose: Multi-modal AI service account + service_type: multimodal_agent + features: + - gpu_acceleration + - modality_optimization + - fusion + - address: aitbc1zkproofs + balance: '1000000' + type: service + metadata: + purpose: Zero-Knowledge Proofs service account + service_type: zk_proofs + features: + - zk_circuits + - verification + - privacy + - address: aitbc1crosschain + balance: '2000000' + type: service + metadata: + purpose: Cross-chain bridge service account + service_type: cross_chain_bridge + features: + - bridge + - atomic_swap + - reputation + - address: aitbc1developer1 + balance: '500000' + type: developer + metadata: + purpose: Primary developer testing account + permissions: + - full_access + - service_deployment + - address: aitbc1developer2 + balance: '300000' + type: developer + metadata: + purpose: Secondary developer testing account + permissions: + - testing + - debugging + - address: aitbc1tester + balance: '200000' + type: tester + metadata: + purpose: Automated testing account + permissions: + - testing_only + contracts: + - name: AITBCToken + address: '0x0000000000000000000000000000000000001000' + type: ERC20 + metadata: + symbol: AITBC-E + decimals: 18 + initial_supply: '21000000000000000000000000' + purpose: Enhanced network token with chain-specific isolation + - name: AISurveillanceRegistry + address: '0x0000000000000000000000000000000000001001' + type: Registry + metadata: + purpose: Registry for AI surveillance patterns and alerts + features: + - pattern_registration + - alert_management + - risk_scoring + - name: AnalyticsOracle + address: '0x0000000000000000000000000000000000001002' + type: Oracle + metadata: + purpose: Oracle for advanced analytics data feeds + features: + - price_feeds + - market_data + - performance_metrics + - name: CrossChainBridge + address: '0x0000000000000000000000000000000000001003' + type: Bridge + metadata: + purpose: Cross-chain bridge for asset transfers + features: + - atomic_swaps + - reputation_system + - chain_isolation + - name: EnterpriseGateway + address: '0x0000000000000000000000000000000000001004' + type: Gateway + metadata: + purpose: Enterprise API gateway with multi-tenant support + features: + - api_management + - tenant_isolation + - security + parameters: + block_time: 3 + max_block_size: 2097152 + min_stake: 1000 + max_validators: 100 + block_reward: '2000000000000000000' + stake_reward_rate: '0.05' + governance_threshold: '0.51' + surveillance_threshold: '0.75' + analytics_retention: 86400 + cross_chain_fee: '10000000000000000' + enterprise_min_stake: 10000 + privacy: + access_control: permissioned + require_invitation: false + visibility: public + encryption: enabled + zk_proofs: enabled + audit_logging: enabled + features: + ai_trading_engine: true + ai_surveillance: true + advanced_analytics: true + enterprise_integration: true + multi_modal_ai: true + zk_proofs: true + cross_chain_bridge: true + global_marketplace: true + adaptive_learning: true + performance_monitoring: true + services: + ai_trading_engine: + port: 8010 + enabled: true + config: + models: + - mean_reversion + - momentum + - arbitrage + risk_threshold: 0.02 + max_positions: 100 + ai_surveillance: + port: 8011 + enabled: true + config: + risk_models: + - isolation_forest + - neural_network + alert_threshold: 0.85 + retention_days: 30 + advanced_analytics: + port: 8012 + enabled: true + config: + indicators: + - rsi + - macd + - bollinger + - volume + update_interval: 60 + history_retention: 86400 + enterprise_gateway: + port: 8013 + enabled: true + config: + max_tenants: 1000 + rate_limit: 1000 + auth_required: true + multimodal_ai: + port: 8014 + enabled: true + config: + gpu_acceleration: true + modalities: + - text + - image + - audio + fusion_model: transformer_based + zk_proofs: + port: 8015 + enabled: true + config: + circuit_types: + - receipt + - identity + - compliance + verification_speed: fast + memory_optimization: true + network: + max_peers: 50 + min_peers: 5 + boot_nodes: + - ait1bootnode0000000000000000000000000000000:8008 + - ait1bootnode0000000000000000000000000000001:8008 + propagation_timeout: 30 + sync_mode: fast + governance: + voting_period: 604800 + execution_delay: 86400 + proposal_threshold: '1000000000000000000000000' + quorum_rate: '0.40' + emergency_pause: true + multi_signature: true + economics: + total_supply: '21000000000000000000000000' + inflation_rate: '0.02' + burn_rate: '0.01' + treasury_allocation: '0.20' + staking_allocation: '0.30' + ecosystem_allocation: '0.25' + team_allocation: '0.15' + community_allocation: '0.10' diff --git a/config/genesis/test_multichain_genesis.yaml b/config/genesis/test_multichain_genesis.yaml new file mode 100644 index 00000000..e43a97cb --- /dev/null +++ b/config/genesis/test_multichain_genesis.yaml @@ -0,0 +1,76 @@ +# Multi-Chain Genesis Configuration Example +chains: + ait-devnet: + genesis: + chain_id: "ait-devnet" + chain_type: "main" + purpose: "development" + name: "AITBC Development Network" + description: "Development network for AITBC multi-chain testing" + timestamp: "2026-03-06T18:00:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 10000000 + gas_price: 1000000000 + consensus: + algorithm: "poa" + validators: + - "ait1devproposer000000000000000000000000000000" + accounts: + - address: "aitbc1genesis" + balance: 1000000 + - address: "aitbc1faucet" + balance: 100000 + parameters: + block_time: 5 + max_block_size: 1048576 + min_stake: 1000 + + ait-testnet: + genesis: + chain_id: "ait-testnet" + chain_type: "topic" + purpose: "testing" + name: "AITBC Test Network" + description: "Test network for AITBC multi-chain validation" + timestamp: "2026-03-06T18:00:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 5000000 + gas_price: 2000000000 + consensus: + algorithm: "poa" + validators: + - "ait1testproposer000000000000000000000000000000" + accounts: + - address: "aitbc1testgenesis" + balance: 500000 + - address: "aitbc1testfaucet" + balance: 50000 + parameters: + block_time: 10 + max_block_size: 524288 + min_stake: 500 + + ait-mainnet: + genesis: + chain_id: "ait-mainnet" + chain_type: "main" + purpose: "production" + name: "AITBC Main Network" + description: "Main production network for AITBC" + timestamp: "2026-03-06T18:00:00Z" + parent_hash: "0x0000000000000000000000000000000000000000000000000000000000000000" + gas_limit: 20000000 + gas_price: 500000000 + consensus: + algorithm: "pos" + validators: + - "ait1mainvalidator000000000000000000000000000000" + accounts: + - address: "aitbc1maingenesis" + balance: 2100000000 + - address: "aitbc1mainfaucet" + balance: 1000000 + parameters: + block_time: 15 + max_block_size: 2097152 + min_stake: 10000 diff --git a/config/networks/chain_enhanced_devnet.yaml b/config/networks/chain_enhanced_devnet.yaml new file mode 100644 index 00000000..fe21c0b9 --- /dev/null +++ b/config/networks/chain_enhanced_devnet.yaml @@ -0,0 +1,30 @@ +chain_id: "aitbc-enhanced-devnet" +chain_type: "topic" +purpose: "development-with-new-features" +name: "AITBC Enhanced Devnet" +description: "Enhanced development network with AI trading, surveillance, analytics, and multi-chain features" +consensus: + algorithm: "poa" + authorities: + - "ait1devproposer000000000000000000000000000000" + - "ait1aivalidator00000000000000000000000000000" + - "ait1surveillance0000000000000000000000000000" + block_time: 3 + max_validators: 100 +parameters: + block_reward: "2000000000000000000" + max_block_size: 2097152 + max_gas_per_block: 15000000 + min_gas_price: 1000000000 + min_stake: 1000 +features: + ai_trading_engine: true + ai_surveillance: true + advanced_analytics: true + enterprise_integration: true + multi_modal_ai: true + zk_proofs: true + cross_chain_bridge: true + global_marketplace: true + adaptive_learning: true + performance_monitoring: true diff --git a/config/templates/dummy.yaml b/config/templates/dummy.yaml new file mode 100644 index 00000000..b4a962f4 --- /dev/null +++ b/config/templates/dummy.yaml @@ -0,0 +1,8 @@ +genesis: + chain_type: topic + consensus: + algorithm: pos + name: Test Chain + privacy: + visibility: public + purpose: test diff --git a/fix_inprocess.py b/dev/fixes/fix_inprocess.py similarity index 100% rename from fix_inprocess.py rename to dev/fixes/fix_inprocess.py diff --git a/fix_poa.py b/dev/fixes/fix_poa.py similarity index 100% rename from fix_poa.py rename to dev/fixes/fix_poa.py diff --git a/fix_router.py b/dev/fixes/fix_router.py similarity index 100% rename from fix_router.py rename to dev/fixes/fix_router.py diff --git a/dev/scripts/auto_review.py b/dev/review/auto_review.py similarity index 100% rename from dev/scripts/auto_review.py rename to dev/review/auto_review.py diff --git a/docs/advanced/02_reference/8_blockchain-deployment-summary.md b/docs/advanced/02_reference/8_blockchain-deployment-summary.md index 78039f2e..62f40f74 100644 --- a/docs/advanced/02_reference/8_blockchain-deployment-summary.md +++ b/docs/advanced/02_reference/8_blockchain-deployment-summary.md @@ -26,12 +26,12 @@ Successfully deployed two independent AITBC blockchain nodes on the same server ### Systemd Services ```bash # Node 1 -sudo systemctl status blockchain-node # Consensus node -sudo systemctl status blockchain-rpc # RPC API +systemctl status blockchain-node # Consensus node +systemctl status blockchain-rpc # RPC API # Node 2 -sudo systemctl status blockchain-node-2 # Consensus node -sudo systemctl status blockchain-rpc-2 # RPC API +systemctl status blockchain-node-2 # Consensus node +systemctl status blockchain-rpc-2 # RPC API ``` ### API Endpoints diff --git a/docs/advanced/04_deployment/2_service-naming-convention.md b/docs/advanced/04_deployment/2_service-naming-convention.md index e36d78a6..69bb6654 100644 --- a/docs/advanced/04_deployment/2_service-naming-convention.md +++ b/docs/advanced/04_deployment/2_service-naming-convention.md @@ -36,7 +36,7 @@ These services already had the `aitbc-` prefix: ### Check Service Status ```bash # Site A (via SSH) -ssh aitbc-cascade "systemctl status aitbc-blockchain-node-1.service" +ssh aitbc "systemctl status aitbc-blockchain-node-1.service" # Site B (via SSH) ssh ns3-root "incus exec aitbc -- systemctl status aitbc-blockchain-node-3.service" @@ -45,16 +45,16 @@ ssh ns3-root "incus exec aitbc -- systemctl status aitbc-blockchain-node-3.servi ### Restart Services ```bash # Site A -ssh aitbc-cascade "sudo systemctl restart aitbc-blockchain-node-1.service" +ssh aitbc "systemctl restart aitbc-blockchain-node-1.service" # Site B -ssh ns3-root "incus exec aitbc -- sudo systemctl restart aitbc-blockchain-node-3.service" +ssh ns3-root "incus exec aitbc -- systemctl restart aitbc-blockchain-node-3.service" ``` ### View Logs ```bash # Site A -ssh aitbc-cascade "journalctl -u aitbc-blockchain-node-1.service -f" +ssh aitbc "journalctl -u aitbc-blockchain-node-1.service -f" # Site B ssh ns3-root "incus exec aitbc -- journalctl -u aitbc-blockchain-node-3.service -f" diff --git a/docs/advanced/05_development/DEVELOPMENT_GUIDELINES.md b/docs/advanced/05_development/DEVELOPMENT_GUIDELINES.md index 8bb324af..7190be7b 100644 --- a/docs/advanced/05_development/DEVELOPMENT_GUIDELINES.md +++ b/docs/advanced/05_development/DEVELOPMENT_GUIDELINES.md @@ -11,7 +11,7 @@ - `pyproject.toml` - Python project configuration - `poetry.lock` - Dependency lock file - `pytest.ini` - Test configuration -- `run_all_tests.sh` - Main test runner +- `scripts/testing/run_all_tests.sh` - Main test runner ### Development Scripts → `dev/scripts/` ```bash diff --git a/docs/backend/documented_AITBC_Enhanced_Services__8010-8016__Implementation.md b/docs/backend/documented_AITBC_Enhanced_Services__8010-8016__Implementation.md index 721b2a8e..c05ab8c2 100644 --- a/docs/backend/documented_AITBC_Enhanced_Services__8010-8016__Implementation.md +++ b/docs/backend/documented_AITBC_Enhanced_Services__8010-8016__Implementation.md @@ -35,11 +35,11 @@ This document provides comprehensive technical documentation for aitbc enhanced **🔧 Service Scripts Created:** ```bash -/opt/aitbc/scripts/multimodal_gpu_service.py # Port 8010 -/opt/aitbc/scripts/gpu_multimodal_service.py # Port 8011 -/opt/aitbc/scripts/modality_optimization_service.py # Port 8012 -/opt/aitbc/scripts/adaptive_learning_service.py # Port 8013 -/opt/aitbc/scripts/web_ui_service.py # Port 8016 +/opt/aitbc/scripts/services/multimodal_gpu_service.py # Port 8010 +/opt/aitbc/scripts/services/gpu_multimodal_service.py # Port 8011 +/opt/aitbc/scripts/services/modality_optimization_service.py # Port 8012 +/opt/aitbc/scripts/services/adaptive_learning_service.py # Port 8013 +/opt/aitbc/scripts/services/web_ui_service.py # Port 8016 ``` **🔧 Systemd Services Updated:** diff --git a/docs/beginner/01_getting_started/2_installation.md b/docs/beginner/01_getting_started/2_installation.md index b1f9bccb..822c59e7 100644 --- a/docs/beginner/01_getting_started/2_installation.md +++ b/docs/beginner/01_getting_started/2_installation.md @@ -77,10 +77,10 @@ MEMPOOL_BACKEND=database ## Systemd Services (Production) ```bash -sudo cp systemd/aitbc-*.service /etc/systemd/system/ -sudo systemctl daemon-reload -sudo systemctl enable --now aitbc-coordinator-api -sudo systemctl enable --now aitbc-blockchain-node-1 +cp systemd/aitbc-*.service /etc/systemd/system/ +systemctl daemon-reload +systemctl enable --now aitbc-coordinator-api +systemctl enable --now aitbc-blockchain-node-1 ``` ## Verify diff --git a/docs/beginner/01_getting_started/ENHANCED_SERVICES_IMPLEMENTATION_GUIDE.md b/docs/beginner/01_getting_started/ENHANCED_SERVICES_IMPLEMENTATION_GUIDE.md index a42fb105..62571806 100644 --- a/docs/beginner/01_getting_started/ENHANCED_SERVICES_IMPLEMENTATION_GUIDE.md +++ b/docs/beginner/01_getting_started/ENHANCED_SERVICES_IMPLEMENTATION_GUIDE.md @@ -286,7 +286,7 @@ free -h systemctl status aitbc-adaptive-learning.service --no-pager # Adjust memory limits -sudo systemctl edit aitbc-adaptive-learning.service +systemctl edit aitbc-adaptive-learning.service ``` ### Performance Optimization @@ -304,7 +304,7 @@ export CUDA_LAUNCH_BLOCKING=1 #### 2. Service Tuning ```bash # Adjust service resources -sudo systemctl edit aitbc-multimodal.service +systemctl edit aitbc-multimodal.service # Add: # [Service] # MemoryMax=4G @@ -372,7 +372,7 @@ sudo -u postgres psql aitbc < aitbc-db-backup.sql ./manage_services.sh stop # Emergency restart -sudo systemctl daemon-reload +systemctl daemon-reload ./manage_services.sh start # Check system status diff --git a/docs/beginner/02_project/1_files.md b/docs/beginner/02_project/1_files.md index 963ac43c..92903d99 100644 --- a/docs/beginner/02_project/1_files.md +++ b/docs/beginner/02_project/1_files.md @@ -2,7 +2,7 @@ This document describes the current organization and status of files and folders in the repository. -Last updated: 2026-03-06 +Last updated: 2026-03-25 --- @@ -21,7 +21,18 @@ Last updated: 2026-03-06 | `apps/coordinator-api/tests/test_gpu_marketplace.py` | ✅ Active | 22 GPU marketplace tests (Feb 2026) | | `apps/coordinator-api/tests/test_billing.py` | ✅ Active | 21 billing/usage-tracking tests (Feb 2026) | | `apps/coordinator-api/tests/conftest.py` | ✅ Active | App namespace isolation for coordinator tests | -| `tests/cli/test_cli_integration.py` | ✅ Active | 24 CLI → live coordinator integration tests (Feb 2026) | +| `tests/` | ✅ Active | Test suites (reorganized Mar 2026) | +| `tests/cli/` | ✅ Active | CLI tests (28 files, organized Mar 2026) | +| `tests/integration/` | ✅ Active | Integration tests (28 files, organized Mar 2026) | +| `tests/security/` | ✅ Active | Security tests (5 files, organized Mar 2026) | +| `tests/explorer/` | ✅ Active | Explorer tests (2 files, organized Mar 2026) | +| `tests/websocket/` | ✅ Active | WebSocket tests (2 files, organized Mar 2026) | +| `tests/testing/` | ✅ Active | Performance/testing utilities (25 files, organized Mar 2026) | +| `tests/unit/` | ✅ Active | Unit tests (9 files, organized Mar 2026) | +| `tests/e2e/` | ✅ Active | End-to-end tests (26 files, organized Mar 2026) | +| `tests/docs/` | ✅ Active | Test documentation (5 files, organized Mar 2026) | +| `tests/conftest.py` | ✅ Active | Test configuration (root level) | +| `tests/test_runner.py` | ✅ Active | Test runner (root level) | ### Scripts (`scripts/`) @@ -29,12 +40,16 @@ Last updated: 2026-03-06 |------|--------|-------| | `scripts/aitbc-cli.sh` | ✅ Active | Main CLI tool, heavily used | | `scripts/dev/gpu/gpu_miner_host.py` | ✅ Active | Production GPU miner, standardized (Mar 2026) | -| `scripts/deploy/` | ✅ Active | Deployment scripts (35 files) | -| `scripts/deploy/deploy-multimodal-services.sh` | ✅ Active | Environment-aware multimodal deployment (Mar 2026) | -| `scripts/verify-codebase-update.sh` | ✅ Active | Automated codebase verification (Mar 2026) | -| `scripts/service/` | ✅ Active | Service management | -| `scripts/dev_services.sh` | ✅ Active | Local development | -| `scripts/testing/` | ✅ Active | Test scripts (moved from root, 13 files) | +| `scripts/services/` | ✅ Active | Service files (5 FastAPI services, moved Mar 2026) | +| `scripts/deployment/` | ✅ Active | Deployment scripts (35 files, organized Mar 2026) | +| `scripts/testing/` | ✅ Active | Test scripts (20 files, organized Mar 2026) | +| `scripts/monitoring/` | ✅ Active | Monitoring scripts (3 files, organized Mar 2026) | +| `scripts/development/` | ✅ Active | Development scripts (6 files, organized Mar 2026) | +| `scripts/utils/` | ✅ Active | Utility scripts (40 files, organized Mar 2026) | +| `scripts/manage-services.sh` | ✅ Active | Main service management script (updated Mar 2026) | +| `scripts/README.md` | ✅ Active | Scripts documentation | +| `scripts/deploy/` | ✅ Active | Legacy deployment scripts (27 files) | +| `scripts/gpu/` | ✅ Active | GPU service scripts (9 files, moved to services/) | ### Infrastructure (`infra/`, `systemd/`) @@ -65,7 +80,10 @@ Last updated: 2026-03-06 | Path | Status | Notes | |------|--------|-------| -| `docs/1_project/` | ✅ Active | Project management docs (restructured) | +| `docs/1_project/` | ✅ Active | Project management docs (updated Mar 2026) | +| `docs/1_project/aitbc.md` | ✅ Active | Secondary server deployment guide (updated Mar 2026) | +| `docs/1_project/aitbc1.md` | ✅ Active | Primary server deployment guide (updated Mar 2026) | +| `docs/1_project/3_infrastructure.md` | ✅ Active | Infrastructure documentation (updated Mar 2026) | | `docs/infrastructure/` | ✅ Active | Infrastructure documentation (Mar 2026) | | `docs/infrastructure/codebase-update-summary.md` | ✅ Active | Comprehensive standardization summary (Mar 2026) | | `docs/DOCS_WORKFLOW_COMPLETION_SUMMARY.md` | ✅ Active | Documentation updates completion (Mar 2026) | @@ -259,11 +277,26 @@ These empty folders are intentional scaffolding for planned future work per the - **Workflows documented** for repeatable processes - **File organization prevention** system implemented -### ✅ CLI Development Environment Optimization (March 6, 2026) -- **CLI development tools** moved from `cli-dev` to `dev/cli` -- **Centralized development** environment in unified `/dev/` structure -- **Improved project organization** with reduced root-level clutter -- **Backup system** implemented with proper git exclusion +### ✅ Complete Scripts and Tests Organization (March 25, 2026) +- **Scripts organized** by purpose into 6 categories (services, deployment, testing, monitoring, development, utils) +- **Test files organized** by function into 9 categories (cli, integration, security, explorer, websocket, testing, unit, e2e, docs) +- **Service scripts** moved to dedicated `scripts/services/` folder +- **Documentation updated** to reflect new file locations +- **No codebase rewrites** needed - all paths already properly configured + +### ✅ Server Architecture Updates (March 25, 2026) +- **aitbc1** established as primary server (https://aitbc1.bubuit.net) with reverse proxy role +- **aitbc** established as secondary server (https://aitbc.bubuit.net) with application services +- **SSH access** simplified to `ssh aitbc` and `ssh aitbc1` (root login, no sudo needed) +- **Deployment guides** updated to reflect new primary/secondary architecture +- **Infrastructure documentation** updated for two-server setup + +### ✅ Documentation Standardization (March 25, 2026) +- **All sudo references** removed from systemctl commands (root access) +- **SSH references** updated to use new server names +- **Service paths** updated in documentation to reflect new organization +- **12 documentation files** updated across the codebase +- **Consistent command patterns** applied throughout ### ✅ Explorer Architecture Simplification (March 6, 2026) - **TypeScript explorer** merged into Python blockchain-explorer @@ -319,12 +352,30 @@ aitbc/ │ ├── py/aitbc-sdk/ # Python SDK │ └── solidity/aitbc-token/# ERC-20 token contract ├── plugins/ # ✅ Keep (ollama) -├── scripts/ # ✅ Keep - organized by purpose -│ ├── deploy/ # ✅ Deployment scripts (35 files) -│ ├── dev/ # ✅ Development scripts -│ └── testing/ # ✅ Test scripts +├── scripts/ # ✅ Scripts organized by purpose (Mar 2026) +│ ├── services/ # ✅ Service files (5 FastAPI services) +│ ├── deployment/ # ✅ Deployment scripts (35 files) +│ ├── testing/ # ✅ Test scripts (20 files) +│ ├── monitoring/ # ✅ Monitoring scripts (3 files) +│ ├── development/ # ✅ Development scripts (6 files) +│ ├── utils/ # ✅ Utility scripts (40 files) +│ ├── deploy/ # ✅ Legacy deployment scripts (27 files) +│ ├── gpu/ # ✅ GPU service scripts (9 files) +│ ├── manage-services.sh # ✅ Main service management script +│ └── README.md # ✅ Scripts documentation ├── systemd/ # ✅ Systemd service units (19+ files) -├── tests/ # ✅ Test suites +├── tests/ # ✅ Test suites organized by function (Mar 2026) +│ ├── cli/ # ✅ CLI tests (28 files) +│ ├── integration/ # ✅ Integration tests (28 files) +│ ├── security/ # ✅ Security tests (5 files) +│ ├── explorer/ # ✅ Explorer tests (2 files) +│ ├── websocket/ # ✅ WebSocket tests (2 files) +│ ├── testing/ # ✅ Performance/testing utilities (25 files) +│ ├── unit/ # ✅ Unit tests (9 files) +│ ├── e2e/ # ✅ End-to-end tests (26 files) +│ ├── docs/ # ✅ Test documentation (5 files) +│ ├── conftest.py # ✅ Test configuration +│ └── test_runner.py # ✅ Test runner ├── website/ # ✅ Public website and HTML docs ├── dev-utils/ # ✅ Development utilities (legacy) ├── data/ # ✅ Runtime data (gitignored) @@ -335,12 +386,14 @@ aitbc/ This structure represents the current clean state of the AITBC repository with all essential components organized for optimal development and deployment workflows. The March 2026 standardization effort has resulted in: - **100% service standardization** across all systemd services -- **Improved file organization** with proper dev/ structure +- **Complete scripts and tests organization** by purpose and function +- **Updated server architecture** with primary/secondary server setup - **Enhanced documentation** with comprehensive infrastructure guides - **Automated verification tools** for maintaining standards - **Production-ready infrastructure** with all services operational - **Optimized CLI development** with centralized dev/cli environment - **Agent-first architecture** with simplified explorer service - **Comprehensive backup system** with proper git exclusion +- **Standardized SSH access** with root privileges and no sudo requirements **Note**: Redundant `apps/logs/` directory removed - central `logs/` directory at root level is used for all logging. Redundant `assets/` directory removed - Firefox extension assets are properly organized in `extensions/aitbc-wallet-firefox/`. CLI development environment moved from `cli-dev` to `dev/cli` for better organization. Explorer TypeScript source merged into Python service and backed up. diff --git a/docs/beginner/02_project/2_roadmap.md b/docs/beginner/02_project/2_roadmap.md index a0878818..c8baed4c 100644 --- a/docs/beginner/02_project/2_roadmap.md +++ b/docs/beginner/02_project/2_roadmap.md @@ -110,6 +110,26 @@ This roadmap aggregates high-priority tasks derived from the bootstrap specifica - ✅ Performance validation against deployment report targets - ✅ Complete documentation and usage guides +## Stage 28 — Project File Organization & Documentation Updates [COMPLETED: 2026-03-25] + +- **Root Directory Cleanup** + - ✅ Move 60+ loose files from root to proper subdirectories + - ✅ Organize development scripts into `dev/review/`, `dev/fixes/`, `scripts/testing/` + - ✅ Organize configuration files into `config/genesis/`, `config/networks/`, `config/templates/` + - ✅ Move documentation to `docs/development/`, `docs/deployment/`, `docs/project/` + - ✅ Organize temporary files into `temp/backups/`, `temp/patches/`, `logs/qa/` + +- **File Organization Workflow** + - ✅ Create `/organize-project-files` workflow for systematic file management + - ✅ Implement dependency analysis to prevent codebreak from file moves + - ✅ Establish categorization rules for different file types + - ✅ Verify essential root files remain (configuration, documentation, system files) + +- **Documentation Updates** + - ✅ Update project completion status in `docs/1_project/5_done.md` + - ✅ Reflect file organization milestone in roadmap documentation + - ✅ Ensure all documentation references point to correct file locations + ## Current Status: Agent-First Transformation Complete **Milestone Achievement**: Successfully transformed AITBC to agent-first architecture with comprehensive CLI tools, enhanced services deployment, and complete end-to-end testing framework. All 22 commands from README are fully implemented with complete test coverage and documentation. diff --git a/docs/beginner/02_project/3_infrastructure.md b/docs/beginner/02_project/3_infrastructure.md index 26ef6fee..75e39502 100644 --- a/docs/beginner/02_project/3_infrastructure.md +++ b/docs/beginner/02_project/3_infrastructure.md @@ -4,21 +4,21 @@ ## Overview -Two-tier architecture: **incus host (at1)** runs the reverse proxy with SSL termination, forwarding all `aitbc.bubuit.net` traffic to the **aitbc container** which runs nginx + all services. **Updated for port logic 8000+ implementation with unified numbering scheme and production-ready codebase.** +Two-tier architecture: **aitbc1 primary server** (https://aitbc1.bubuit.net) and **aitbc secondary server** (https://aitbc.bubuit.net) with **aitbc1 as reverse proxy** forwarding all traffic to aitbc container services. **Updated for port logic 8000+ implementation with unified numbering scheme and production-ready codebase.** ``` -Internet → aitbc.bubuit.net (HTTPS :443) +Internet → aitbc1.bubuit.net (HTTPS :443) → aitbc.bubuit.net │ ▼ ┌──────────────────────────────────────────────┐ -│ Incus Host (at1 / localhost) │ +│ aitbc1 Primary Server (Reverse Proxy) │ │ Nginx reverse proxy (:443 SSL → :80) │ │ Config: /etc/nginx/sites-available/ │ │ aitbc-proxy.conf │ │ │ │ ┌────────────────────────────────────────┐ │ -│ │ Container: aitbc (10.1.223.1) │ │ -│ │ Access: ssh aitbc-cascade │ │ +│ │ Container: aitbc (aitbc server) │ │ +│ │ Access: ssh aitbc │ │ │ │ OS: Debian 13 Trixie │ │ │ │ Node.js: 24+ │ │ │ │ Python: 3.13.5+ │ │ @@ -170,8 +170,8 @@ On at1, `/opt/aitbc` uses individual symlinks to the Windsurf project directorie sc-status aitbc-blockchain-node.service aitbc-blockchain-rpc.service aitbc-gpu-miner.service aitbc-mock-coordinator.service # Start services -sudo systemctl start aitbc-mock-coordinator.service -sudo systemctl start aitbc-blockchain-node.service +systemctl start aitbc-mock-coordinator.service +systemctl start aitbc-blockchain-node.service # Check logs journalctl -u aitbc-mock-coordinator --no-pager -n 20 @@ -260,7 +260,7 @@ server { ### Access ```bash -ssh aitbc-cascade # Direct SSH to container +ssh aitbc # Direct SSH to aitbc server ``` **GPU Access**: No GPU passthrough. All GPU workloads must run on **at1** (Windsurf development host), not inside incus containers. @@ -378,16 +378,26 @@ All Python services in the AITBC container run on **Python 3.13.5** with isolate # Note: Standardized /opt/aitbc structure for all services ``` -**Verification Commands:** +**Minimum Default Verification Commands:** ```bash -ssh aitbc-cascade "python3 --version" # Should show Python 3.13.5 -ssh aitbc-cascade "node --version" # Should show v24.14.x -ssh aitbc-cascade "npm --version" # Should show compatible version -ssh aitbc-cascade "ls -la /opt/*/.venv/bin/python" # Check venv symlinks -ssh aitbc-cascade "curl -s http://127.0.0.1:8000/v1/health" # Coordinator API health +# From aitbc1 primary server +ssh aitbc "python3 --version" # Should show Python 3.13.5 +ssh aitbc "node --version" # Should show v24.14.x +ssh aitbc "npm --version" # Should show compatible version +ssh aitbc "ls -la /opt/*/.venv/bin/python" # Check venv symlinks +ssh aitbc "curl -s http://127.0.0.1:8000/v1/health" # Coordinator API health curl -s https://aitbc.bubuit.net/api/v1/health # External API access ``` +**SSH Access:** +```bash +# From aitbc1 to aitbc (secondary server) +ssh aitbc + +# From aitbc to aitbc1 (primary server) +ssh aitbc1 +``` + ### Nginx Routes (container) Config: `/etc/nginx/sites-enabled/aitbc` @@ -549,25 +559,25 @@ curl http://aitbc.keisanki.net/rpc/head # Node 3 RPC (port 8003) ### Deploying to Container ```bash # Push website files -scp -r website/* aitbc-cascade:/var/www/aitbc.bubuit.net/ +scp -r website/* aitbc:/var/www/aitbc.bubuit.net/ # Push app updates (blockchain-explorer serves its own interface) # No separate deployment needed - blockchain-explorer handles both API and UI # Restart a service -ssh aitbc-cascade "systemctl restart coordinator-api" +ssh aitbc "systemctl restart coordinator-api" ``` ## Health Checks ```bash -# From at1 (via container) -ssh aitbc-cascade "curl -s http://localhost:8000/v1/health" -ssh aitbc-cascade "curl -s http://localhost:8003/rpc/head | jq .height" +# From aitbc1 (via aitbc server) +ssh aitbc "curl -s http://localhost:8000/v1/health" +ssh aitbc "curl -s http://localhost:8003/rpc/head | jq .height" # Test enhanced services -ssh aitbc-cascade "curl -s http://localhost:8010/health" # Multimodal GPU (CPU-only) -ssh aitbc-cascade "curl -s http://localhost:8017/health" # Geographic Load Balancer +ssh aitbc "curl -s http://localhost:8010/health" # Multimodal GPU (CPU-only) +ssh aitbc "curl -s http://localhost:8017/health" # Geographic Load Balancer # From internet (Python 3.13.5 upgraded services) curl -s https://aitbc.bubuit.net/health @@ -582,25 +592,25 @@ curl -s https://aitbc.bubuit.net/api/loadbalancer/health ssh ns3-root "curl -s http://192.168.100.10:8003/rpc/head | jq .height" # Python version verification -ssh aitbc-cascade "python3 --version" # Python 3.13.5 +ssh aitbc "python3 --version" # Python 3.13.5 ``` ## Monitoring and Logging ```bash # Container systemd logs -ssh aitbc-cascade "journalctl -u aitbc-coordinator-api --no-pager -n 20" -ssh aitbc-cascade "journalctl -u aitbc-blockchain-node --no-pager -n 20" +ssh aitbc "journalctl -u aitbc-coordinator-api --no-pager -n 20" +ssh aitbc "journalctl -u aitbc-blockchain-node --no-pager -n 20" # Enhanced services logs -ssh aitbc-cascade "journalctl -u aitbc-multimodal-gpu --no-pager -n 20" -ssh aitbc-cascade "journalctl -u aitbc-loadbalancer-geo --no-pager -n 20" +ssh aitbc "journalctl -u aitbc-multimodal-gpu --no-pager -n 20" +ssh aitbc "journalctl -u aitbc-loadbalancer-geo --no-pager -n 20" # Container nginx logs -ssh aitbc-cascade "tail -20 /var/log/nginx/aitbc.bubuit.net.error.log" +ssh aitbc "tail -20 /var/log/nginx/aitbc.bubuit.net.error.log" # Host nginx logs -sudo tail -20 /var/log/nginx/error.log +tail -20 /var/log/nginx/error.log ``` ## Security @@ -645,21 +655,19 @@ PORT=8010-8017 # Enhanced services port range ### Container Access & Port Logic (Updated March 6, 2026) -#### **SSH-Based Container Access** +#### **SSH-Based Server Access** ```bash -# Access aitbc container -ssh aitbc-cascade +# Access aitbc server +ssh aitbc -# Access aitbc1 container +# Access aitbc1 server (from incus host only) ssh aitbc1-cascade -# Check services in containers -ssh aitbc-cascade 'systemctl list-units | grep aitbc-' -ssh aitbc1-cascade 'systemctl list-units | grep aitbc-' +# Check services in servers +ssh aitbc 'systemctl list-units | grep aitbc-' # Debug specific services -ssh aitbc-cascade 'systemctl status aitbc-coordinator-api' -ssh aitbc1-cascade 'systemctl status aitbc-wallet' +ssh aitbc 'systemctl status aitbc-coordinator-api' ``` #### **Port Distribution Strategy - NEW STANDARD** @@ -731,28 +739,22 @@ ssh aitbc1-cascade 'systemctl status aitbc-wallet' # Check port usage netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])" -ssh aitbc-cascade 'netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])" -ssh aitbc1-cascade 'netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])" +ssh aitbc 'netstat -tlnp | grep -E ":(800[0-5]|801[0-7]|802[0-9])' # Service Management Commands: # Primary services: systemctl status aitbc-blockchain-node.service # localhost systemctl status aitbc-blockchain-rpc.service # localhost (port 8006) systemctl status aitbc-wallet.service # localhost (port 8002) -ssh aitbc-cascade 'systemctl status aitbc-blockchain-node.service' # aitbc container -ssh aitbc1-cascade 'systemctl status aitbc-blockchain-node.service' # aitbc1 container +ssh aitbc 'systemctl status aitbc-blockchain-node.service' # aitbc server # Wallet services: -ssh aitbc-cascade 'systemctl status aitbc-wallet.service' # port 8002 -ssh aitbc1-cascade 'systemctl status aitbc-wallet.service' # port 8002 +ssh aitbc 'systemctl status aitbc-wallet.service' # port 8002 # RPC services: -ssh aitbc-cascade 'systemctl status aitbc-blockchain-rpc.service' # port 8006 -ssh aitbc1-cascade 'systemctl status aitbc-blockchain-rpc.service' # port 8006 -ssh aitbc-cascade 'systemctl status aitbc-blockchain-rpc-dev.service' # port 8026 -ssh aitbc1-cascade 'systemctl status aitbc-blockchain-rpc-dev.service' # port 8026 +ssh aitbc 'systemctl status aitbc-blockchain-rpc.service' # port 8006 +ssh aitbc 'systemctl status aitbc-blockchain-rpc-dev.service' # port 8026 # Development services: -ssh aitbc-cascade 'systemctl status aitbc-blockchain-node-dev.service' -ssh aitbc1-cascade 'systemctl status aitbc-blockchain-node-dev.service' +ssh aitbc 'systemctl status aitbc-blockchain-node-dev.service' ``` diff --git a/docs/beginner/02_project/5_done.md b/docs/beginner/02_project/5_done.md index b0ca64c9..8ca99008 100644 --- a/docs/beginner/02_project/5_done.md +++ b/docs/beginner/02_project/5_done.md @@ -549,6 +549,16 @@ This document tracks components that have been successfully deployed and are ope - Updated `docs/files.md` with new structure - Fixed systemd service path for GPU miner +- ✅ **Project File Organization** - Completed March 25, 2026 + - **Root Directory Cleanup**: Moved 60+ loose files to proper subdirectories + - **Development Scripts**: Organized into `dev/review/`, `dev/fixes/`, `scripts/testing/` + - **Configuration Files**: Genesis configs to `config/genesis/`, network configs to `config/networks/` + - **Documentation**: Moved to `docs/development/`, `docs/deployment/`, `docs/project/` + - **Temporary Files**: Organized into `temp/backups/`, `temp/patches/`, `logs/qa/` + - **Essential Root Files**: Only configuration, documentation, and system files remain + - **Dependency Analysis**: Verified no codebreak from file moves + - **Workflow Creation**: Established `/organize-project-files` workflow for future maintenance + ## Recent Updates (2026-02-12) ### Persistent GPU Marketplace ✅ diff --git a/docs/beginner/02_project/aitbc.md b/docs/beginner/02_project/aitbc.md index ea975209..7dbed55b 100644 --- a/docs/beginner/02_project/aitbc.md +++ b/docs/beginner/02_project/aitbc.md @@ -2,9 +2,9 @@ ## Overview -This guide provides comprehensive deployment instructions for the **aitbc server** (primary container), including infrastructure requirements, service configurations, and troubleshooting procedures. **Updated March 7, 2026: Unified port logic deployed, codebase committed to git, enhanced services operational.** +This guide provides comprehensive deployment instructions for the **aitbc server** (secondary development server), including infrastructure requirements, service configurations, and troubleshooting procedures. **Updated March 25, 2026: Updated architecture with aitbc1 as primary server and aitbc as secondary server.** -**Note**: This documentation is specific to the aitbc server. For aitbc1 server documentation, see [aitbc1.md](./aitbc1.md). +**Note**: This documentation is specific to the aitbc secondary server. For aitbc1 primary server documentation, see [aitbc1.md](./aitbc1.md). ## System Requirements @@ -57,38 +57,38 @@ This guide provides comprehensive deployment instructions for the **aitbc server ### **Container Access & SSH Management (Updated March 6, 2026)** -#### **SSH-Based Container Access** +#### **SSH-Based Server Access** ```bash -# Access aitbc server (primary container) -ssh aitbc-cascade +# Access aitbc secondary server +ssh aitbc # Check aitbc server status -ssh aitbc-cascade 'systemctl status' +ssh aitbc 'systemctl status' # List AITBC services on aitbc server -ssh aitbc-cascade 'systemctl list-units | grep aitbc-' +ssh aitbc 'systemctl list-units | grep aitbc-' ``` #### **Service Management via SSH** ```bash # Start/stop services on aitbc server -ssh aitbc-cascade 'sudo systemctl start aitbc-coordinator-api' -ssh aitbc-cascade 'sudo systemctl stop aitbc-wallet' +ssh aitbc 'systemctl start aitbc-coordinator-api' +ssh aitbc 'systemctl stop aitbc-wallet' # Check service logs on aitbc server -ssh aitbc-cascade 'sudo journalctl -f -u aitbc-coordinator-api' +ssh aitbc 'journalctl -f -u aitbc-coordinator-api' # Debug service issues on aitbc server -ssh aitbc-cascade 'sudo systemctl status aitbc-coordinator-api' -ssh aitbc-cascade 'sudo systemctl status aitbc-wallet' +ssh aitbc 'systemctl status aitbc-coordinator-api' +ssh aitbc 'systemctl status aitbc-wallet' # Check blockchain services on aitbc server -ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-node' -ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-rpc' +ssh aitbc 'systemctl status aitbc-blockchain-node' +ssh aitbc 'systemctl status aitbc-blockchain-rpc' # Check development services on aitbc server -ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-node-dev' -ssh aitbc-cascade 'sudo systemctl status aitbc-blockchain-rpc-dev' +ssh aitbc 'systemctl status aitbc-blockchain-node-dev' +ssh aitbc 'systemctl status aitbc-blockchain-rpc-dev' ``` #### **Port Distribution Strategy (Updated March 7, 2026)** @@ -173,21 +173,21 @@ AITBC Platform Architecture (Updated March 7, 2026) #### 1.1 System Preparation ```bash # Update system packages -sudo apt update && sudo apt upgrade -y +apt update && apt upgrade -y # Install required packages -sudo apt install -y python3.13 python3.13-venv python3-pip nodejs npm nginx sqlite3 +apt install -y python3.13 python3.13-venv python3-pip nodejs npm nginx sqlite3 # Create aitbc user -sudo useradd -m -s /bin/bash aitbc -sudo usermod -aG sudo aitbc +useradd -m -s /bin/bash aitbc +usermod -aG sudo aitbc ``` #### 1.2 Directory Structure ```bash # Create AITBC directory structure (standardized) -sudo mkdir -p /opt/aitbc/{apps,config,logs,scripts,backups} -sudo chown -R aitbc:aitbc /opt/aitbc +mkdir -p /opt/aitbc/{apps,config,logs,scripts,backups} +chown -R aitbc:aitbc /opt/aitbc ``` #### 1.3 Code Deployment @@ -200,8 +200,8 @@ git clone https://github.com/oib/AITBC.git . # scp -r /path/to/aitbc/* aitbc@target:/opt/aitbc/ # Set permissions (standardized) -sudo chown -R aitbc:aitbc /opt/aitbc -sudo chmod -R 755 /opt/aitbc +chown -R aitbc:aitbc /opt/aitbc +chmod -R 755 /opt/aitbc ``` ### **Phase 2: Service Configuration** @@ -245,26 +245,26 @@ chown aitbc:aitbc .env #### 2.3 Systemd Service Installation ```bash # Copy service files (updated for new port logic) -sudo cp -r /opt/aitbc/systemd/* /etc/systemd/system/ -sudo systemctl daemon-reload +cp -r /opt/aitbc/systemd/* /etc/systemd/system/ +systemctl daemon-reload # Enable core services -sudo systemctl enable aitbc-coordinator-api.service -sudo systemctl enable aitbc-exchange-api.service -sudo systemctl enable aitbc-blockchain-node.service -sudo systemctl enable aitbc-blockchain-rpc.service -sudo systemctl enable aitbc-blockchain-service.service -sudo systemctl enable aitbc-network-service.service -sudo systemctl enable aitbc-explorer.service +systemctl enable aitbc-coordinator-api.service +systemctl enable aitbc-exchange-api.service +systemctl enable aitbc-blockchain-node.service +systemctl enable aitbc-blockchain-rpc.service +systemctl enable aitbc-blockchain-service.service +systemctl enable aitbc-network-service.service +systemctl enable aitbc-explorer.service # Enable enhanced services (CPU-only mode) -sudo systemctl enable aitbc-multimodal-gpu.service -sudo systemctl enable aitbc-multimodal.service -sudo systemctl enable aitbc-modality-optimization.service -sudo systemctl enable aitbc-adaptive-learning.service -sudo systemctl enable aitbc-marketplace-enhanced.service -sudo systemctl enable aitbc-openclaw-enhanced.service -sudo systemctl enable aitbc-loadbalancer-geo.service +systemctl enable aitbc-multimodal-gpu.service +systemctl enable aitbc-multimodal.service +systemctl enable aitbc-modality-optimization.service +systemctl enable aitbc-adaptive-learning.service +systemctl enable aitbc-marketplace-enhanced.service +systemctl enable aitbc-openclaw-enhanced.service +systemctl enable aitbc-loadbalancer-geo.service ``` ### **Phase 3: Service Deployment** @@ -272,43 +272,43 @@ sudo systemctl enable aitbc-loadbalancer-geo.service #### 3.1 Core Services Startup ```bash # Start core services in order -sudo systemctl start aitbc-coordinator-api.service +systemctl start aitbc-coordinator-api.service sleep 3 -sudo systemctl start aitbc-exchange-api.service +systemctl start aitbc-exchange-api.service sleep 3 -sudo systemctl start aitbc-blockchain-node.service +systemctl start aitbc-blockchain-node.service sleep 3 -sudo systemctl start aitbc-blockchain-rpc.service +systemctl start aitbc-blockchain-rpc.service sleep 3 -sudo systemctl start aitbc-blockchain-service.service +systemctl start aitbc-blockchain-service.service sleep 3 -sudo systemctl start aitbc-network-service.service +systemctl start aitbc-network-service.service sleep 3 -sudo systemctl start aitbc-explorer.service +systemctl start aitbc-explorer.service ``` #### 3.2 Enhanced Services Startup ```bash # Start enhanced services (CPU-only mode) -sudo systemctl start aitbc-multimodal-gpu.service +systemctl start aitbc-multimodal-gpu.service sleep 2 -sudo systemctl start aitbc-multimodal.service +systemctl start aitbc-multimodal.service sleep 2 -sudo systemctl start aitbc-modality-optimization.service +systemctl start aitbc-modality-optimization.service sleep 2 -sudo systemctl start aitbc-adaptive-learning.service +systemctl start aitbc-adaptive-learning.service sleep 2 -sudo systemctl start aitbc-marketplace-enhanced.service +systemctl start aitbc-marketplace-enhanced.service sleep 2 -sudo systemctl start aitbc-openclaw-enhanced.service +systemctl start aitbc-openclaw-enhanced.service sleep 2 -sudo systemctl start aitbc-loadbalancer-geo.service +systemctl start aitbc-loadbalancer-geo.service ``` #### 3.3 Service Verification ```bash # Check service status -sudo systemctl list-units --type=service --state=running | grep aitbc +systemctl list-units --type=service --state=running | grep aitbc # Test core endpoints curl -X GET "http://localhost:8000/health" # Coordinator API @@ -352,13 +352,13 @@ PRAGMA temp_store = MEMORY; EOF # System limits -echo "aitbc soft nofile 65536" | sudo tee -a /etc/security/limits.conf -echo "aitbc hard nofile 65536" | sudo tee -a /etc/security/limits.conf +echo "aitbc soft nofile 65536" | tee -a /etc/security/limits.conf +echo "aitbc hard nofile 65536" | tee -a /etc/security/limits.conf # Network optimization -echo "net.core.somaxconn = 1024" | sudo tee -a /etc/sysctl.conf -echo "net.ipv4.tcp_max_syn_backlog = 1024" | sudo tee -a /etc/sysctl.conf -sudo sysctl -p +echo "net.core.somaxconn = 1024" | tee -a /etc/sysctl.conf +echo "net.ipv4.tcp_max_syn_backlog = 1024" | tee -a /etc/sysctl.conf +sysctl -p ``` #### 4.3 Monitoring Setup @@ -417,7 +417,7 @@ chown aitbc:aitbc /opt/aitbc/scripts/monitor-services.sh #### Service Not Starting ```bash # Check service logs -sudo journalctl -u aitbc-coordinator-api.service -n 50 +journalctl -u aitbc-coordinator-api.service -n 50 # Check Python environment (must be 3.13+) cd /opt/aitbc/apps/coordinator-api @@ -443,14 +443,14 @@ mv /opt/aitbc/apps/coordinator-api/aitbc_coordinator.db /opt/aitbc/apps/coordina #### Port Conflicts (New Port Logic) ```bash # Check port usage (new port logic) -sudo netstat -tlnp | grep -E ":(8000|8001|8003|8010|8011|8012|8013|8014|8015|8016|8017)" +netstat -tlnp | grep -E ":(8000|8001|8003|8010|8011|8012|8013|8014|8015|8016|8017)" # Kill conflicting processes -sudo fuser -k 8000/tcp # Core services -sudo fuser -k 8010/tcp # Enhanced services +fuser -k 8000/tcp # Core services +fuser -k 8010/tcp # Enhanced services # Restart services -sudo systemctl restart aitbc-coordinator-api.service +systemctl restart aitbc-coordinator-api.service ``` #### Container Access Issues @@ -460,16 +460,16 @@ curl -s http://localhost:8017/health # Should work curl -s http://10.1.223.1:8017/health # Should work from containers # Check service binding -sudo netstat -tlnp | grep :8017 # Should show 0.0.0.0:8017 +netstat -tlnp | grep :8017 # Should show 0.0.0.0:8017 ``` #### Permission Issues ```bash # Fix file ownership (standardized) -sudo chown -R aitbc:aitbc /opt/aitbc +chown -R aitbc:aitbc /opt/aitbc # Fix file permissions -sudo chmod -R 755 /opt/aitbc +chmod -R 755 /opt/aitbc chmod 600 /opt/aitbc/apps/coordinator-api/.env ``` diff --git a/docs/beginner/02_project/aitbc1.md b/docs/beginner/02_project/aitbc1.md index 1deb20bd..6205dd62 100644 --- a/docs/beginner/02_project/aitbc1.md +++ b/docs/beginner/02_project/aitbc1.md @@ -2,32 +2,33 @@ ## Overview -This document contains specific deployment notes and considerations for deploying the AITBC platform on the **aitbc1 server** (secondary container). These notes complement the general deployment guide with server-specific configurations and troubleshooting. **Updated for optimized CPU-only deployment with enhanced services disabled.** +This document contains specific deployment notes and considerations for deploying the AITBC platform on the **aitbc1 server** (primary development server). These notes complement the general deployment guide with server-specific configurations and troubleshooting. **Updated March 25, 2026: Updated architecture with aitbc1 as primary server and aitbc as secondary server.** -**Note**: This documentation is specific to the aitbc1 server. For aitbc server documentation, see [aitbc.md](./aitbc.md). +**Note**: This documentation is specific to the aitbc1 primary server. For aitbc secondary server documentation, see [aitbc.md](./aitbc.md). ## Server Specifications -### **aitbc1 Server Details** -- **Hostname**: aitbc1 (container) -- **IP Address**: 10.1.223.40 (container IP) -- **Operating System**: Debian 13 Trixie (secondary development environment) -- **Access Method**: SSH via aitbc1-cascade proxy +### **aitbc1 Primary Server Details** +- **Hostname**: aitbc1 (primary development server) +- **IP Address**: 10.1.223.40 (server IP) +- **Operating System**: Debian 13 Trixie (primary development environment) +- **Access Method**: SSH via aitbc1-cascade proxy (from incus host only) +- **Reverse Proxy Role**: Primary reverse proxy for aitbc.bubuit.net - **GPU Access**: None (CPU-only mode) - **Miner Service**: Not needed - **Enhanced Services**: Mixed status (some enabled, some failing) - **Web Root**: `/var/www/html/` -- **Nginx Configuration**: Two-tier setup with SSL termination +- **Nginx Configuration**: Primary reverse proxy with SSL termination - **Container Support**: Incus containers with 0.0.0.0 binding for container access - **Project Document Root**: `/opt/aitbc` (standardized across all AITBC containers) -### **Network Architecture (Updated March 7, 2026)** +### **Network Architecture (Updated March 25, 2026)** ``` -Internet → aitbc1-cascade (Proxy) → aitbc1 (Container) - SSH Access Application Server - Port 22/443 Port 8000-8001 (Core Services) - Port 8005-8006 Blockchain Services (AT1 Standard) - Port 8025-8026 Development Services +Internet → aitbc1.bubuit.net (Primary Server) → aitbc.bubuit.net (Secondary Server) + HTTPS :443 (SSL Termination) Application Services + Port 22/443 Port 8000-8001 (Core Services) + Port 8005-8006 Blockchain Services (AT1 Standard) + Port 8025-8026 Development Services ``` **Note**: Now compliant with AT1 standard port assignments @@ -36,37 +37,40 @@ Internet → aitbc1-cascade (Proxy) → aitbc1 (Container) #### **Primary Access Methods** ```bash -# Access aitbc1 server (secondary container) +# Access aitbc1 primary server (from incus host only) ssh aitbc1-cascade -# Check aitbc1 server connectivity -ssh aitbc1-cascade 'echo "Container accessible"' +# From aitbc secondary server to aitbc1 primary +ssh aitbc1 + +# Check aitbc1 primary server connectivity +ssh aitbc1-cascade 'echo "Primary server accessible"' ``` #### **Service Management via SSH** ```bash -# List all AITBC services on aitbc1 server -ssh aitbc1-cascade 'systemctl list-units | grep aitbc-' +# List all AITBC services on aitbc1 primary server +ssh aitbc1 'systemctl list-units | grep aitbc-' -# Check specific service status on aitbc1 server -ssh aitbc1-cascade 'systemctl status aitbc-coordinator-api' -ssh aitbc1-cascade 'systemctl status aitbc-wallet' +# Check specific service status on aitbc1 primary server +ssh aitbc1 'systemctl status aitbc-coordinator-api' +ssh aitbc1 'systemctl status aitbc-wallet' -# Start/stop services on aitbc1 server -ssh aitbc1-cascade 'sudo systemctl start aitbc-coordinator-api' -ssh aitbc1-cascade 'sudo systemctl stop aitbc-wallet' +# Start/stop services on aitbc1 primary server +ssh aitbc1 'systemctl start aitbc-coordinator-api' +ssh aitbc1 'systemctl stop aitbc-wallet' -# View service logs on aitbc1 server -ssh aitbc1-cascade 'sudo journalctl -f -u aitbc-coordinator-api' -ssh aitbc1-cascade 'sudo journalctl -f -u aitbc-blockchain-node' +# View service logs on aitbc1 primary server +ssh aitbc1 'journalctl -f -u aitbc-coordinator-api' +ssh aitbc1 'journalctl -f -u aitbc-blockchain-node' -# Check blockchain services on aitbc1 server -ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-node' -ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-rpc' +# Check blockchain services on aitbc1 primary server +ssh aitbc1 'systemctl status aitbc-blockchain-node' +ssh aitbc1 'systemctl status aitbc-blockchain-rpc' -# Check development services on aitbc1 server -ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-node-dev' -ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-rpc-dev' +# Check development services on aitbc1 primary server +ssh aitbc1 'systemctl status aitbc-blockchain-node-dev' +ssh aitbc1 'systemctl status aitbc-blockchain-rpc-dev' ``` #### **Port Distribution & Conflict Resolution (Updated March 6, 2026)** @@ -108,26 +112,26 @@ ssh aitbc1-cascade 'sudo systemctl status aitbc-blockchain-rpc-dev' #### **Debug Container Service Issues** ```bash # Debug coordinator API port conflict -ssh aitbc-cascade 'sudo systemctl status aitbc-coordinator-api' -ssh aitbc-cascade 'sudo journalctl -u aitbc-coordinator-api -n 20' +ssh aitbc 'systemctl status aitbc-coordinator-api' +ssh aitbc 'journalctl -u aitbc-coordinator-api -n 20' # Debug wallet service issues -ssh aitbc-cascade 'sudo systemctl status aitbc-wallet' -ssh aitbc-cascade 'sudo journalctl -u aitbc-wallet -n 20' +ssh aitbc 'systemctl status aitbc-wallet' +ssh aitbc 'journalctl -u aitbc-wallet -n 20' -# Check port usage in containers -ssh aitbc-cascade 'sudo netstat -tlnp | grep :800' -ssh aitbc1-cascade 'sudo netstat -tlnp | grep :800' +# Check port usage in servers +ssh aitbc 'netstat -tlnp | grep :800' +ssh aitbc1 'netstat -tlnp | grep :800' # Test service endpoints -ssh aitbc-cascade 'curl -s http://localhost:8001/health' -ssh aitbc1-cascade 'curl -s http://localhost:8002/health' +ssh aitbc 'curl -s http://localhost:8001/health' +ssh aitbc1 'curl -s http://localhost:8002/health' ``` ## Pre-Deployment Checklist ### **✅ Server Preparation** -- [ ] SSH access confirmed via aitbc-cascade +- [ ] SSH access confirmed via aitbc (from aitbc1) and aitbc1-cascade (from incus host) - [ ] System packages updated - [ ] aitbc user created with sudo access - [ ] Directory structure created @@ -136,13 +140,15 @@ ssh aitbc1-cascade 'curl -s http://localhost:8002/health' - [ ] Container networking configured - [ ] GPU access confirmed as not available - [ ] Miner service requirements confirmed as not needed +- [ ] Reverse proxy role confirmed as primary ### **✅ Network Configuration** -- [ ] Port forwarding configured on aitbc-cascade -- [ ] SSL certificates installed on proxy -- [ ] DNS records configured +- [ ] Port forwarding configured on aitbc1 primary server +- [ ] SSL certificates installed on primary server +- [ ] DNS records configured for aitbc1.bubuit.net and aitbc.bubuit.net - [ ] Load balancer rules set - [ ] Container access configured (0.0.0.0 binding) +- [ ] Bidirectional SSH access configured (aitbc ↔ aitbc1) ### **✅ Storage Requirements** - [ ] Minimum 50GB free space available @@ -271,27 +277,27 @@ sudo systemctl edit aitbc-coordinator-api.service ### **🔥 Issue 5: Nginx Proxy Configuration** -**Problem**: Requests not properly forwarded from aitbc-cascade to aitbc +**Problem**: Requests not properly forwarded from aitbc1 primary server to aitbc secondary server **Solution**: ```bash -# On aitbc-cascade, check proxy configuration +# On aitbc1 primary server, check proxy configuration cat /etc/nginx/sites-available/aitbc-proxy.conf -# Ensure upstream configuration includes aitbc +# Ensure upstream configuration includes aitbc secondary server upstream aitbc_backend { - server 10.1.223.1:8000; # Coordinator API - server 10.1.223.1:8001; # Exchange API - server 10.1.223.1:8003; # Blockchain RPC + server 10.1.223.1:8000; # Coordinator API (aitbc secondary) + server 10.1.223.1:8001; # Exchange API (aitbc secondary) + server 10.1.223.1:8003; # Blockchain RPC (aitbc secondary) # Add enhanced services ports - server 10.1.223.1:8010; # Multimodal GPU - server 10.1.223.1:8011; # GPU Multimodal - server 10.1.223.1:8012; # Modality Optimization - server 10.1.223.1:8013; # Adaptive Learning - server 10.1.223.1:8014; # Marketplace Enhanced - server 10.1.223.1:8015; # OpenClaw Enhanced - server 10.1.223.1:8016; # Web UI - server 10.1.223.1:8017; # Geographic Load Balancer + server 10.1.223.1:8010; # Multimodal GPU (aitbc secondary) + server 10.1.223.1:8011; # GPU Multimodal (aitbc secondary) + server 10.1.223.1:8012; # Modality Optimization (aitbc secondary) + server 10.1.223.1:8013; # Adaptive Learning (aitbc secondary) + server 10.1.223.1:8014; # Marketplace Enhanced (aitbc secondary) + server 10.1.223.1:8015; # OpenClaw Enhanced (aitbc secondary) + server 10.1.223.1:8016; # Web UI (aitbc secondary) + server 10.1.223.1:8017; # Geographic Load Balancer (aitbc secondary) } # Reload nginx configuration @@ -300,17 +306,18 @@ sudo nginx -t && sudo systemctl reload nginx ### **🔥 Issue 6: SSL Certificate Issues** -**Problem**: SSL certificates not properly configured for aitbc domain +**Problem**: SSL certificates not properly configured for aitbc domains **Solution**: ```bash -# On aitbc-cascade, check certificate status +# On aitbc1 primary server, check certificate status sudo certbot certificates -# Renew or obtain certificate -sudo certbot --nginx -d aitbc.bubuit.net +# Renew or obtain certificate for both domains +sudo certbot --nginx -d aitbc1.bubuit.net -d aitbc.bubuit.net # Test SSL configuration +curl -I https://aitbc1.bubuit.net curl -I https://aitbc.bubuit.net ``` @@ -527,14 +534,17 @@ sudo systemctl restart aitbc-coordinator-api.service ### **Issue: Network Connectivity** ```bash -# Test local connectivity +# Test local connectivity on aitbc secondary server curl -X GET "http://localhost:8000/v1/health" -# Test external connectivity via proxy +# Test external connectivity via aitbc1 primary server curl -X GET "http://aitbc.bubuit.net/health" -# Check proxy configuration -ssh aitbc-cascade "cat /etc/nginx/sites-available/aitbc-proxy.conf" +# Test primary server direct access +curl -X GET "http://aitbc1.bubuit.net/health" + +# Check proxy configuration on aitbc1 primary server +ssh aitbc1 "cat /etc/nginx/sites-available/aitbc-proxy.conf" ``` ### **Issue: Container Access Problems** @@ -675,36 +685,36 @@ sudo systemctl restart aitbc-*.service --- -**Server**: aitbc1 (Container) +**Server**: aitbc1 (Primary Development Server) **Environment**: Production -**IP Address**: 10.1.223.40 (container) +**IP Address**: 10.1.223.40 (primary server) **GPU Access**: None (CPU-only mode) **Miner Service**: Not needed **Enhanced Services**: Mixed status (some enabled, some failing) -**Last Updated**: 2026-03-07 +**Last Updated**: 2026-03-25 **Maintainer**: AITBC Operations Team -**Status**: ✅ PRODUCTION READY (mixed enhanced services) +**Status**: ✅ PRODUCTION READY (primary reverse proxy) **Platform Health**: 85% functional **External Access**: 100% working -**CLI Functionality**: 70% working (container) -**Multi-Site**: 1 of 3 sites operational +**CLI Functionality**: 70% working (primary server) +**Multi-Site**: 1 of 2 sites operational ## Multi-Site Deployment Status -### ✅ **aitbc1 Container Status** +### ✅ **aitbc1 Primary Server Status** - **Services Running**: 8 services active (mixed enhanced services) - **External Access**: 100% functional - **CLI Installation**: Complete and working - **Performance**: Excellent - **Stability**: 95% (some enhanced services failing) +- **Reverse Proxy**: Primary proxy for aitbc.bubuit.net ### 📊 **Multi-Site Architecture** -- **at1 (localhost)**: 8 services running -- **aitbc (container)**: 9 services running ✅ -- **aitbc1 (container)**: 8 services running ⚠️ -- **Total Services**: 25 across 3 sites +- **aitbc1 (primary server)**: 8 services running +- **aitbc (secondary server)**: 9 services running ✅ +- **Total Services**: 17 across 2 sites -### 🛠️ **CLI Status in aitbc1 Container** +### 🛠️ **CLI Status in aitbc1 Primary Server** - **CLI Version**: v0.1.0 installed - **Wallet Management**: 100% working - **Configuration**: 100% working @@ -712,9 +722,10 @@ sudo systemctl restart aitbc-*.service - **Marketplace**: Network errors (known limitation) ### 🌐 **External Access Configuration** -- **Primary URL**: https://aitbc.bubuit.net/ +- **Primary URL**: https://aitbc1.bubuit.net/ (primary server) +- **Secondary URL**: https://aitbc.bubuit.net/ (secondary server) - **API Health**: https://aitbc.bubuit.net/api/health -- **SSL Certificate**: Valid and working +- **SSL Certificate**: Valid and working for both domains - **Performance**: <50ms response times - **Uptime**: 100% @@ -745,7 +756,8 @@ Additional Services: ``` ### 🔧 **Maintenance Notes** -- **Container Access**: SSH via aitbc-cascade +- **Primary Server Access**: SSH via aitbc1-cascade (from incus host) or aitbc1 (from aitbc) +- **Secondary Server Access**: SSH via aitbc (from aitbc1) - **Service Management**: systemctl commands - **Log Location**: /opt/aitbc/logs/ - **Backup Location**: /opt/aitbc/backups/ diff --git a/docs/beginner/05_cli/README.md b/docs/beginner/05_cli/README.md index cf9933d3..058db097 100644 --- a/docs/beginner/05_cli/README.md +++ b/docs/beginner/05_cli/README.md @@ -15,25 +15,39 @@ ### Installation and Setup ```bash -# Load development environment -source /opt/aitbc/.env.dev - # Test CLI installation aitbc --help aitbc version ``` +**Note**: The CLI is pre-configured with a bash alias for automatic virtual environment activation: +```bash +# The following alias is configured in ~/.bashrc: +alias aitbc="source /opt/aitbc/cli/venv/bin/activate && aitbc" +``` + +This allows you to use `aitbc ` directly without manually sourcing the virtual environment. + ### Basic Operations ```bash -# Wallet operations -aitbc wallet create -aitbc wallet list -aitbc wallet balance +# Core operations +aitbc client submit --prompt "Generate an image" --model llama2 +aitbc miner status +aitbc wallet create --type hd +aitbc marketplace list +aitbc blockchain info +aitbc exchange create-pair --pair AITBC/BTC --base-asset AITBC --quote-asset BTC +aitbc explorer status +aitbc explorer block 12345 +aitbc explorer transaction 0x123... +aitbc explorer search --address 0xabc... -# Exchange operations -aitbc exchange register --name "Binance" --api-key -aitbc exchange create-pair AITBC/BTC -aitbc exchange start-trading --pair AITBC/BTC +# Advanced features +aitbc analytics summary +aitbc ai-trading start --strategy arbitrage +aitbc compliance kyc-submit --user-id user123 +aitbc agent create --type trading +aitbc multimodal process --input image.jpg --mode text # AI Trading & Analytics aitbc ai-trading start --strategy mean_reversion @@ -119,35 +133,52 @@ aitbc-services restart - `wallet backup` - Backup wallet - `wallet restore` - Restore wallet -### **Exchange Commands** -- `exchange register` - Register with exchange -- `exchange create-pair` - Create trading pair -- `exchange start-trading` - Start trading -- `exchange stop-trading` - Stop trading -- `exchange status` - Exchange status -- `exchange balances` - Exchange balances +### **Advanced Features** +- `analytics` - Chain performance monitoring and predictions +- `ai-trading` - AI-powered trading strategies +- `surveillance` - Market surveillance and compliance +- `compliance` - Regulatory compliance and reporting +- `governance` - Network governance and proposals -### **Blockchain Commands** -- `blockchain info` - Blockchain information -- `blockchain status` - Node status -- `blockchain blocks` - List blocks -- `blockchain balance` - Check balance -- `blockchain peers` - Network peers -- `blockchain transaction` - Transaction details +### **Development Tools** +- `admin` - Administrative operations +- `config` - Configuration management +- `monitor` - System monitoring and health +- `test` - CLI testing and validation +- `deploy` - Deployment and infrastructure management -### **Config Commands** -- `config show` - Show configuration -- `config get ` - Get config value -- `config set ` - Set config value -- `config edit` - Edit configuration -- `config validate` - Validate configuration +### **Specialized Services** +- `agent` - AI agent operations +- `multimodal` - Multi-modal AI processing +- `oracle` - Price discovery and data feeds +- `market-maker` - Automated market making +- `genesis-protection` - Advanced security features +- `swarm` - Swarm intelligence operations +- `ai` - AI provider commands -### **Compliance Commands** -- `compliance list-providers` - List KYC providers -- `compliance kyc-submit` - Submit KYC verification -- `compliance kyc-status` - Check KYC status -- `compliance aml-screen` - AML screening -- `compliance full-check` - Full compliance check +### **Enterprise Integration** +- `enterprise-integration` - Enterprise system integration +- `cross-chain` - Cross-chain operations +- `regulatory` - Regulatory reporting + +### **Security & Authentication** +- `auth` - Authentication and token management +- `keystore` - Key management +- `multisig` - Multi-signature operations +- `genesis` - Genesis block operations + +### **Network & Infrastructure** +- `node` - Node management +- `chain` - Chain operations +- `sync` - Synchronization operations +- `optimize` - Performance optimization + +### **Plugin System** +- `plugin` - Plugin management +- `plugin-registry` - Plugin registry +- `plugin-marketplace` - Plugin marketplace +- `plugin-security` - Plugin security +- `plugin-analytics` - Plugin analytics ## 🧪 **Testing** @@ -192,9 +223,6 @@ python3 run_simple_tests.py ### Environment Variables ```bash -# Load development environment -source /opt/aitbc/.env.dev - # Available aliases aitbc-services # Service management aitbc-fix # Quick permission fix @@ -210,13 +238,30 @@ aitbc --output json wallet balance aitbc --output yaml blockchain info # Debug mode -aitbc --debug wallet list +aitbc --debug client submit --prompt "Test" # Test mode aitbc --test-mode exchange status # Custom configuration aitbc --config-file /path/to/config wallet list + +# Dry run mode +aitbc --dry-run deploy --target production + +# Custom timeout +aitbc --timeout 60 blockchain info + +# Custom API endpoint +aitbc --url http://localhost:8000 blockchain status + +# Custom API key +aitbc --api-key exchange register --name "Exchange" + +# Verbosity levels +aitbc -v client list +aitbc -vv marketplace show --job-id 123 +aitbc -vvv admin system-status ``` ### Service Integration @@ -229,6 +274,27 @@ aitbc --api-key exchange register --name "Exchange" # Timeout configuration aitbc --timeout 60 blockchain info + +# Skip SSL verification (testing only) +aitbc --no-verify --test-mode client status + +# Plugin management +aitbc plugin list +aitbc plugin install --name gpu-optimizer +aitbc plugin enable --name monitoring + +# Multi-modal processing +aitbc multimodal process --input document.pdf --modes text,image +aitbc multimodal status --job-id 12345 + +# AI operations +aitbc ai list-providers +aitbc ai generate --provider ollama --model llama2 --prompt "Summarize" + +# Agent operations +aitbc agent create --type trading --name trader1 +aitbc agent start --agent-id trader1 +aitbc agent status --agent-id trader1 ``` ## 🔍 **Troubleshooting** @@ -254,13 +320,14 @@ aitbc --test-mode blockchain status ## 📚 **Additional Resources** - [Testing Procedures](./testing.md) - Detailed testing documentation -- [Permission Setup](./permission-setup.md) - Development environment configuration - [Service Management](../8_development/) - Service operation guides - [Exchange Integration](../19_marketplace/) - Exchange and trading documentation --- -**Last Updated**: March 8, 2026 +**Last Updated**: March 25, 2026 **CLI Version**: 0.1.0 **Test Coverage**: 67/67 tests passing (100%) -**Infrastructure**: Complete +**Infrastructure**: Complete +**Command Groups**: 45+ command groups available +**Plugin System**: Full plugin architecture supported diff --git a/docs/completed/implementation/enhanced-services-implementation-complete.md b/docs/completed/implementation/enhanced-services-implementation-complete.md index 42ee773f..f48ad9c2 100644 --- a/docs/completed/implementation/enhanced-services-implementation-complete.md +++ b/docs/completed/implementation/enhanced-services-implementation-complete.md @@ -63,11 +63,11 @@ **🔧 Service Scripts Created:** ```bash -/opt/aitbc/scripts/multimodal_gpu_service.py # Port 8010 -/opt/aitbc/scripts/gpu_multimodal_service.py # Port 8011 -/opt/aitbc/scripts/modality_optimization_service.py # Port 8012 -/opt/aitbc/scripts/adaptive_learning_service.py # Port 8013 -/opt/aitbc/scripts/web_ui_service.py # Port 8016 +/opt/aitbc/scripts/services/multimodal_gpu_service.py # Port 8010 +/opt/aitbc/scripts/services/gpu_multimodal_service.py # Port 8011 +/opt/aitbc/scripts/services/modality_optimization_service.py # Port 8012 +/opt/aitbc/scripts/services/adaptive_learning_service.py # Port 8013 +/opt/aitbc/scripts/services/web_ui_service.py # Port 8016 ``` **🔧 Systemd Services Updated:** diff --git a/SETUP_PRODUCTION.md b/docs/deployment/SETUP_PRODUCTION.md similarity index 100% rename from SETUP_PRODUCTION.md rename to docs/deployment/SETUP_PRODUCTION.md diff --git a/docs/archive/temp_files/DEBUgging_SERVICES.md b/docs/development/DEBUgging_SERVICES.md similarity index 100% rename from docs/archive/temp_files/DEBUgging_SERVICES.md rename to docs/development/DEBUgging_SERVICES.md diff --git a/docs/archive/temp_files/DEV_LOGS.md b/docs/development/DEV_LOGS.md similarity index 100% rename from docs/archive/temp_files/DEV_LOGS.md rename to docs/development/DEV_LOGS.md diff --git a/docs/archive/temp_files/DEV_LOGS_QUICK_REFERENCE.md b/docs/development/DEV_LOGS_QUICK_REFERENCE.md similarity index 100% rename from docs/archive/temp_files/DEV_LOGS_QUICK_REFERENCE.md rename to docs/development/DEV_LOGS_QUICK_REFERENCE.md diff --git a/docs/expert/01_issues/89_test.md b/docs/expert/01_issues/89_test.md index 3de03707..f0e5c897 100644 --- a/docs/expert/01_issues/89_test.md +++ b/docs/expert/01_issues/89_test.md @@ -59,7 +59,7 @@ skill test python -m pytest tests/integration/test_multichain.py -v # Run all tests including multi-chain scenarios -./tests/run_all_tests.sh +./scripts/testing/run_all_tests.sh ``` #### Using CLI for Testing @@ -168,7 +168,7 @@ python -m aitbc_cli --url http://127.0.0.1:8000 --api-key test-key blockchain he #### **4.1 Run Complete Test Suite** ```bash # Execute all tests including multi-chain scenarios -./tests/run_all_tests.sh +./scripts/testing/run_all_tests.sh # Run specific multi-chain integration tests python -m pytest tests/integration/test_multichain.py -v @@ -237,7 +237,7 @@ jobs: ### **Scheduled Testing** ```bash # Regular multi-chain test execution -0 2 * * * cd /home/oib/windsurf/aitbc && ./tests/run_all_tests.sh +0 2 * * * cd /home/oib/windsurf/aitbc && ./scripts/testing/run_all_tests.sh ``` ## Troubleshooting diff --git a/docs/expert/01_issues/mock-coordinator-services-removed-2026-02-16.md b/docs/expert/01_issues/mock-coordinator-services-removed-2026-02-16.md index fce4da93..c0d77ca7 100644 --- a/docs/expert/01_issues/mock-coordinator-services-removed-2026-02-16.md +++ b/docs/expert/01_issues/mock-coordinator-services-removed-2026-02-16.md @@ -23,23 +23,23 @@ Historical development setup included mock coordinator services for testing purp ### 1. Localhost Cleanup ```bash # Stop and disable mock service -sudo systemctl stop aitbc-mock-coordinator.service -sudo systemctl disable aitbc-mock-coordinator.service +systemctl stop aitbc-mock-coordinator.service +systemctl disable aitbc-mock-coordinator.service # Remove service file -sudo rm /etc/systemd/system/aitbc-mock-coordinator.service -sudo systemctl daemon-reload +rm /etc/systemd/system/aitbc-mock-coordinator.service +systemctl daemon-reload ``` ### 2. AITBC Server Cleanup ```bash # Stop and disable mock service -ssh aitbc-cascade "systemctl stop aitbc-coordinator.service" -ssh aitbc-cascade "systemctl disable aitbc-coordinator.service" +ssh aitbc "systemctl stop aitbc-coordinator.service" +ssh aitbc "systemctl disable aitbc-coordinator.service" # Remove service file -ssh aitbc-cascade "rm /etc/systemd/system/aitbc-coordinator.service" -ssh aitbc-cascade "systemctl daemon-reload" +ssh aitbc "rm /etc/systemd/system/aitbc-coordinator.service" +ssh aitbc "systemctl daemon-reload" ``` ### 3. Production Service Verification diff --git a/docs/expert/02_tasks/completed_phases/15_deployment_guide.md b/docs/expert/02_tasks/completed_phases/15_deployment_guide.md index fcb04641..94892516 100644 --- a/docs/expert/02_tasks/completed_phases/15_deployment_guide.md +++ b/docs/expert/02_tasks/completed_phases/15_deployment_guide.md @@ -209,21 +209,21 @@ server { ```bash # Enable and start services -sudo systemctl enable aitbc-reputation -sudo systemctl enable aitbc-rewards -sudo systemctl enable aitbc-trading -sudo systemctl enable aitbc-analytics -sudo systemctl enable aitbc-certification +systemctl enable aitbc-reputation +systemctl enable aitbc-rewards +systemctl enable aitbc-trading +systemctl enable aitbc-analytics +systemctl enable aitbc-certification # Start services -sudo systemctl start aitbc-reputation -sudo systemctl start aitbc-rewards -sudo systemctl start aitbc-trading -sudo systemctl start aitbc-analytics -sudo systemctl start aitbc-certification +systemctl start aitbc-reputation +systemctl start aitbc-rewards +systemctl start aitbc-trading +systemctl start aitbc-analytics +systemctl start aitbc-certification # Check status -sudo systemctl status aitbc-* +systemctl status aitbc-* ``` ## Configuration Details @@ -588,7 +588,7 @@ CACHE_CONFIG = { 1. **Database Connection Errors** ```bash # Check PostgreSQL status - sudo systemctl status postgresql + systemctl status postgresql # Check connection psql -h localhost -U aitbc_user -d aitbc_economics @@ -667,10 +667,10 @@ curl -f http://localhost:8000/health || echo "Health check failed" ```bash # Rollback to previous version -sudo systemctl stop aitbc-* +systemctl stop aitbc-* git checkout previous_version_tag pip install -r requirements.txt -sudo systemctl start aitbc-* +systemctl start aitbc-* ``` ### Database Rollback diff --git a/docs/expert/02_tasks/deployment_reports/aitbc_aitbc1_deployment_success.md b/docs/expert/02_tasks/deployment_reports/aitbc_aitbc1_deployment_success.md index cc131e4b..14b0cb63 100644 --- a/docs/expert/02_tasks/deployment_reports/aitbc_aitbc1_deployment_success.md +++ b/docs/expert/02_tasks/deployment_reports/aitbc_aitbc1_deployment_success.md @@ -193,9 +193,9 @@ server { #### **Services Not Starting** ```bash # Check service status -sudo systemctl status aitbc-cross-chain-reputation -sudo systemctl status aitbc-agent-communication -sudo systemctl status aitbc-advanced-learning +systemctl status aitbc-cross-chain-reputation +systemctl status aitbc-agent-communication +systemctl status aitbc-advanced-learning # Check logs sudo journalctl -u aitbc-cross-chain-reputation @@ -206,7 +206,7 @@ sudo journalctl -u aitbc-advanced-learning #### **Nginx Issues** ```bash # Check nginx status -sudo systemctl status nginx +systemctl status nginx # Test configuration sudo nginx -t @@ -224,7 +224,7 @@ ls -la /var/www/aitbc.bubuit.net/ sudo nginx -t # Restart nginx -sudo systemctl restart nginx +systemctl restart nginx ``` ### 📞 **Support Contacts** diff --git a/docs/expert/05_reports/PROJECT_COMPLETION_REPORT.md b/docs/expert/05_reports/PROJECT_COMPLETION_REPORT.md index b3de2750..63285a98 100644 --- a/docs/expert/05_reports/PROJECT_COMPLETION_REPORT.md +++ b/docs/expert/05_reports/PROJECT_COMPLETION_REPORT.md @@ -77,7 +77,7 @@ The AITBC Developer Ecosystem & DAO Grants system has been successfully implemen #### Test Execution: ```bash # Run all tests -./tests/run_all_tests.sh +./scripts/testing/run_all_tests.sh # Individual suites npx hardhat test tests/contracts/ @@ -211,7 +211,7 @@ npm run test # Frontend E2E ./scripts/production-health-check.sh # Monitor system logs -ssh aitbc-cascade "journalctl -u nginx -f" +ssh aitbc "journalctl -u nginx -f" # Check contract events npx hardhat run scripts/monitor-contracts.js --network mainnet @@ -220,7 +220,7 @@ npx hardhat run scripts/monitor-contracts.js --network mainnet ### Weekly Operations ```bash # Security updates -ssh aitbc-cascade "apt update && apt upgrade -y" +ssh aitbc "apt update && apt upgrade -y" # Performance monitoring ./scripts/performance-report.sh diff --git a/docs/expert/06_workflow/DOCS_WORKFLOW_COMPLETION_SUMMARY.md b/docs/expert/06_workflow/DOCS_WORKFLOW_COMPLETION_SUMMARY.md index bf7de136..5275892c 100644 --- a/docs/expert/06_workflow/DOCS_WORKFLOW_COMPLETION_SUMMARY.md +++ b/docs/expert/06_workflow/DOCS_WORKFLOW_COMPLETION_SUMMARY.md @@ -59,8 +59,8 @@ - **`tests/cli/test_wallet.py`**: Updated wallet tests for unified CLI interface - **`tests/cli/test_marketplace.py`**: Updated marketplace tests for CLI integration - **`tests/cli/test_cli_integration.py`**: Enhanced integration testing with CLI support -- **`tests/conftest.py`**: Enhanced test configuration for CLI testing -- **`tests/run_all_tests.sh`**: Updated test runner with CLI testing support +- **`tests/conftest.py`**: Enhanced test configuration +- **`tests/scripts/testing/run_all_tests.sh`**: Updated test runner with CLI testing support - **`tests/cli-test-updates-completed.md`**: Created CLI test completion summary - **`tests/test-integration-completed.md`**: Created test ecosystem integration summary - **`docs/22_workflow/DOCS_WORKFLOW_COMPLETION_SUMMARY.md`**: Updated with latest workflow completion diff --git a/docs/infrastructure/multimodal-services-deployment.md b/docs/infrastructure/multimodal-services-deployment.md index 19e8291f..d4a22603 100644 --- a/docs/infrastructure/multimodal-services-deployment.md +++ b/docs/infrastructure/multimodal-services-deployment.md @@ -78,12 +78,12 @@ If you need to manually configure services: ```bash # For AT1 (localhost) -sudo systemctl disable aitbc-multimodal.service -sudo systemctl enable aitbc-multimodal-gpu.service +systemctl disable aitbc-multimodal.service +systemctl enable aitbc-multimodal-gpu.service # For Production Servers -sudo systemctl enable aitbc-multimodal.service -sudo systemctl disable aitbc-multimodal-gpu.service +systemctl enable aitbc-multimodal.service +systemctl disable aitbc-multimodal-gpu.service ``` ## Verification @@ -104,8 +104,8 @@ systemctl status aitbc-multimodal.service ### Service Not Found ```bash # Ensure service files are copied to system directory -sudo cp /home/oib/windsurf/aitbc/systemd/aitbc-*-multimodal.service /etc/systemd/system/ -sudo systemctl daemon-reload +cp /home/oib/windsurf/aitbc/systemd/aitbc-*-multimodal.service /etc/systemd/system/ +systemctl daemon-reload ``` ### Port Conflicts diff --git a/docs/intermediate/06_explorer/EXPLORER_FIXES_SUMMARY.md b/docs/intermediate/06_explorer/EXPLORER_FIXES_SUMMARY.md index 995e5750..ec32c86f 100644 --- a/docs/intermediate/06_explorer/EXPLORER_FIXES_SUMMARY.md +++ b/docs/intermediate/06_explorer/EXPLORER_FIXES_SUMMARY.md @@ -145,7 +145,7 @@ testpaths = tests ## 🧪 **Verification Tests Created** -Created comprehensive test suite `tests/test_explorer_fixes.py`: +Created comprehensive test suite `tests/explorer/test_explorer_fixes.py`: ```python ✅ test_pytest_configuration_restored diff --git a/E2E_TEST_CREATION_SUMMARY.md b/docs/project/E2E_TEST_CREATION_SUMMARY.md similarity index 100% rename from E2E_TEST_CREATION_SUMMARY.md rename to docs/project/E2E_TEST_CREATION_SUMMARY.md diff --git a/docs/archive/duplicates/GIFT_CERTIFICATE_newuser_trail_duplicate.md b/docs/project/GIFT_CERTIFICATE_newuser.md similarity index 100% rename from docs/archive/duplicates/GIFT_CERTIFICATE_newuser_trail_duplicate.md rename to docs/project/GIFT_CERTIFICATE_newuser.md diff --git a/docs/archive/temp_files/GITHUB_PULL_SUMMARY.md b/docs/project/GITHUB_PULL_SUMMARY.md similarity index 100% rename from docs/archive/temp_files/GITHUB_PULL_SUMMARY.md rename to docs/project/GITHUB_PULL_SUMMARY.md diff --git a/README.md b/docs/project/README.md similarity index 100% rename from README.md rename to docs/project/README.md diff --git a/SECURITY.md b/docs/project/SECURITY.md similarity index 100% rename from SECURITY.md rename to docs/project/SECURITY.md diff --git a/docs/archive/temp_files/SQLMODEL_METADATA_FIX_SUMMARY.md b/docs/project/SQLMODEL_METADATA_FIX_SUMMARY.md similarity index 100% rename from docs/archive/temp_files/SQLMODEL_METADATA_FIX_SUMMARY.md rename to docs/project/SQLMODEL_METADATA_FIX_SUMMARY.md diff --git a/docs/archive/temp_files/WORKING_SETUP.md b/docs/project/WORKING_SETUP.md similarity index 100% rename from docs/archive/temp_files/WORKING_SETUP.md rename to docs/project/WORKING_SETUP.md diff --git a/docs/beginner/06_github_resolution/user_profile_newuser.md b/docs/project/user_profile_newuser.md similarity index 100% rename from docs/beginner/06_github_resolution/user_profile_newuser.md rename to docs/project/user_profile_newuser.md diff --git a/docs/summaries/CLI_TRANSLATION_SECURITY_IMPLEMENTATION_SUMMARY.md b/docs/summaries/CLI_TRANSLATION_SECURITY_IMPLEMENTATION_SUMMARY.md index a9038240..1a5524b8 100644 --- a/docs/summaries/CLI_TRANSLATION_SECURITY_IMPLEMENTATION_SUMMARY.md +++ b/docs/summaries/CLI_TRANSLATION_SECURITY_IMPLEMENTATION_SUMMARY.md @@ -194,7 +194,7 @@ assert medium_security_commands_degrade_gracefully() - **`CLI_TRANSLATION_SECURITY_IMPLEMENTATION_SUMMARY.md`** - This summary ### **Testing** -- **`tests/test_cli_translation_security.py`** - Comprehensive test suite (23 tests) +- **`tests/security/test_cli_translation_security.py`** - Comprehensive test suite (23 tests) ## 🚀 Usage Examples diff --git a/docs/summaries/EVENT_DRIVEN_CACHE_IMPLEMENTATION_SUMMARY.md b/docs/summaries/EVENT_DRIVEN_CACHE_IMPLEMENTATION_SUMMARY.md index 5a41fdf4..4a779e6c 100644 --- a/docs/summaries/EVENT_DRIVEN_CACHE_IMPLEMENTATION_SUMMARY.md +++ b/docs/summaries/EVENT_DRIVEN_CACHE_IMPLEMENTATION_SUMMARY.md @@ -86,7 +86,7 @@ class EventDrivenCacheSettings: enable_health_checks: bool ``` -### 4. Comprehensive Test Suite (`tests/test_event_driven_cache.py`) +### 4. Comprehensive Test Suite (`tests/integration/test_event_driven_cache.py`) **Test Coverage:** - **Core cache operations** (set, get, invalidate) diff --git a/docs/summaries/PROJECT_ORGANIZATION_COMPLETED.md b/docs/summaries/PROJECT_ORGANIZATION_COMPLETED.md index 16305ab4..927253f4 100644 --- a/docs/summaries/PROJECT_ORGANIZATION_COMPLETED.md +++ b/docs/summaries/PROJECT_ORGANIZATION_COMPLETED.md @@ -95,7 +95,7 @@ aitbc/ ├── README.md # Project documentation ├── poetry.lock # Dependency lock file ├── pyproject.toml # Python project configuration -└── run_all_tests.sh # Test runner (convenience) +└── scripts/testing/run_all_tests.sh # Test runner (convenience) ``` ### **Main Directories (Organized by Purpose)** @@ -207,7 +207,7 @@ aitbc/ - ✅ **Essential project files** (.gitignore, README, LICENSE) - ✅ **Configuration templates** (.env.example, .editorconfig) - ✅ **Build files** (pyproject.toml, poetry.lock) -- ✅ **Convenience scripts** (run_all_tests.sh) +- ✅ **Convenience scripts** (scripts/testing/run_all_tests.sh) - ✅ **Core documentation** (README.md, PLUGIN_SPEC.md) ### **Documentation Organization** diff --git a/docs/summaries/WEBSOCKET_STREAM_BACKPRESSURE_IMPLEMENTATION.md b/docs/summaries/WEBSOCKET_STREAM_BACKPRESSURE_IMPLEMENTATION.md index 7397a32a..23da6fd8 100644 --- a/docs/summaries/WEBSOCKET_STREAM_BACKPRESSURE_IMPLEMENTATION.md +++ b/docs/summaries/WEBSOCKET_STREAM_BACKPRESSURE_IMPLEMENTATION.md @@ -213,7 +213,7 @@ async def _sender_loop(self): - **`apps/coordinator-api/src/app/services/multi_modal_websocket_fusion.py`** - Multi-modal fusion with backpressure ### **Testing** -- **`tests/test_websocket_backpressure_core.py`** - Comprehensive test suite +- **`tests/websocket/test_websocket_backpressure_core.py`** - Comprehensive test suite - **Mock implementations** for testing without dependencies ### **Documentation** diff --git a/docs/trail/GIFT_TRANSACTION_SUMMARY.md b/docs/trail/GIFT_TRANSACTION_SUMMARY.md index dc24e2da..04bdd1a2 100644 --- a/docs/trail/GIFT_TRANSACTION_SUMMARY.md +++ b/docs/trail/GIFT_TRANSACTION_SUMMARY.md @@ -103,13 +103,13 @@ aitbc ai-surveillance status #### **Verification Commands:** ```bash # Check user wallet on aitbc server -ssh aitbc-cascade "cat /opt/aitbc/.aitbc/wallets/newuser.json | jq '.balance'" +ssh aitbc "cat /opt/aitbc/.aitbc/wallets/newuser.json | jq '.balance'" # View transaction details -ssh aitbc-cascade "cat /opt/aitbc/.aitbc/wallets/newuser.json | jq '.transactions[-1]'" +ssh aitbc "cat /opt/aitbc/.aitbc/wallets/newuser.json | jq '.transactions[-1]'" # View gift certificate -ssh aitbc-cascade "cat /opt/aitbc/GIFT_CERTIFICATE_newuser.md" +ssh aitbc "cat /opt/aitbc/GIFT_CERTIFICATE_newuser.md" ``` ### 🎉 **Success Metrics:** diff --git a/docs/trail/SYSTEMD_SERVICE_MANAGEMENT_GUIDE.md b/docs/trail/SYSTEMD_SERVICE_MANAGEMENT_GUIDE.md index ae156f95..f7e88326 100644 --- a/docs/trail/SYSTEMD_SERVICE_MANAGEMENT_GUIDE.md +++ b/docs/trail/SYSTEMD_SERVICE_MANAGEMENT_GUIDE.md @@ -8,19 +8,19 @@ systemctl status aitbc-coordinator --no-pager # Start service -sudo systemctl start aitbc-coordinator +systemctl start aitbc-coordinator # Stop service -sudo systemctl stop aitbc-coordinator +systemctl stop aitbc-coordinator # Restart service -sudo systemctl restart aitbc-coordinator +systemctl restart aitbc-coordinator # Enable service (start on boot) -sudo systemctl enable aitbc-coordinator +systemctl enable aitbc-coordinator # Disable service -sudo systemctl disable aitbc-coordinator +systemctl disable aitbc-coordinator ``` ### **Log Management with journalctl** @@ -142,7 +142,7 @@ systemctl status aitbc-coordinator --no-pager sudo journalctl -u aitbc-coordinator --since "1 hour ago" --no-pager | tail -10 # Service restart (if needed) -sudo systemctl restart aitbc-coordinator +systemctl restart aitbc-coordinator sleep 5 systemctl status aitbc-coordinator --no-pager @@ -162,7 +162,7 @@ sudo journalctl -u aitbc-coordinator --since "10 minutes ago" --no-pager sudo journalctl -u aitbc-coordinator -p err --since "1 hour ago" --no-pager # 4. Restart service if needed -sudo systemctl restart aitbc-coordinator +systemctl restart aitbc-coordinator # 5. Verify functionality curl -s http://localhost:8000/health diff --git a/fix_gossip.patch b/fix_gossip.patch deleted file mode 100644 index c5f453a4..00000000 --- a/fix_gossip.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- /opt/aitbc/apps/blockchain-node/src/aitbc_chain/gossip/broker.py 2026-03-23 12:40:00.000000000 +0100 -+++ /opt/aitbc/apps/blockchain-node/src/aitbc_chain/gossip/broker.py.new 2026-03-23 12:40:00.000000000 +0100 -@@ -6,7 +6,7 @@ - import warnings - from collections import defaultdict --from contextlib import suppress -+from contextlib import suppress, asynccontextmanager - from dataclasses import dataclass - from typing import Any, Callable, Dict, List, Optional, Set diff --git a/scripts/complete-agent-protocols.sh b/scripts/deployment/complete-agent-protocols.sh similarity index 100% rename from scripts/complete-agent-protocols.sh rename to scripts/deployment/complete-agent-protocols.sh diff --git a/scripts/deploy-agent-protocols-fixed.sh b/scripts/deployment/deploy-agent-protocols-fixed.sh similarity index 100% rename from scripts/deploy-agent-protocols-fixed.sh rename to scripts/deployment/deploy-agent-protocols-fixed.sh diff --git a/scripts/deploy-agent-protocols-sudo.sh b/scripts/deployment/deploy-agent-protocols-sudo.sh similarity index 100% rename from scripts/deploy-agent-protocols-sudo.sh rename to scripts/deployment/deploy-agent-protocols-sudo.sh diff --git a/scripts/deploy-agent-protocols.sh b/scripts/deployment/deploy-agent-protocols.sh similarity index 100% rename from scripts/deploy-agent-protocols.sh rename to scripts/deployment/deploy-agent-protocols.sh diff --git a/scripts/deployment/deploy.sh b/scripts/deployment/deploy.sh new file mode 100755 index 00000000..182cd77a --- /dev/null +++ b/scripts/deployment/deploy.sh @@ -0,0 +1,392 @@ +#!/bin/bash + +# AITBC Automated Deployment Script +# This script handles automated deployment of AITBC services + +set -e + +# Configuration +ENVIRONMENT=${1:-staging} +VERSION=${2:-latest} +REGION=${3:-us-east-1} +NAMESPACE="aitbc-${ENVIRONMENT}" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +# Logging function +log() { + echo -e "${BLUE}[$(date +'%Y-%m-%d %H:%M:%S')]${NC} $1" +} + +error() { + echo -e "${RED}[ERROR]${NC} $1" + exit 1 +} + +success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +# Check prerequisites +check_prerequisites() { + log "Checking prerequisites..." + + # Check if required tools are installed + command -v docker >/dev/null 2>&1 || error "Docker is not installed" + command -v docker-compose >/dev/null 2>&1 || error "Docker Compose is not installed" + command -v kubectl >/dev/null 2>&1 || error "kubectl is not installed" + command -v helm >/dev/null 2>&1 || error "Helm is not installed" + + # Check if Docker daemon is running + docker info >/dev/null 2>&1 || error "Docker daemon is not running" + + # Check if kubectl can connect to cluster + kubectl cluster-info >/dev/null 2>&1 || error "Cannot connect to Kubernetes cluster" + + success "Prerequisites check passed" +} + +# Build Docker images +build_images() { + log "Building Docker images..." + + # Build CLI image + log "Building CLI image..." + docker build -t aitbc/cli:${VERSION} -f Dockerfile . || error "Failed to build CLI image" + + # Build service images + for service_dir in apps/*/; do + if [ -f "$service_dir/Dockerfile" ]; then + service_name=$(basename "$service_dir") + log "Building ${service_name} image..." + docker build -t aitbc/${service_name}:${VERSION} -f "$service_dir/Dockerfile" "$service_dir" || error "Failed to build ${service_name} image" + fi + done + + success "All Docker images built successfully" +} + +# Run tests +run_tests() { + log "Running tests..." + + # Run unit tests + log "Running unit tests..." + pytest tests/unit/ -v --cov=aitbc_cli --cov-report=term || error "Unit tests failed" + + # Run integration tests + log "Running integration tests..." + pytest tests/integration/ -v || error "Integration tests failed" + + # Run security tests + log "Running security tests..." + pytest tests/security/ -v || error "Security tests failed" + + # Run performance tests + log "Running performance tests..." + pytest tests/performance/test_performance_lightweight.py::TestPerformance::test_cli_performance -v || error "Performance tests failed" + + success "All tests passed" +} + +# Deploy to Kubernetes +deploy_kubernetes() { + log "Deploying to Kubernetes namespace: ${NAMESPACE}" + + # Create namespace if it doesn't exist + kubectl create namespace ${NAMESPACE} --dry-run=client -o yaml | kubectl apply -f - + + # Apply secrets + log "Applying secrets..." + kubectl apply -f k8s/secrets/ -n ${NAMESPACE} || error "Failed to apply secrets" + + # Apply configmaps + log "Applying configmaps..." + kubectl apply -f k8s/configmaps/ -n ${NAMESPACE} || error "Failed to apply configmaps" + + # Deploy database + log "Deploying database..." + helm repo add bitnami https://charts.bitnami.com/bitnami + helm upgrade --install postgres bitnami/postgresql \ + --namespace ${NAMESPACE} \ + --set auth.postgresPassword=${POSTGRES_PASSWORD} \ + --set auth.database=aitbc \ + --set primary.persistence.size=20Gi \ + --set primary.resources.requests.memory=2Gi \ + --set primary.resources.requests.cpu=1000m \ + --wait || error "Failed to deploy database" + + # Deploy Redis + log "Deploying Redis..." + helm upgrade --install redis bitnami/redis \ + --namespace ${NAMESPACE} \ + --set auth.password=${REDIS_PASSWORD} \ + --set master.persistence.size=8Gi \ + --set master.resources.requests.memory=512Mi \ + --set master.resources.requests.cpu=500m \ + --wait || error "Failed to deploy Redis" + + # Deploy core services + log "Deploying core services..." + + # Deploy blockchain services + for service in blockchain-node consensus-node network-node; do + log "Deploying ${service}..." + envsubst < k8s/deployments/${service}.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy ${service}" + kubectl rollout status deployment/${service} -n ${NAMESPACE} --timeout=300s || error "Failed to rollout ${service}" + done + + # Deploy coordinator + log "Deploying coordinator-api..." + envsubst < k8s/deployments/coordinator-api.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy coordinator-api" + kubectl rollout status deployment/coordinator-api -n ${NAMESPACE} --timeout=300s || error "Failed to rollout coordinator-api" + + # Deploy production services + for service in exchange-integration compliance-service trading-engine; do + log "Deploying ${service}..." + envsubst < k8s/deployments/${service}.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy ${service}" + kubectl rollout status deployment/${service} -n ${NAMESPACE} --timeout=300s || error "Failed to rollout ${service}" + done + + # Deploy plugin ecosystem + for service in plugin-registry plugin-marketplace plugin-security plugin-analytics; do + log "Deploying ${service}..." + envsubst < k8s/deployments/${service}.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy ${service}" + kubectl rollout status deployment/${service} -n ${NAMESPACE} --timeout=300s || error "Failed to rollout ${service}" + done + + # Deploy global infrastructure + for service in global-infrastructure global-ai-agents multi-region-load-balancer; do + log "Deploying ${service}..." + envsubst < k8s/deployments/${service}.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy ${service}" + kubectl rollout status deployment/${service} -n ${NAMESPACE} --timeout=300s || error "Failed to rollout ${service}" + done + + # Deploy explorer + log "Deploying explorer..." + envsubst < k8s/deployments/explorer.yaml | kubectl apply -f - -n ${NAMESPACE} || error "Failed to deploy explorer" + kubectl rollout status deployment/explorer -n ${NAMESPACE} --timeout=300s || error "Failed to rollout explorer" + + success "Kubernetes deployment completed" +} + +# Deploy with Docker Compose +deploy_docker_compose() { + log "Deploying with Docker Compose..." + + # Set environment variables + export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-aitbc123} + export REDIS_PASSWORD=${REDIS_PASSWORD:-aitbc123} + export GRAFANA_PASSWORD=${GRAFANA_PASSWORD:-admin} + + # Stop existing services + log "Stopping existing services..." + docker-compose down || true + + # Start services + log "Starting services..." + docker-compose up -d || error "Failed to start services" + + # Wait for services to be healthy + log "Waiting for services to be healthy..." + sleep 30 + + # Check service health + for service in postgres redis blockchain-node coordinator-api exchange-integration; do + log "Checking ${service} health..." + if ! docker-compose ps ${service} | grep -q "Up"; then + error "Service ${service} is not running" + fi + done + + success "Docker Compose deployment completed" +} + +# Run health checks +run_health_checks() { + log "Running health checks..." + + if command -v kubectl >/dev/null 2>&1 && kubectl cluster-info >/dev/null 2>&1; then + # Kubernetes health checks + log "Checking Kubernetes deployment health..." + + # Check pod status + kubectl get pods -n ${NAMESPACE} || error "Failed to get pod status" + + # Check service health + services=("coordinator-api" "exchange-integration" "trading-engine" "plugin-registry") + for service in "${services[@]}"; do + log "Checking ${service} health..." + kubectl get pods -n ${NAMESPACE} -l app=${service} -o jsonpath='{.items[0].status.phase}' | grep -q "Running" || error "${service} pods are not running" + + # Check service endpoint + service_url=$(kubectl get svc ${service} -n ${NAMESPACE} -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null || echo "") + if [ -n "$service_url" ]; then + curl -f http://${service_url}/health >/dev/null 2>&1 || error "${service} health check failed" + fi + done + + else + # Docker Compose health checks + log "Checking Docker Compose deployment health..." + + services=("coordinator-api" "exchange-integration" "trading-engine" "plugin-registry") + for service in "${services[@]}"; do + log "Checking ${service} health..." + if ! docker-compose ps ${service} | grep -q "Up"; then + error "Service ${service} is not running" + fi + + # Check health endpoint + port=$(docker-compose port ${service} | cut -d: -f2) + curl -f http://localhost:${port}/health >/dev/null 2>&1 || error "${service} health check failed" + done + fi + + success "All health checks passed" +} + +# Run smoke tests +run_smoke_tests() { + log "Running smoke tests..." + + # Test CLI functionality + log "Testing CLI functionality..." + docker-compose exec aitbc-cli python -m aitbc_cli.main --help >/dev/null || error "CLI smoke test failed" + + # Test API endpoints + log "Testing API endpoints..." + + # Test coordinator API + coordinator_port=$(docker-compose port coordinator-api | cut -d: -f2) + curl -f http://localhost:${coordinator_port}/health >/dev/null || error "Coordinator API smoke test failed" + + # Test exchange API + exchange_port=$(docker-compose port exchange-integration | cut -d: -f2) + curl -f http://localhost:${exchange_port}/health >/dev/null || error "Exchange API smoke test failed" + + # Test plugin registry + plugin_port=$(docker-compose port plugin-registry | cut -d: -f2) + curl -f http://localhost:${plugin_port}/health >/dev/null || error "Plugin registry smoke test failed" + + success "Smoke tests passed" +} + +# Rollback deployment +rollback() { + log "Rolling back deployment..." + + if command -v kubectl >/dev/null 2>&1 && kubectl cluster-info >/dev/null 2>&1; then + # Kubernetes rollback + log "Rolling back Kubernetes deployment..." + + services=("coordinator-api" "exchange-integration" "trading-engine" "plugin-registry") + for service in "${services[@]}"; do + log "Rolling back ${service}..." + kubectl rollout undo deployment/${service} -n ${NAMESPACE} || error "Failed to rollback ${service}" + kubectl rollout status deployment/${service} -n ${NAMESPACE} --timeout=300s || error "Failed to rollback ${service}" + done + + else + # Docker Compose rollback + log "Rolling back Docker Compose deployment..." + docker-compose down || error "Failed to stop services" + + # Restart with previous version (assuming it's tagged as 'previous') + export VERSION=previous + deploy_docker_compose + fi + + success "Rollback completed" +} + +# Cleanup +cleanup() { + log "Cleaning up..." + + # Remove unused Docker images + docker image prune -f || true + + # Remove unused Docker volumes + docker volume prune -f || true + + success "Cleanup completed" +} + +# Main deployment function +main() { + log "Starting AITBC deployment..." + log "Environment: ${ENVIRONMENT}" + log "Version: ${VERSION}" + log "Region: ${REGION}" + + case "${ENVIRONMENT}" in + "local"|"docker") + check_prerequisites + build_images + run_tests + deploy_docker_compose + run_health_checks + run_smoke_tests + ;; + "staging"|"production") + check_prerequisites + build_images + run_tests + deploy_kubernetes + run_health_checks + run_smoke_tests + ;; + "rollback") + rollback + ;; + "cleanup") + cleanup + ;; + *) + error "Unknown environment: ${ENVIRONMENT}. Use 'local', 'docker', 'staging', 'production', 'rollback', or 'cleanup'" + ;; + esac + + success "Deployment completed successfully!" + + # Display deployment information + log "Deployment Information:" + log "Environment: ${ENVIRONMENT}" + log "Version: ${VERSION}" + log "Namespace: ${NAMESPACE}" + + if [ "${ENVIRONMENT}" = "docker" ]; then + log "Services are running on:" + log " Coordinator API: http://localhost:8001" + log " Exchange Integration: http://localhost:8010" + log " Trading Engine: http://localhost:8012" + log " Plugin Registry: http://localhost:8013" + log " Plugin Marketplace: http://localhost:8014" + log " Explorer: http://localhost:8020" + log " Grafana: http://localhost:3000 (admin/admin)" + log " Prometheus: http://localhost:9090" + fi +} + +# Handle script interruption +trap 'error "Script interrupted"' INT TERM + +# Export environment variables for envsubst +export POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-aitbc123} +export REDIS_PASSWORD=${REDIS_PASSWORD:-aitbc123} +export GRAFANA_PASSWORD=${GRAFANA_PASSWORD:-admin} +export VERSION=${VERSION} +export NAMESPACE=${NAMESPACE} + +# Run main function +main "$@" diff --git a/scripts/deploy/.env.deploy.example b/scripts/deployment/deploy/.env.deploy.example similarity index 100% rename from scripts/deploy/.env.deploy.example rename to scripts/deployment/deploy/.env.deploy.example diff --git a/scripts/deploy/cleanup-deployment.sh b/scripts/deployment/deploy/cleanup-deployment.sh similarity index 100% rename from scripts/deploy/cleanup-deployment.sh rename to scripts/deployment/deploy/cleanup-deployment.sh diff --git a/scripts/deploy/container-deploy.py b/scripts/deployment/deploy/container-deploy.py similarity index 100% rename from scripts/deploy/container-deploy.py rename to scripts/deployment/deploy/container-deploy.py diff --git a/scripts/deploy/deploy-all-remote.sh b/scripts/deployment/deploy/deploy-all-remote.sh similarity index 100% rename from scripts/deploy/deploy-all-remote.sh rename to scripts/deployment/deploy/deploy-all-remote.sh diff --git a/scripts/deploy/deploy-blockchain-and-explorer.sh b/scripts/deployment/deploy/deploy-blockchain-and-explorer.sh similarity index 100% rename from scripts/deploy/deploy-blockchain-and-explorer.sh rename to scripts/deployment/deploy/deploy-blockchain-and-explorer.sh diff --git a/scripts/deploy/deploy-blockchain-explorer.sh b/scripts/deployment/deploy/deploy-blockchain-explorer.sh similarity index 100% rename from scripts/deploy/deploy-blockchain-explorer.sh rename to scripts/deployment/deploy/deploy-blockchain-explorer.sh diff --git a/scripts/deploy/deploy-blockchain-remote.sh b/scripts/deployment/deploy/deploy-blockchain-remote.sh similarity index 100% rename from scripts/deploy/deploy-blockchain-remote.sh rename to scripts/deployment/deploy/deploy-blockchain-remote.sh diff --git a/scripts/deploy/deploy-blockchain.sh b/scripts/deployment/deploy/deploy-blockchain.sh similarity index 100% rename from scripts/deploy/deploy-blockchain.sh rename to scripts/deployment/deploy/deploy-blockchain.sh diff --git a/scripts/deploy/deploy-direct.sh b/scripts/deployment/deploy/deploy-direct.sh similarity index 100% rename from scripts/deploy/deploy-direct.sh rename to scripts/deployment/deploy/deploy-direct.sh diff --git a/scripts/deploy/deploy-domain.sh b/scripts/deployment/deploy/deploy-domain.sh similarity index 100% rename from scripts/deploy/deploy-domain.sh rename to scripts/deployment/deploy/deploy-domain.sh diff --git a/scripts/deploy/deploy-exchange.sh b/scripts/deployment/deploy/deploy-exchange.sh similarity index 100% rename from scripts/deploy/deploy-exchange.sh rename to scripts/deployment/deploy/deploy-exchange.sh diff --git a/scripts/deploy/deploy-explorer-remote.sh b/scripts/deployment/deploy/deploy-explorer-remote.sh similarity index 100% rename from scripts/deploy/deploy-explorer-remote.sh rename to scripts/deployment/deploy/deploy-explorer-remote.sh diff --git a/scripts/deploy/deploy-explorer.sh b/scripts/deployment/deploy/deploy-explorer.sh similarity index 100% rename from scripts/deploy/deploy-explorer.sh rename to scripts/deployment/deploy/deploy-explorer.sh diff --git a/scripts/deploy/deploy-first-node.sh b/scripts/deployment/deploy/deploy-first-node.sh similarity index 100% rename from scripts/deploy/deploy-first-node.sh rename to scripts/deployment/deploy/deploy-first-node.sh diff --git a/scripts/deploy/deploy-in-container.sh b/scripts/deployment/deploy/deploy-in-container.sh similarity index 100% rename from scripts/deploy/deploy-in-container.sh rename to scripts/deployment/deploy/deploy-in-container.sh diff --git a/scripts/deploy/deploy-modern-explorer.sh b/scripts/deployment/deploy/deploy-modern-explorer.sh similarity index 100% rename from scripts/deploy/deploy-modern-explorer.sh rename to scripts/deployment/deploy/deploy-modern-explorer.sh diff --git a/scripts/deploy/deploy-nginx-reverse-proxy.sh b/scripts/deployment/deploy/deploy-nginx-reverse-proxy.sh similarity index 100% rename from scripts/deploy/deploy-nginx-reverse-proxy.sh rename to scripts/deployment/deploy/deploy-nginx-reverse-proxy.sh diff --git a/scripts/deploy/deploy-production.sh b/scripts/deployment/deploy/deploy-production.sh similarity index 100% rename from scripts/deploy/deploy-production.sh rename to scripts/deployment/deploy/deploy-production.sh diff --git a/scripts/deploy/deploy-remote-build.sh b/scripts/deployment/deploy/deploy-remote-build.sh similarity index 100% rename from scripts/deploy/deploy-remote-build.sh rename to scripts/deployment/deploy/deploy-remote-build.sh diff --git a/scripts/deploy/deploy-second-node.sh b/scripts/deployment/deploy/deploy-second-node.sh similarity index 100% rename from scripts/deploy/deploy-second-node.sh rename to scripts/deployment/deploy/deploy-second-node.sh diff --git a/scripts/deploy/deploy-to-aitbc-container.sh b/scripts/deployment/deploy/deploy-to-aitbc-container.sh similarity index 100% rename from scripts/deploy/deploy-to-aitbc-container.sh rename to scripts/deployment/deploy/deploy-to-aitbc-container.sh diff --git a/scripts/deploy/deploy-to-container.sh b/scripts/deployment/deploy/deploy-to-container.sh similarity index 100% rename from scripts/deploy/deploy-to-container.sh rename to scripts/deployment/deploy/deploy-to-container.sh diff --git a/scripts/deploy/deploy-to-container.sh.example b/scripts/deployment/deploy/deploy-to-container.sh.example similarity index 100% rename from scripts/deploy/deploy-to-container.sh.example rename to scripts/deployment/deploy/deploy-to-container.sh.example diff --git a/scripts/deploy/deploy-to-server.sh b/scripts/deployment/deploy/deploy-to-server.sh similarity index 100% rename from scripts/deploy/deploy-to-server.sh rename to scripts/deployment/deploy/deploy-to-server.sh diff --git a/scripts/deploy/deploy_container_with_miner.py b/scripts/deployment/deploy/deploy_container_with_miner.py similarity index 100% rename from scripts/deploy/deploy_container_with_miner.py rename to scripts/deployment/deploy/deploy_container_with_miner.py diff --git a/scripts/deploy/deploy_gpu_to_container.py b/scripts/deployment/deploy/deploy_gpu_to_container.py similarity index 100% rename from scripts/deploy/deploy_gpu_to_container.py rename to scripts/deployment/deploy/deploy_gpu_to_container.py diff --git a/scripts/deploy/setup-gossip-relay.sh b/scripts/deployment/deploy/setup-gossip-relay.sh similarity index 100% rename from scripts/deploy/setup-gossip-relay.sh rename to scripts/deployment/deploy/setup-gossip-relay.sh diff --git a/scripts/deploy/test-deployment.sh b/scripts/deployment/deploy/test-deployment.sh similarity index 100% rename from scripts/deploy/test-deployment.sh rename to scripts/deployment/deploy/test-deployment.sh diff --git a/scripts/implement-agent-protocols.sh b/scripts/deployment/implement-agent-protocols.sh similarity index 100% rename from scripts/implement-agent-protocols.sh rename to scripts/deployment/implement-agent-protocols.sh diff --git a/scripts/implement-ai-trading-analytics.sh b/scripts/deployment/implement-ai-trading-analytics.sh similarity index 100% rename from scripts/implement-ai-trading-analytics.sh rename to scripts/deployment/implement-ai-trading-analytics.sh diff --git a/scripts/deployment/production-deploy.sh b/scripts/deployment/production-deploy.sh new file mode 100755 index 00000000..4c2dd235 --- /dev/null +++ b/scripts/deployment/production-deploy.sh @@ -0,0 +1,588 @@ +#!/bin/bash + +# AITBC Production Deployment Script +# This script handles production deployment with zero-downtime + +set -e + +# Production Configuration +ENVIRONMENT="production" +VERSION=${1:-latest} +REGION=${2:-us-east-1} +NAMESPACE="aitbc-prod" +DOMAIN="aitbc.dev" + +# Colors for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' + +# Logging +log() { + echo -e "${BLUE}[$(date +'%Y-%m-%d %H:%M:%S')]${NC} $1" +} + +error() { + echo -e "${RED}[ERROR]${NC} $1" + exit 1 +} + +success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +# Pre-deployment checks +pre_deployment_checks() { + log "Running pre-deployment checks..." + + # Check if we're on production branch + current_branch=$(git branch --show-current) + if [ "$current_branch" != "production" ]; then + error "Must be on production branch to deploy to production" + fi + + # Check if all tests pass + log "Running tests..." + pytest tests/unit/ -v --tb=short || error "Unit tests failed" + pytest tests/integration/ -v --tb=short || error "Integration tests failed" + pytest tests/security/ -v --tb=short || error "Security tests failed" + pytest tests/performance/test_performance_lightweight.py::TestPerformance::test_cli_performance -v --tb=short || error "Performance tests failed" + + # Check if production infrastructure is ready + log "Checking production infrastructure..." + kubectl get nodes | grep -q "Ready" || error "Production nodes not ready" + kubectl get namespace $NAMESPACE || kubectl create namespace $NAMESPACE + + success "Pre-deployment checks passed" +} + +# Backup current deployment +backup_current_deployment() { + log "Backing up current deployment..." + + # Create backup directory + backup_dir="/opt/aitbc/backups/pre-deployment-$(date +%Y%m%d_%H%M%S)" + mkdir -p $backup_dir + + # Backup current configuration + kubectl get all -n $NAMESPACE -o yaml > $backup_dir/current-deployment.yaml + + # Backup database + pg_dump $DATABASE_URL | gzip > $backup_dir/database_backup.sql.gz + + # Backup application data + kubectl exec -n $NAMESPACE deployment/coordinator-api -- tar -czf /tmp/app_data_backup.tar.gz /app/data + kubectl cp $NAMESPACE/deployment/coordinator-api:/tmp/app_data_backup.tar.gz $backup_dir/app_data_backup.tar.gz + + success "Backup completed: $backup_dir" +} + +# Build production images +build_production_images() { + log "Building production images..." + + # Build CLI image + docker build -t aitbc/cli:$VERSION -f Dockerfile --target production . || error "Failed to build CLI image" + + # Build service images + for service_dir in apps/*/; do + if [ -f "$service_dir/Dockerfile" ]; then + service_name=$(basename "$service_dir") + log "Building $service_name image..." + docker build -t aitbc/$service_name:$VERSION -f "$service_dir/Dockerfile" "$service_dir" || error "Failed to build $service_name image" + fi + done + + # Push images to registry + log "Pushing images to registry..." + docker push aitbc/cli:$VERSION + + for service_dir in apps/*/; do + if [ -f "$service_dir/Dockerfile" ]; then + service_name=$(basename "$service_dir") + docker push aitbc/$service_name:$VERSION + fi + done + + success "Production images built and pushed" +} + +# Deploy database +deploy_database() { + log "Deploying database..." + + # Deploy PostgreSQL + helm upgrade --install postgres bitnami/postgresql \ + --namespace $NAMESPACE \ + --set auth.postgresPassword=$POSTGRES_PASSWORD \ + --set auth.database=aitbc_prod \ + --set primary.persistence.size=100Gi \ + --set primary.resources.requests.memory=8Gi \ + --set primary.resources.requests.cpu=2000m \ + --set primary.resources.limits.memory=16Gi \ + --set primary.resources.limits.cpu=4000m \ + --set readReplicas.replicaCount=1 \ + --set readReplicas.persistence.size=50Gi \ + --wait \ + --timeout 10m || error "Failed to deploy PostgreSQL" + + # Deploy Redis + helm upgrade --install redis bitnami/redis \ + --namespace $NAMESPACE \ + --set auth.password=$REDIS_PASSWORD \ + --set master.persistence.size=20Gi \ + --set master.resources.requests.memory=2Gi \ + --set master.resources.requests.cpu=1000m \ + --set master.resources.limits.memory=4Gi \ + --set master.resources.limits.cpu=2000m \ + --set replica.replicaCount=2 \ + --wait \ + --timeout 5m || error "Failed to deploy Redis" + + success "Database deployed successfully" +} + +# Deploy core services +deploy_core_services() { + log "Deploying core services..." + + # Deploy blockchain services + for service in blockchain-node consensus-node network-node; do + log "Deploying $service..." + + # Create deployment manifest + cat > /tmp/$service-deployment.yaml << EOF +apiVersion: apps/v1 +kind: Deployment +metadata: + name: $service + namespace: $NAMESPACE +spec: + replicas: 2 + selector: + matchLabels: + app: $service + template: + metadata: + labels: + app: $service + spec: + containers: + - name: $service + image: aitbc/$service:$VERSION + ports: + - containerPort: 8007 + name: http + env: + - name: NODE_ENV + value: "production" + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: database-url + - name: REDIS_URL + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: redis-url + resources: + requests: + memory: "2Gi" + cpu: "1000m" + limits: + memory: "4Gi" + cpu: "2000m" + livenessProbe: + httpGet: + path: /health + port: 8007 + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /health + port: 8007 + initialDelaySeconds: 5 + periodSeconds: 5 +--- +apiVersion: v1 +kind: Service +metadata: + name: $service + namespace: $NAMESPACE +spec: + selector: + app: $service + ports: + - port: 8007 + targetPort: 8007 + type: ClusterIP +EOF + + # Apply deployment + kubectl apply -f /tmp/$service-deployment.yaml -n $NAMESPACE || error "Failed to deploy $service" + + # Wait for deployment + kubectl rollout status deployment/$service -n $NAMESPACE --timeout=300s || error "Failed to rollout $service" + + rm /tmp/$service-deployment.yaml + done + + success "Core services deployed successfully" +} + +# Deploy application services +deploy_application_services() { + log "Deploying application services..." + + services=("coordinator-api" "exchange-integration" "compliance-service" "trading-engine" "plugin-registry" "plugin-marketplace" "plugin-security" "plugin-analytics" "global-infrastructure" "global-ai-agents" "multi-region-load-balancer") + + for service in "${services[@]}"; do + log "Deploying $service..." + + # Determine port + case $service in + "coordinator-api") port=8001 ;; + "exchange-integration") port=8010 ;; + "compliance-service") port=8011 ;; + "trading-engine") port=8012 ;; + "plugin-registry") port=8013 ;; + "plugin-marketplace") port=8014 ;; + "plugin-security") port=8015 ;; + "plugin-analytics") port=8016 ;; + "global-infrastructure") port=8017 ;; + "global-ai-agents") port=8018 ;; + "multi-region-load-balancer") port=8019 ;; + esac + + # Create deployment manifest + cat > /tmp/$service-deployment.yaml << EOF +apiVersion: apps/v1 +kind: Deployment +metadata: + name: $service + namespace: $NAMESPACE +spec: + replicas: 3 + selector: + matchLabels: + app: $service + template: + metadata: + labels: + app: $service + spec: + containers: + - name: $service + image: aitbc/$service:$VERSION + ports: + - containerPort: $port + name: http + env: + - name: NODE_ENV + value: "production" + - name: DATABASE_URL + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: database-url + - name: REDIS_URL + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: redis-url + - name: JWT_SECRET + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: jwt-secret + - name: ENCRYPTION_KEY + valueFrom: + secretKeyRef: + name: aitbc-secrets + key: encryption-key + resources: + requests: + memory: "1Gi" + cpu: "500m" + limits: + memory: "2Gi" + cpu: "1000m" + livenessProbe: + httpGet: + path: /health + port: $port + initialDelaySeconds: 30 + periodSeconds: 10 + readinessProbe: + httpGet: + path: /health + port: $port + initialDelaySeconds: 5 + periodSeconds: 5 +--- +apiVersion: v1 +kind: Service +metadata: + name: $service + namespace: $NAMESPACE +spec: + selector: + app: $service + ports: + - port: $port + targetPort: $port + type: ClusterIP +EOF + + # Apply deployment + kubectl apply -f /tmp/$service-deployment.yaml -n $NAMESPACE || error "Failed to deploy $service" + + # Wait for deployment + kubectl rollout status deployment/$service -n $NAMESPACE --timeout=300s || error "Failed to rollout $service" + + rm /tmp/$service-deployment.yaml + done + + success "Application services deployed successfully" +} + +# Deploy ingress and load balancer +deploy_ingress() { + log "Deploying ingress and load balancer..." + + # Create ingress manifest + cat > /tmp/ingress.yaml << EOF +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: aitbc-ingress + namespace: $NAMESPACE + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/cluster-issuer: "letsencrypt-prod" + nginx.ingress.kubernetes.io/rate-limit: "100" + nginx.ingress.kubernetes.io/rate-limit-window: "1m" +spec: + tls: + - hosts: + - api.$DOMAIN + - marketplace.$DOMAIN + - explorer.$DOMAIN + secretName: aitbc-tls + rules: + - host: api.$DOMAIN + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: coordinator-api + port: + number: 8001 + - host: marketplace.$DOMAIN + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: plugin-marketplace + port: + number: 8014 + - host: explorer.$DOMAIN + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: explorer + port: + number: 8020 +EOF + + # Apply ingress + kubectl apply -f /tmp/ingress.yaml -n $NAMESPACE || error "Failed to deploy ingress" + + rm /tmp/ingress.yaml + + success "Ingress deployed successfully" +} + +# Deploy monitoring +deploy_monitoring() { + log "Deploying monitoring stack..." + + # Deploy Prometheus + helm upgrade --install prometheus prometheus-community/kube-prometheus-stack \ + --namespace $NAMESPACE \ + --create-namespace \ + --set prometheus.prometheus.spec.retention=30d \ + --set prometheus.prometheus.spec.storageSpec.volumeClaimTemplate.spec.resources.requests.storage=50Gi \ + --set grafana.adminPassword=$GRAFANA_PASSWORD \ + --set grafana.persistence.size=10Gi \ + --set defaultRules.create=true \ + --wait \ + --timeout 10m || error "Failed to deploy monitoring" + + # Import Grafana dashboards + log "Importing Grafana dashboards..." + + # Create dashboard configmaps + kubectl create configmap grafana-dashboards \ + --from-file=monitoring/grafana/dashboards/ \ + -n $NAMESPACE \ + --dry-run=client -o yaml | kubectl apply -f - + + success "Monitoring deployed successfully" +} + +# Run post-deployment tests +post_deployment_tests() { + log "Running post-deployment tests..." + + # Wait for all services to be ready + kubectl wait --for=condition=ready pod -l app!=pod -n $NAMESPACE --timeout=600s + + # Test API endpoints + endpoints=( + "coordinator-api:8001" + "exchange-integration:8010" + "trading-engine:8012" + "plugin-registry:8013" + "plugin-marketplace:8014" + ) + + for service_port in "${endpoints[@]}"; do + service=$(echo $service_port | cut -d: -f1) + port=$(echo $service_port | cut -d: -f2) + + log "Testing $service..." + + # Port-forward and test + kubectl port-forward -n $NAMESPACE deployment/$service $port:8007 & + port_forward_pid=$! + + sleep 5 + + if curl -f -s http://localhost:$port/health > /dev/null; then + success "$service is healthy" + else + error "$service health check failed" + fi + + # Kill port-forward + kill $port_forward_pid 2>/dev/null || true + done + + # Test external endpoints + external_endpoints=( + "https://api.$DOMAIN/health" + "https://marketplace.$DOMAIN/api/v1/marketplace/featured" + ) + + for endpoint in "${external_endpoints[@]}"; do + log "Testing $endpoint..." + + if curl -f -s $endpoint > /dev/null; then + success "$endpoint is responding" + else + error "$endpoint is not responding" + fi + done + + success "Post-deployment tests passed" +} + +# Create secrets +create_secrets() { + log "Creating secrets..." + + # Create secret from environment variables + kubectl create secret generic aitbc-secrets \ + --from-literal=database-url="$DATABASE_URL" \ + --from-literal=redis-url="$REDIS_URL" \ + --from-literal=jwt-secret="$JWT_SECRET" \ + --from-literal=encryption-key="$ENCRYPTION_KEY" \ + --from-literal=postgres-password="$POSTGRES_PASSWORD" \ + --from-literal=redis-password="$REDIS_PASSWORD" \ + --namespace $NAMESPACE \ + --dry-run=client -o yaml | kubectl apply -f - + + success "Secrets created" +} + +# Main deployment function +main() { + log "Starting AITBC production deployment..." + log "Environment: $ENVIRONMENT" + log "Version: $VERSION" + log "Region: $REGION" + log "Domain: $DOMAIN" + + # Check prerequisites + command -v kubectl >/dev/null 2>&1 || error "kubectl is not installed" + command -v helm >/dev/null 2>&1 || error "Helm is not installed" + kubectl cluster-info >/dev/null 2>&1 || error "Cannot connect to Kubernetes cluster" + + # Run deployment steps + pre_deployment_checks + create_secrets + backup_current_deployment + build_production_images + deploy_database + deploy_core_services + deploy_application_services + deploy_ingress + deploy_monitoring + post_deployment_tests + + success "Production deployment completed successfully!" + + # Display deployment information + log "Deployment Information:" + log "Environment: $ENVIRONMENT" + log "Version: $VERSION" + log "Namespace: $NAMESPACE" + log "Domain: $DOMAIN" + log "" + log "Services are available at:" + log " API: https://api.$DOMAIN" + log " Marketplace: https://marketplace.$DOMAIN" + log " Explorer: https://explorer.$DOMAIN" + log " Grafana: https://grafana.$DOMAIN" + log "" + log "To check deployment status:" + log " kubectl get pods -n $NAMESPACE" + log " kubectl get services -n $NAMESPACE" + log "" + log "To view logs:" + log " kubectl logs -f deployment/coordinator-api -n $NAMESPACE" +} + +# Handle script interruption +trap 'error "Script interrupted"' INT TERM + +# Export environment variables +export DATABASE_URL=${DATABASE_URL} +export REDIS_URL=${REDIS_URL} +export JWT_SECRET=${JWT_SECRET} +export ENCRYPTION_KEY=${ENCRYPTION_KEY} +export POSTGRES_PASSWORD=${POSTGRES_PASSWORD} +export REDIS_PASSWORD=${REDIS_PASSWORD} +export GRAFANA_PASSWORD=${GRAFANA_PASSWORD} +export VERSION=${VERSION} +export NAMESPACE=${NAMESPACE} +export DOMAIN=${DOMAIN} + +# Run main function +main "$@" diff --git a/scripts/dev-services.sh b/scripts/development/dev-services.sh similarity index 100% rename from scripts/dev-services.sh rename to scripts/development/dev-services.sh diff --git a/scripts/start-aitbc-dev.sh b/scripts/development/start-aitbc-dev.sh similarity index 100% rename from scripts/start-aitbc-dev.sh rename to scripts/development/start-aitbc-dev.sh diff --git a/scripts/start-aitbc-full.sh b/scripts/development/start-aitbc-full.sh similarity index 100% rename from scripts/start-aitbc-full.sh rename to scripts/development/start-aitbc-full.sh diff --git a/scripts/start-coordinator-api.sh b/scripts/development/start-coordinator-api.sh similarity index 100% rename from scripts/start-coordinator-api.sh rename to scripts/development/start-coordinator-api.sh diff --git a/scripts/stop-aitbc-dev-enhanced.sh b/scripts/development/stop-aitbc-dev-enhanced.sh similarity index 100% rename from scripts/stop-aitbc-dev-enhanced.sh rename to scripts/development/stop-aitbc-dev-enhanced.sh diff --git a/scripts/stop-aitbc-dev.sh b/scripts/development/stop-aitbc-dev.sh similarity index 100% rename from scripts/stop-aitbc-dev.sh rename to scripts/development/stop-aitbc-dev.sh diff --git a/scripts/manage-services.sh b/scripts/manage-services.sh index a65ea73c..9a4bb99c 100755 --- a/scripts/manage-services.sh +++ b/scripts/manage-services.sh @@ -4,30 +4,30 @@ case "${1:-help}" in "start") echo "Starting AITBC services..." - sudo systemctl start aitbc-coordinator-api.service - sudo systemctl start aitbc-blockchain-node.service - sudo systemctl start aitbc-blockchain-rpc.service + systemctl start aitbc-coordinator-api.service + systemctl start aitbc-blockchain-node.service + systemctl start aitbc-blockchain-rpc.service echo "Services started" ;; "stop") echo "Stopping AITBC services..." - sudo systemctl stop aitbc-coordinator-api.service - sudo systemctl stop aitbc-blockchain-node.service - sudo systemctl stop aitbc-blockchain-rpc.service + systemctl stop aitbc-coordinator-api.service + systemctl stop aitbc-blockchain-node.service + systemctl stop aitbc-blockchain-rpc.service echo "Services stopped" ;; "restart") echo "Restarting AITBC services..." - sudo systemctl restart aitbc-coordinator-api.service - sudo systemctl restart aitbc-blockchain-node.service - sudo systemctl restart aitbc-blockchain-rpc.service + systemctl restart aitbc-coordinator-api.service + systemctl restart aitbc-blockchain-node.service + systemctl restart aitbc-blockchain-rpc.service echo "Services restarted" ;; "status") echo "=== AITBC Services Status ===" - sudo systemctl status aitbc-coordinator-api.service --no-pager - sudo systemctl status aitbc-blockchain-node.service --no-pager - sudo systemctl status aitbc-blockchain-rpc.service --no-pager + systemctl status aitbc-coordinator-api.service --no-pager + systemctl status aitbc-blockchain-node.service --no-pager + systemctl status aitbc-blockchain-rpc.service --no-pager ;; "logs") echo "=== AITBC Service Logs ===" diff --git a/scripts/monitor-prs.py b/scripts/monitoring/monitor-prs.py similarity index 100% rename from scripts/monitor-prs.py rename to scripts/monitoring/monitor-prs.py diff --git a/scripts/nightly_health_check.sh b/scripts/monitoring/nightly_health_check.sh similarity index 100% rename from scripts/nightly_health_check.sh rename to scripts/monitoring/nightly_health_check.sh diff --git a/scripts/production_monitoring.sh b/scripts/monitoring/production_monitoring.sh similarity index 100% rename from scripts/production_monitoring.sh rename to scripts/monitoring/production_monitoring.sh diff --git a/scripts/adaptive_learning_service.py b/scripts/services/adaptive_learning_service.py similarity index 100% rename from scripts/adaptive_learning_service.py rename to scripts/services/adaptive_learning_service.py diff --git a/scripts/gpu/deploy_gpu_all_in_one.sh b/scripts/services/gpu/deploy_gpu_all_in_one.sh similarity index 100% rename from scripts/gpu/deploy_gpu_all_in_one.sh rename to scripts/services/gpu/deploy_gpu_all_in_one.sh diff --git a/scripts/gpu/deploy_gpu_container.sh b/scripts/services/gpu/deploy_gpu_container.sh similarity index 100% rename from scripts/gpu/deploy_gpu_container.sh rename to scripts/services/gpu/deploy_gpu_container.sh diff --git a/scripts/gpu/gpu_exchange_status.py b/scripts/services/gpu/gpu_exchange_status.py similarity index 100% rename from scripts/gpu/gpu_exchange_status.py rename to scripts/services/gpu/gpu_exchange_status.py diff --git a/scripts/gpu/gpu_miner_host.py b/scripts/services/gpu/gpu_miner_host.py similarity index 100% rename from scripts/gpu/gpu_miner_host.py rename to scripts/services/gpu/gpu_miner_host.py diff --git a/scripts/gpu/gpu_miner_host_wrapper.sh b/scripts/services/gpu/gpu_miner_host_wrapper.sh similarity index 100% rename from scripts/gpu/gpu_miner_host_wrapper.sh rename to scripts/services/gpu/gpu_miner_host_wrapper.sh diff --git a/scripts/gpu/gpu_registry_demo.py b/scripts/services/gpu/gpu_registry_demo.py similarity index 100% rename from scripts/gpu/gpu_registry_demo.py rename to scripts/services/gpu/gpu_registry_demo.py diff --git a/scripts/gpu/integrate_gpu_exchange.py b/scripts/services/gpu/integrate_gpu_exchange.py similarity index 100% rename from scripts/gpu/integrate_gpu_exchange.py rename to scripts/services/gpu/integrate_gpu_exchange.py diff --git a/scripts/gpu/miner_workflow.py b/scripts/services/gpu/miner_workflow.py similarity index 100% rename from scripts/gpu/miner_workflow.py rename to scripts/services/gpu/miner_workflow.py diff --git a/scripts/gpu/start_gpu_miner.sh b/scripts/services/gpu/start_gpu_miner.sh similarity index 100% rename from scripts/gpu/start_gpu_miner.sh rename to scripts/services/gpu/start_gpu_miner.sh diff --git a/scripts/gpu_multimodal_service.py b/scripts/services/gpu_multimodal_service.py similarity index 100% rename from scripts/gpu_multimodal_service.py rename to scripts/services/gpu_multimodal_service.py diff --git a/scripts/modality_optimization_service.py b/scripts/services/modality_optimization_service.py similarity index 100% rename from scripts/modality_optimization_service.py rename to scripts/services/modality_optimization_service.py diff --git a/scripts/multimodal_gpu_service.py b/scripts/services/multimodal_gpu_service.py similarity index 100% rename from scripts/multimodal_gpu_service.py rename to scripts/services/multimodal_gpu_service.py diff --git a/scripts/web_ui_service.py b/scripts/services/web_ui_service.py similarity index 100% rename from scripts/web_ui_service.py rename to scripts/services/web_ui_service.py diff --git a/scripts/debug-services.sh b/scripts/testing/debug-services.sh similarity index 100% rename from scripts/debug-services.sh rename to scripts/testing/debug-services.sh diff --git a/scripts/debug_performance_test.py b/scripts/testing/debug_performance_test.py similarity index 100% rename from scripts/debug_performance_test.py rename to scripts/testing/debug_performance_test.py diff --git a/drain_test.py b/scripts/testing/drain_test.py similarity index 100% rename from drain_test.py rename to scripts/testing/drain_test.py diff --git a/scripts/performance_test.py b/scripts/testing/performance_test.py similarity index 100% rename from scripts/performance_test.py rename to scripts/testing/performance_test.py diff --git a/scripts/qa-cycle.py b/scripts/testing/qa-cycle.py similarity index 100% rename from scripts/qa-cycle.py rename to scripts/testing/qa-cycle.py diff --git a/scripts/quick_test.py b/scripts/testing/quick_test.py similarity index 100% rename from scripts/quick_test.py rename to scripts/testing/quick_test.py diff --git a/run_all_tests.sh b/scripts/testing/run_all_tests.sh similarity index 100% rename from run_all_tests.sh rename to scripts/testing/run_all_tests.sh diff --git a/dev/scripts/run_test.py b/scripts/testing/run_test.py similarity index 100% rename from dev/scripts/run_test.py rename to scripts/testing/run_test.py diff --git a/scripts/scalability_validation.py b/scripts/testing/scalability_validation.py similarity index 100% rename from scripts/scalability_validation.py rename to scripts/testing/scalability_validation.py diff --git a/scripts/simple-test.sh b/scripts/testing/simple-test.sh similarity index 100% rename from scripts/simple-test.sh rename to scripts/testing/simple-test.sh diff --git a/scripts/simple_performance_test.py b/scripts/testing/simple_performance_test.py similarity index 100% rename from scripts/simple_performance_test.py rename to scripts/testing/simple_performance_test.py diff --git a/scripts/test-all-services.sh b/scripts/testing/test-all-services.sh similarity index 100% rename from scripts/test-all-services.sh rename to scripts/testing/test-all-services.sh diff --git a/scripts/test-permissions.sh b/scripts/testing/test-permissions.sh similarity index 100% rename from scripts/test-permissions.sh rename to scripts/testing/test-permissions.sh diff --git a/test_broadcaster.py b/scripts/testing/test_broadcaster.py similarity index 100% rename from test_broadcaster.py rename to scripts/testing/test_broadcaster.py diff --git a/test_coordinator_marketplace.py b/scripts/testing/test_coordinator_marketplace.py similarity index 100% rename from test_coordinator_marketplace.py rename to scripts/testing/test_coordinator_marketplace.py diff --git a/test_error.py b/scripts/testing/test_error.py similarity index 100% rename from test_error.py rename to scripts/testing/test_error.py diff --git a/scripts/test_gpu_release_direct.py b/scripts/testing/test_gpu_release_direct.py similarity index 100% rename from scripts/test_gpu_release_direct.py rename to scripts/testing/test_gpu_release_direct.py diff --git a/test_register.py b/scripts/testing/test_register.py similarity index 100% rename from test_register.py rename to scripts/testing/test_register.py diff --git a/test_send.sh b/scripts/testing/test_send.sh similarity index 100% rename from test_send.sh rename to scripts/testing/test_send.sh diff --git a/test_wallet.py b/scripts/testing/test_wallet.py similarity index 100% rename from test_wallet.py rename to scripts/testing/test_wallet.py diff --git a/scripts/check-aitbc-services.sh b/scripts/utils/check-aitbc-services.sh similarity index 100% rename from scripts/check-aitbc-services.sh rename to scripts/utils/check-aitbc-services.sh diff --git a/scripts/check-documentation-requirements.sh b/scripts/utils/check-documentation-requirements.sh similarity index 100% rename from scripts/check-documentation-requirements.sh rename to scripts/utils/check-documentation-requirements.sh diff --git a/scripts/claim-task.py b/scripts/utils/claim-task.py similarity index 100% rename from scripts/claim-task.py rename to scripts/utils/claim-task.py diff --git a/scripts/clean-sudoers-fix.sh b/scripts/utils/clean-sudoers-fix.sh similarity index 100% rename from scripts/clean-sudoers-fix.sh rename to scripts/utils/clean-sudoers-fix.sh diff --git a/scripts/cleanup_fake_gpus.py b/scripts/utils/cleanup_fake_gpus.py similarity index 100% rename from scripts/cleanup_fake_gpus.py rename to scripts/utils/cleanup_fake_gpus.py diff --git a/scripts/cleanup_fake_gpus_db.py b/scripts/utils/cleanup_fake_gpus_db.py similarity index 100% rename from scripts/cleanup_fake_gpus_db.py rename to scripts/utils/cleanup_fake_gpus_db.py diff --git a/scripts/complete-permission-fix.sh b/scripts/utils/complete-permission-fix.sh similarity index 100% rename from scripts/complete-permission-fix.sh rename to scripts/utils/complete-permission-fix.sh diff --git a/scripts/create_structured_issue.py b/scripts/utils/create_structured_issue.py similarity index 100% rename from scripts/create_structured_issue.py rename to scripts/utils/create_structured_issue.py diff --git a/scripts/deploy_enhanced_genesis.py b/scripts/utils/deploy_enhanced_genesis.py similarity index 100% rename from scripts/deploy_enhanced_genesis.py rename to scripts/utils/deploy_enhanced_genesis.py diff --git a/scripts/detect-aitbc-user.sh b/scripts/utils/detect-aitbc-user.sh similarity index 100% rename from scripts/detect-aitbc-user.sh rename to scripts/utils/detect-aitbc-user.sh diff --git a/scripts/end_to_end_workflow.py b/scripts/utils/end_to_end_workflow.py similarity index 100% rename from scripts/end_to_end_workflow.py rename to scripts/utils/end_to_end_workflow.py diff --git a/scripts/final-sudoers-fix.sh b/scripts/utils/final-sudoers-fix.sh similarity index 100% rename from scripts/final-sudoers-fix.sh rename to scripts/utils/final-sudoers-fix.sh diff --git a/scripts/fix-permissions.sh b/scripts/utils/fix-permissions.sh similarity index 100% rename from scripts/fix-permissions.sh rename to scripts/utils/fix-permissions.sh diff --git a/scripts/fix-startup-issues.sh b/scripts/utils/fix-startup-issues.sh similarity index 100% rename from scripts/fix-startup-issues.sh rename to scripts/utils/fix-startup-issues.sh diff --git a/scripts/fix-sudoers-syntax.sh b/scripts/utils/fix-sudoers-syntax.sh similarity index 100% rename from scripts/fix-sudoers-syntax.sh rename to scripts/utils/fix-sudoers-syntax.sh diff --git a/scripts/fix_database_persistence.py b/scripts/utils/fix_database_persistence.py similarity index 100% rename from scripts/fix_database_persistence.py rename to scripts/utils/fix_database_persistence.py diff --git a/scripts/fix_gpu_release.py b/scripts/utils/fix_gpu_release.py similarity index 100% rename from scripts/fix_gpu_release.py rename to scripts/utils/fix_gpu_release.py diff --git a/scripts/generate-api-keys.py b/scripts/utils/generate-api-keys.py similarity index 100% rename from scripts/generate-api-keys.py rename to scripts/utils/generate-api-keys.py diff --git a/scripts/git-pre-commit-hook.sh b/scripts/utils/git-pre-commit-hook.sh similarity index 100% rename from scripts/git-pre-commit-hook.sh rename to scripts/utils/git-pre-commit-hook.sh diff --git a/scripts/git_helper.sh b/scripts/utils/git_helper.sh similarity index 100% rename from scripts/git_helper.sh rename to scripts/utils/git_helper.sh diff --git a/scripts/init_production_genesis.py b/scripts/utils/init_production_genesis.py similarity index 100% rename from scripts/init_production_genesis.py rename to scripts/utils/init_production_genesis.py diff --git a/scripts/keystore.py b/scripts/utils/keystore.py similarity index 100% rename from scripts/keystore.py rename to scripts/utils/keystore.py diff --git a/scripts/organize-dev-logs.sh b/scripts/utils/organize-dev-logs.sh similarity index 100% rename from scripts/organize-dev-logs.sh rename to scripts/utils/organize-dev-logs.sh diff --git a/scripts/pr-conflict-resolution-summary.md b/scripts/utils/pr-conflict-resolution-summary.md similarity index 100% rename from scripts/pr-conflict-resolution-summary.md rename to scripts/utils/pr-conflict-resolution-summary.md diff --git a/scripts/quick-fix.sh b/scripts/utils/quick-fix.sh similarity index 100% rename from scripts/quick-fix.sh rename to scripts/utils/quick-fix.sh diff --git a/scripts/run_comprehensive_planning_cleanup.sh b/scripts/utils/run_comprehensive_planning_cleanup.sh similarity index 100% rename from scripts/run_comprehensive_planning_cleanup.sh rename to scripts/utils/run_comprehensive_planning_cleanup.sh diff --git a/scripts/run_documentation_conversion.sh b/scripts/utils/run_documentation_conversion.sh similarity index 100% rename from scripts/run_documentation_conversion.sh rename to scripts/utils/run_documentation_conversion.sh diff --git a/scripts/run_enhanced_planning_analysis.sh b/scripts/utils/run_enhanced_planning_analysis.sh similarity index 100% rename from scripts/run_enhanced_planning_analysis.sh rename to scripts/utils/run_enhanced_planning_analysis.sh diff --git a/scripts/run_enhanced_planning_cleanup.sh b/scripts/utils/run_enhanced_planning_cleanup.sh similarity index 100% rename from scripts/run_enhanced_planning_cleanup.sh rename to scripts/utils/run_enhanced_planning_cleanup.sh diff --git a/scripts/run_master_planning_cleanup.sh b/scripts/utils/run_master_planning_cleanup.sh similarity index 100% rename from scripts/run_master_planning_cleanup.sh rename to scripts/utils/run_master_planning_cleanup.sh diff --git a/scripts/run_planning_cleanup.sh b/scripts/utils/run_planning_cleanup.sh similarity index 100% rename from scripts/run_planning_cleanup.sh rename to scripts/utils/run_planning_cleanup.sh diff --git a/scripts/run_production_node.py b/scripts/utils/run_production_node.py similarity index 100% rename from scripts/run_production_node.py rename to scripts/utils/run_production_node.py diff --git a/scripts/security_hardening.sh b/scripts/utils/security_hardening.sh similarity index 100% rename from scripts/security_hardening.sh rename to scripts/utils/security_hardening.sh diff --git a/scripts/setup-dev-permissions.sh b/scripts/utils/setup-dev-permissions.sh similarity index 100% rename from scripts/setup-dev-permissions.sh rename to scripts/utils/setup-dev-permissions.sh diff --git a/scripts/setup_production.py b/scripts/utils/setup_production.py similarity index 100% rename from scripts/setup_production.py rename to scripts/utils/setup_production.py diff --git a/scripts/sync.sh b/scripts/utils/sync.sh similarity index 100% rename from scripts/sync.sh rename to scripts/utils/sync.sh diff --git a/scripts/update-docs.sh b/scripts/utils/update-docs.sh similarity index 100% rename from scripts/update-docs.sh rename to scripts/utils/update-docs.sh diff --git a/scripts/validate-requirements.sh b/scripts/utils/validate-requirements.sh similarity index 100% rename from scripts/validate-requirements.sh rename to scripts/utils/validate-requirements.sh diff --git a/scripts/verify-codebase-update.sh b/scripts/utils/verify-codebase-update.sh similarity index 100% rename from scripts/verify-codebase-update.sh rename to scripts/utils/verify-codebase-update.sh diff --git a/scripts/verify-production-advanced.sh b/scripts/utils/verify-production-advanced.sh similarity index 100% rename from scripts/verify-production-advanced.sh rename to scripts/utils/verify-production-advanced.sh diff --git a/tests/README.md b/tests/docs/README.md similarity index 100% rename from tests/README.md rename to tests/docs/README.md diff --git a/tests/TEST_REFACTORING_COMPLETED.md b/tests/docs/TEST_REFACTORING_COMPLETED.md similarity index 100% rename from tests/TEST_REFACTORING_COMPLETED.md rename to tests/docs/TEST_REFACTORING_COMPLETED.md diff --git a/tests/USAGE_GUIDE.md b/tests/docs/USAGE_GUIDE.md similarity index 100% rename from tests/USAGE_GUIDE.md rename to tests/docs/USAGE_GUIDE.md diff --git a/tests/cli-test-updates-completed.md b/tests/docs/cli-test-updates-completed.md similarity index 100% rename from tests/cli-test-updates-completed.md rename to tests/docs/cli-test-updates-completed.md diff --git a/tests/test-integration-completed.md b/tests/docs/test-integration-completed.md similarity index 100% rename from tests/test-integration-completed.md rename to tests/docs/test-integration-completed.md diff --git a/tests/test_explorer_fixes.py b/tests/explorer/test_explorer_fixes.py similarity index 100% rename from tests/test_explorer_fixes.py rename to tests/explorer/test_explorer_fixes.py diff --git a/tests/test_explorer_integration.py b/tests/explorer/test_explorer_integration.py similarity index 100% rename from tests/test_explorer_integration.py rename to tests/explorer/test_explorer_integration.py diff --git a/tests/openclaw_marketplace/README.md b/tests/integration/README.md similarity index 100% rename from tests/openclaw_marketplace/README.md rename to tests/integration/README.md diff --git a/tests/openclaw_marketplace/run_all_tests.py b/tests/integration/run_all_tests.py similarity index 100% rename from tests/openclaw_marketplace/run_all_tests.py rename to tests/integration/run_all_tests.py diff --git a/tests/openclaw_marketplace/test_advanced_agent_capabilities.py b/tests/integration/test_advanced_agent_capabilities.py similarity index 100% rename from tests/openclaw_marketplace/test_advanced_agent_capabilities.py rename to tests/integration/test_advanced_agent_capabilities.py diff --git a/tests/openclaw_marketplace/test_agent_economics.py b/tests/integration/test_agent_economics.py similarity index 100% rename from tests/openclaw_marketplace/test_agent_economics.py rename to tests/integration/test_agent_economics.py diff --git a/tests/openclaw_marketplace/test_agent_governance.py b/tests/integration/test_agent_governance.py similarity index 100% rename from tests/openclaw_marketplace/test_agent_governance.py rename to tests/integration/test_agent_governance.py diff --git a/tests/openclaw_marketplace/test_blockchain_integration.py b/tests/integration/test_blockchain_integration.py similarity index 100% rename from tests/openclaw_marketplace/test_blockchain_integration.py rename to tests/integration/test_blockchain_integration.py diff --git a/tests/test_event_driven_cache.py b/tests/integration/test_event_driven_cache.py similarity index 100% rename from tests/test_event_driven_cache.py rename to tests/integration/test_event_driven_cache.py diff --git a/tests/openclaw_marketplace/test_framework.py b/tests/integration/test_framework.py similarity index 100% rename from tests/openclaw_marketplace/test_framework.py rename to tests/integration/test_framework.py diff --git a/tests/openclaw_marketplace/test_multi_region_deployment.py b/tests/integration/test_multi_region_deployment.py similarity index 100% rename from tests/openclaw_marketplace/test_multi_region_deployment.py rename to tests/integration/test_multi_region_deployment.py diff --git a/tests/openclaw_marketplace/test_performance_optimization.py b/tests/integration/test_performance_optimization.py similarity index 100% rename from tests/openclaw_marketplace/test_performance_optimization.py rename to tests/integration/test_performance_optimization.py diff --git a/tests/reputation/test_reputation_system.py b/tests/integration/test_reputation_system.py similarity index 100% rename from tests/reputation/test_reputation_system.py rename to tests/integration/test_reputation_system.py diff --git a/tests/rewards/test_reward_system.py b/tests/integration/test_reward_system.py similarity index 100% rename from tests/rewards/test_reward_system.py rename to tests/integration/test_reward_system.py diff --git a/tests/trading/test_trading_system.py b/tests/integration/test_trading_system.py similarity index 100% rename from tests/trading/test_trading_system.py rename to tests/integration/test_trading_system.py diff --git a/tests/test_agent_wallet_security.py b/tests/security/test_agent_wallet_security.py similarity index 100% rename from tests/test_agent_wallet_security.py rename to tests/security/test_agent_wallet_security.py diff --git a/tests/test_cli_translation_security.py b/tests/security/test_cli_translation_security.py similarity index 100% rename from tests/test_cli_translation_security.py rename to tests/security/test_cli_translation_security.py diff --git a/tests/verification/README.md b/tests/testing/README.md similarity index 100% rename from tests/verification/README.md rename to tests/testing/README.md diff --git a/tests/verification/register_test_clients.py b/tests/testing/register_test_clients.py similarity index 100% rename from tests/verification/register_test_clients.py rename to tests/testing/register_test_clients.py diff --git a/tests/verification/run_test_suite.py b/tests/testing/run_test_suite.py similarity index 100% rename from tests/verification/run_test_suite.py rename to tests/testing/run_test_suite.py diff --git a/tests/verification/run_tests.py b/tests/testing/run_tests.py similarity index 100% rename from tests/verification/run_tests.py rename to tests/testing/run_tests.py diff --git a/tests/verification/test_block_import.py b/tests/testing/test_block_import.py similarity index 100% rename from tests/verification/test_block_import.py rename to tests/testing/test_block_import.py diff --git a/tests/verification/test_block_import_complete.py b/tests/testing/test_block_import_complete.py similarity index 100% rename from tests/verification/test_block_import_complete.py rename to tests/testing/test_block_import_complete.py diff --git a/tests/verification/test_coordinator.py b/tests/testing/test_coordinator.py similarity index 100% rename from tests/verification/test_coordinator.py rename to tests/testing/test_coordinator.py diff --git a/tests/verification/test_host_miner.py b/tests/testing/test_host_miner.py similarity index 100% rename from tests/verification/test_host_miner.py rename to tests/testing/test_host_miner.py diff --git a/tests/verification/test_minimal.py b/tests/testing/test_minimal.py similarity index 100% rename from tests/verification/test_minimal.py rename to tests/testing/test_minimal.py diff --git a/tests/verification/test_model_validation.py b/tests/testing/test_model_validation.py similarity index 100% rename from tests/verification/test_model_validation.py rename to tests/testing/test_model_validation.py diff --git a/tests/verification/test_payment_integration.py b/tests/testing/test_payment_integration.py similarity index 100% rename from tests/verification/test_payment_integration.py rename to tests/testing/test_payment_integration.py diff --git a/tests/verification/test_payment_local.py b/tests/testing/test_payment_local.py similarity index 100% rename from tests/verification/test_payment_local.py rename to tests/testing/test_payment_local.py diff --git a/tests/performance/test_performance.py b/tests/testing/test_performance.py similarity index 100% rename from tests/performance/test_performance.py rename to tests/testing/test_performance.py diff --git a/tests/performance/test_performance_benchmarks.py b/tests/testing/test_performance_benchmarks.py similarity index 100% rename from tests/performance/test_performance_benchmarks.py rename to tests/testing/test_performance_benchmarks.py diff --git a/tests/performance/test_performance_lightweight.py b/tests/testing/test_performance_lightweight.py similarity index 100% rename from tests/performance/test_performance_lightweight.py rename to tests/testing/test_performance_lightweight.py diff --git a/tests/performance/test_pricing_performance.py b/tests/testing/test_pricing_performance.py similarity index 100% rename from tests/performance/test_pricing_performance.py rename to tests/testing/test_pricing_performance.py diff --git a/tests/verification/test_simple_import.py b/tests/testing/test_simple_import.py similarity index 100% rename from tests/verification/test_simple_import.py rename to tests/testing/test_simple_import.py diff --git a/tests/verification/test_transactions_display.py b/tests/testing/test_transactions_display.py similarity index 100% rename from tests/verification/test_transactions_display.py rename to tests/testing/test_transactions_display.py diff --git a/tests/verification/test_tx_import.py b/tests/testing/test_tx_import.py similarity index 100% rename from tests/verification/test_tx_import.py rename to tests/testing/test_tx_import.py diff --git a/tests/verification/test_tx_model.py b/tests/testing/test_tx_model.py similarity index 100% rename from tests/verification/test_tx_model.py rename to tests/testing/test_tx_model.py diff --git a/tests/verification/verify_explorer_live.py b/tests/testing/verify_explorer_live.py similarity index 100% rename from tests/verification/verify_explorer_live.py rename to tests/testing/verify_explorer_live.py diff --git a/tests/verification/verify_gpu_deployment.sh b/tests/testing/verify_gpu_deployment.sh similarity index 100% rename from tests/verification/verify_gpu_deployment.sh rename to tests/testing/verify_gpu_deployment.sh diff --git a/tests/verification/verify_toggle_removed.py b/tests/testing/verify_toggle_removed.py similarity index 100% rename from tests/verification/verify_toggle_removed.py rename to tests/testing/verify_toggle_removed.py diff --git a/tests/verification/verify_transactions_fixed.py b/tests/testing/verify_transactions_fixed.py similarity index 100% rename from tests/verification/verify_transactions_fixed.py rename to tests/testing/verify_transactions_fixed.py diff --git a/tests/verification/verify_windsurf_tests.py b/tests/testing/verify_windsurf_tests.py similarity index 100% rename from tests/verification/verify_windsurf_tests.py rename to tests/testing/verify_windsurf_tests.py diff --git a/tests/contracts/AgentBounty.test.js b/tests/unit/AgentBounty.test.js similarity index 100% rename from tests/contracts/AgentBounty.test.js rename to tests/unit/AgentBounty.test.js diff --git a/tests/contracts/AgentStaking.test.js b/tests/unit/AgentStaking.test.js similarity index 100% rename from tests/contracts/AgentStaking.test.js rename to tests/unit/AgentStaking.test.js diff --git a/tests/contracts/Integration.test.js b/tests/unit/Integration.test.js similarity index 100% rename from tests/contracts/Integration.test.js rename to tests/unit/Integration.test.js diff --git a/tests/contracts/MockERC20.sol b/tests/unit/MockERC20.sol similarity index 100% rename from tests/contracts/MockERC20.sol rename to tests/unit/MockERC20.sol diff --git a/tests/contracts/MockGroth16Verifier.sol b/tests/unit/MockGroth16Verifier.sol similarity index 100% rename from tests/contracts/MockGroth16Verifier.sol rename to tests/unit/MockGroth16Verifier.sol diff --git a/tests/contracts/MockZKVerifier.sol b/tests/unit/MockZKVerifier.sol similarity index 100% rename from tests/contracts/MockZKVerifier.sol rename to tests/unit/MockZKVerifier.sol diff --git a/tests/load/locustfile.py b/tests/unit/locustfile.py similarity index 100% rename from tests/load/locustfile.py rename to tests/unit/locustfile.py diff --git a/tests/test_websocket_backpressure_core.py b/tests/websocket/test_websocket_backpressure_core.py similarity index 100% rename from tests/test_websocket_backpressure_core.py rename to tests/websocket/test_websocket_backpressure_core.py diff --git a/tests/test_websocket_stream_backpressure.py b/tests/websocket/test_websocket_stream_backpressure.py similarity index 100% rename from tests/test_websocket_stream_backpressure.py rename to tests/websocket/test_websocket_stream_backpressure.py