Move blockchain app READMEs to centralized documentation
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 10s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 4s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 40s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 15s
Smart Contract Tests / lint-solidity (push) Successful in 8s
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 10s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 4s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 40s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 15s
Smart Contract Tests / lint-solidity (push) Successful in 8s
- Relocate blockchain-event-bridge README content to docs/apps/blockchain/blockchain-event-bridge.md - Relocate blockchain-explorer README content to docs/apps/blockchain/blockchain-explorer.md - Replace app READMEs with redirect notices pointing to new documentation location - Consolidate documentation in central docs/ directory for better organization
This commit is contained in:
16
docs/apps/infrastructure/README.md
Normal file
16
docs/apps/infrastructure/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Infrastructure Applications
|
||||
|
||||
Monitoring, load balancing, and infrastructure services.
|
||||
|
||||
## Applications
|
||||
|
||||
- [Monitor](monitor.md) - System monitoring and alerting
|
||||
- [Multi-Region Load Balancer](multi-region-load-balancer.md) - Load balancing across regions
|
||||
- [Global Infrastructure](global-infrastructure.md) - Global infrastructure management
|
||||
|
||||
## Features
|
||||
|
||||
- System monitoring
|
||||
- Health checks
|
||||
- Load balancing
|
||||
- Multi-region support
|
||||
206
docs/apps/infrastructure/global-infrastructure.md
Normal file
206
docs/apps/infrastructure/global-infrastructure.md
Normal file
@@ -0,0 +1,206 @@
|
||||
# Global Infrastructure
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Global infrastructure management service for deploying, monitoring, and managing AITBC infrastructure across multiple regions and cloud providers.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Infrastructure Manager**: Manages infrastructure resources
|
||||
- **Deployment Service**: Handles deployments across regions
|
||||
- **Resource Scheduler**: Schedules resources optimally
|
||||
- **Configuration Manager**: Manages infrastructure configuration
|
||||
- **Cost Optimizer**: Optimizes infrastructure costs
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- Cloud provider credentials (AWS, GCP, Azure)
|
||||
- Terraform or CloudFormation templates
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/global-infrastructure
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
CLOUD_PROVIDER=aws
|
||||
AWS_ACCESS_KEY_ID=your-access-key
|
||||
AWS_SECRET_ACCESS_KEY=your-secret-key
|
||||
AWS_REGION=us-east-1
|
||||
TERRAFORM_PATH=/path/to/terraform
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Configure cloud provider credentials
|
||||
5. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
global-infrastructure/
|
||||
├── src/
|
||||
│ ├── infrastructure_manager/ # Infrastructure management
|
||||
│ ├── deployment_service/ # Deployment orchestration
|
||||
│ ├── resource_scheduler/ # Resource scheduling
|
||||
│ ├── config_manager/ # Configuration management
|
||||
│ └── cost_optimizer/ # Cost optimization
|
||||
├── terraform/ # Terraform templates
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run deployment tests
|
||||
pytest tests/test_deployment.py
|
||||
|
||||
# Run cost optimizer tests
|
||||
pytest tests/test_cost.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Infrastructure Management
|
||||
|
||||
#### Get Infrastructure Status
|
||||
```http
|
||||
GET /api/v1/infrastructure/status
|
||||
```
|
||||
|
||||
#### Provision Resource
|
||||
```http
|
||||
POST /api/v1/infrastructure/provision
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"resource_type": "server|database|storage",
|
||||
"region": "us-east-1",
|
||||
"specifications": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### Decommission Resource
|
||||
```http
|
||||
DELETE /api/v1/infrastructure/resources/{resource_id}
|
||||
```
|
||||
|
||||
### Deployment
|
||||
|
||||
#### Deploy Service
|
||||
```http
|
||||
POST /api/v1/infrastructure/deploy
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"service_name": "blockchain-node",
|
||||
"region": "us-east-1",
|
||||
"configuration": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Deployment Status
|
||||
```http
|
||||
GET /api/v1/infrastructure/deployments/{deployment_id}
|
||||
```
|
||||
|
||||
### Resource Scheduling
|
||||
|
||||
#### Get Resource Utilization
|
||||
```http
|
||||
GET /api/v1/infrastructure/resources/utilization
|
||||
```
|
||||
|
||||
#### Optimize Resources
|
||||
```http
|
||||
POST /api/v1/infrastructure/resources/optimize
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"optimization_type": "cost|performance",
|
||||
"constraints": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
#### Get Configuration
|
||||
```http
|
||||
GET /api/v1/infrastructure/config/{region}
|
||||
```
|
||||
|
||||
#### Update Configuration
|
||||
```http
|
||||
PUT /api/v1/infrastructure/config/{region}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"parameters": {}
|
||||
}
|
||||
```
|
||||
|
||||
### Cost Management
|
||||
|
||||
#### Get Cost Report
|
||||
```http
|
||||
GET /api/v1/infrastructure/costs?period=month
|
||||
```
|
||||
|
||||
#### Get Cost Optimization Recommendations
|
||||
```http
|
||||
GET /api/v1/infrastructure/costs/recommendations
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `CLOUD_PROVIDER`: Cloud provider (aws, gcp, azure)
|
||||
- `AWS_ACCESS_KEY_ID`: AWS access key
|
||||
- `AWS_SECRET_ACCESS_KEY`: AWS secret key
|
||||
- `AWS_REGION`: Default AWS region
|
||||
- `TERRAFORM_PATH`: Path to Terraform templates
|
||||
- `DEPLOYMENT_TIMEOUT`: Deployment timeout in seconds
|
||||
|
||||
### Infrastructure Parameters
|
||||
- **Regions**: Supported cloud regions
|
||||
- **Instance Types**: Available instance types
|
||||
- **Storage Classes**: Storage class configurations
|
||||
- **Network Configurations**: VPC and network settings
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Deployment failed**: Check cloud provider credentials and configuration.
|
||||
|
||||
**Resource not provisioned**: Verify resource specifications and quotas.
|
||||
|
||||
**Cost optimization not working**: Review cost optimizer configuration and constraints.
|
||||
|
||||
**Configuration sync failed**: Check network connectivity and configuration validity.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Rotate cloud provider credentials regularly
|
||||
- Use IAM roles instead of access keys when possible
|
||||
- Enable encryption for all storage resources
|
||||
- Implement network security groups and firewalls
|
||||
- Monitor for unauthorized resource changes
|
||||
- Regularly audit infrastructure configuration
|
||||
213
docs/apps/infrastructure/monitor.md
Normal file
213
docs/apps/infrastructure/monitor.md
Normal file
@@ -0,0 +1,213 @@
|
||||
# Monitor
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
System monitoring and alerting service for tracking application health, performance metrics, and generating alerts for critical events.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Health Check Service**: Periodic health checks for all services
|
||||
- **Metrics Collector**: Collects performance metrics from applications
|
||||
- **Alert Manager**: Manages alert rules and notifications
|
||||
- **Dashboard**: Web dashboard for monitoring visualization
|
||||
- **Log Aggregator**: Aggregates logs from all services
|
||||
- **Notification Service**: Sends alerts via email, Slack, etc.
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- Access to application endpoints
|
||||
- Notification service credentials (email, Slack webhook)
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/monitor
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
MONITOR_INTERVAL=60
|
||||
ALERT_EMAIL=admin@example.com
|
||||
SLACK_WEBHOOK=https://hooks.slack.com/services/...
|
||||
PROMETHEUS_URL=http://localhost:9090
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
### Access Dashboard
|
||||
Open `http://localhost:8080` in a browser to access the monitoring dashboard.
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Configure monitoring targets
|
||||
5. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
monitor/
|
||||
├── src/
|
||||
│ ├── health_check/ # Health check service
|
||||
│ ├── metrics_collector/ # Metrics collection
|
||||
│ ├── alert_manager/ # Alert management
|
||||
│ ├── dashboard/ # Web dashboard
|
||||
│ ├── log_aggregator/ # Log aggregation
|
||||
│ └── notification/ # Notification service
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run health check tests
|
||||
pytest tests/test_health_check.py
|
||||
|
||||
# Run alert manager tests
|
||||
pytest tests/test_alerts.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Health Checks
|
||||
|
||||
#### Run Health Check
|
||||
```http
|
||||
GET /api/v1/monitor/health/{service_name}
|
||||
```
|
||||
|
||||
#### Get All Health Status
|
||||
```http
|
||||
GET /api/v1/monitor/health
|
||||
```
|
||||
|
||||
#### Add Health Check Target
|
||||
```http
|
||||
POST /api/v1/monitor/health/targets
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"service_name": "string",
|
||||
"endpoint": "http://localhost:8000/health",
|
||||
"interval": 60,
|
||||
"timeout": 10
|
||||
}
|
||||
```
|
||||
|
||||
### Metrics
|
||||
|
||||
#### Get Metrics
|
||||
```http
|
||||
GET /api/v1/monitor/metrics?service=blockchain-node
|
||||
```
|
||||
|
||||
#### Query Prometheus
|
||||
```http
|
||||
POST /api/v1/monitor/metrics/query
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": "up{job=\"blockchain-node\"}",
|
||||
"range": "1h"
|
||||
}
|
||||
```
|
||||
|
||||
### Alerts
|
||||
|
||||
#### Create Alert Rule
|
||||
```http
|
||||
POST /api/v1/monitor/alerts/rules
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "high_cpu_usage",
|
||||
"condition": "cpu_usage > 80",
|
||||
"duration": 300,
|
||||
"severity": "warning|critical",
|
||||
"notification": "email|slack"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Active Alerts
|
||||
```http
|
||||
GET /api/v1/monitor/alerts/active
|
||||
```
|
||||
|
||||
#### Acknowledge Alert
|
||||
```http
|
||||
POST /api/v1/monitor/alerts/{alert_id}/acknowledge
|
||||
```
|
||||
|
||||
### Logs
|
||||
|
||||
#### Query Logs
|
||||
```http
|
||||
POST /api/v1/monitor/logs/query
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"service": "blockchain-node",
|
||||
"level": "ERROR",
|
||||
"time_range": "1h",
|
||||
"query": "error"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Log Statistics
|
||||
```http
|
||||
GET /api/v1/monitor/logs/stats?service=blockchain-node
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `MONITOR_INTERVAL`: Interval for health checks (default: 60s)
|
||||
- `ALERT_EMAIL`: Email address for alert notifications
|
||||
- `SLACK_WEBHOOK`: Slack webhook for notifications
|
||||
- `PROMETHEUS_URL`: Prometheus server URL
|
||||
- `LOG_RETENTION_DAYS`: Log retention period (default: 30 days)
|
||||
- `ALERT_COOLDOWN`: Alert cooldown period (default: 300s)
|
||||
|
||||
### Monitoring Targets
|
||||
- **Services**: List of services to monitor
|
||||
- **Endpoints**: Health check endpoints for each service
|
||||
- **Intervals**: Check intervals for each service
|
||||
|
||||
### Alert Rules
|
||||
- **CPU Usage**: Alert when CPU usage exceeds threshold
|
||||
- **Memory Usage**: Alert when memory usage exceeds threshold
|
||||
- **Disk Usage**: Alert when disk usage exceeds threshold
|
||||
- **Service Down**: Alert when service is unresponsive
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Health check failing**: Verify service endpoint and network connectivity.
|
||||
|
||||
**Alerts not triggering**: Check alert rule configuration and notification settings.
|
||||
|
||||
**Metrics not collecting**: Verify Prometheus integration and service metrics endpoints.
|
||||
|
||||
**Logs not appearing**: Check log aggregation configuration and service log paths.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Secure access to monitoring dashboard
|
||||
- Use authentication for API endpoints
|
||||
- Encrypt alert notification credentials
|
||||
- Implement role-based access control
|
||||
- Regularly review alert rules
|
||||
- Monitor for unauthorized access attempts
|
||||
193
docs/apps/infrastructure/multi-region-load-balancer.md
Normal file
193
docs/apps/infrastructure/multi-region-load-balancer.md
Normal file
@@ -0,0 +1,193 @@
|
||||
# Multi-Region Load Balancer
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Load balancing service for distributing traffic across multiple regions and ensuring high availability and optimal performance.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Load Balancer**: Distributes traffic across regions
|
||||
- **Health Checker**: Monitors regional health status
|
||||
- **Traffic Router**: Routes traffic based on load and latency
|
||||
- **Failover Manager**: Handles failover between regions
|
||||
- **Configuration Manager**: Manages load balancing rules
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- Multiple regional endpoints
|
||||
- DNS configuration for load balancing
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/multi-region-load-balancer
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
REGIONAL_ENDPOINTS=us-east:https://us.example.com,eu-west:https://eu.example.com
|
||||
LOAD_BALANCING_STRATEGY=round_robin|least_latency|weighted
|
||||
HEALTH_CHECK_INTERVAL=30
|
||||
FAILOVER_ENABLED=true
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Configure regional endpoints
|
||||
5. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
multi-region-load-balancer/
|
||||
├── src/
|
||||
│ ├── load_balancer/ # Load balancing logic
|
||||
│ ├── health_checker/ # Regional health monitoring
|
||||
│ ├── traffic_router/ # Traffic routing
|
||||
│ ├── failover_manager/ # Failover management
|
||||
│ └── config_manager/ # Configuration management
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run load balancer tests
|
||||
pytest tests/test_load_balancer.py
|
||||
|
||||
# Run failover tests
|
||||
pytest tests/test_failover.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Load Balancing
|
||||
|
||||
#### Get Load Balancer Status
|
||||
```http
|
||||
GET /api/v1/lb/status
|
||||
```
|
||||
|
||||
#### Configure Load Balancing Strategy
|
||||
```http
|
||||
PUT /api/v1/lb/strategy
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"strategy": "round_robin|least_latency|weighted",
|
||||
"parameters": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Regional Status
|
||||
```http
|
||||
GET /api/v1/lb/regions
|
||||
```
|
||||
|
||||
### Health Checks
|
||||
|
||||
#### Run Health Check
|
||||
```http
|
||||
POST /api/v1/lb/health/check
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"region": "us-east"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Health History
|
||||
```http
|
||||
GET /api/v1/lb/health/history?region=us-east
|
||||
```
|
||||
|
||||
### Failover
|
||||
|
||||
#### Trigger Manual Failover
|
||||
```http
|
||||
POST /api/v1/lb/failover/trigger
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"from_region": "us-east",
|
||||
"to_region": "eu-west"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Failover Status
|
||||
```http
|
||||
GET /api/v1/lb/failover/status
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
#### Add Regional Endpoint
|
||||
```http
|
||||
POST /api/v1/lb/regions
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"region": "us-west",
|
||||
"endpoint": "https://us-west.example.com",
|
||||
"weight": 1.0
|
||||
}
|
||||
```
|
||||
|
||||
#### Remove Regional Endpoint
|
||||
```http
|
||||
DELETE /api/v1/lb/regions/{region}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `REGIONAL_ENDPOINTS`: Comma-separated regional endpoints
|
||||
- `LOAD_BALANCING_STRATEGY`: Strategy for load distribution
|
||||
- `HEALTH_CHECK_INTERVAL`: Interval for health checks (default: 30s)
|
||||
- `FAILOVER_ENABLED`: Enable automatic failover
|
||||
- `FAILOVER_THRESHOLD`: Threshold for triggering failover
|
||||
|
||||
### Load Balancing Strategies
|
||||
- **Round Robin**: Distributes traffic evenly across regions
|
||||
- **Least Latency**: Routes to region with lowest latency
|
||||
- **Weighted**: Uses configured weights for distribution
|
||||
|
||||
### Health Check Parameters
|
||||
- **Check Interval**: Frequency of health checks
|
||||
- **Timeout**: Timeout for health check responses
|
||||
- **Failure Threshold**: Number of failures before marking region down
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Load balancing not working**: Verify regional endpoints and strategy configuration.
|
||||
|
||||
**Failover not triggering**: Check health check configuration and thresholds.
|
||||
|
||||
**High latency**: Review regional health and network connectivity.
|
||||
|
||||
**Uneven distribution**: Check weights and load balancing strategy.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Use TLS for all regional connections
|
||||
- Implement authentication for load balancer API
|
||||
- Monitor for DDoS attacks
|
||||
- Regularly review regional access
|
||||
- Implement rate limiting
|
||||
Reference in New Issue
Block a user