Files
Sankofa/infrastructure/inventory/README.md
defiQUG 9daf1fd378 Apply Composer changes: comprehensive API updates, migrations, middleware, and infrastructure improvements
- Add comprehensive database migrations (001-024) for schema evolution
- Enhance API schema with expanded type definitions and resolvers
- Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth
- Implement new services: AI optimization, billing, blockchain, compliance, marketplace
- Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage)
- Update Crossplane provider with enhanced VM management capabilities
- Add comprehensive test suite for API endpoints and services
- Update frontend components with improved GraphQL subscriptions and real-time updates
- Enhance security configurations and headers (CSP, CORS, etc.)
- Update documentation and configuration files
- Add new CI/CD workflows and validation scripts
- Implement design system improvements and UI enhancements
2025-12-12 18:01:35 -08:00

4.5 KiB

Infrastructure Inventory

Centralized inventory and discovery system for all infrastructure components in Sankofa Phoenix.

Overview

The infrastructure inventory system provides:

  • Auto-discovery of infrastructure components
  • Centralized inventory database
  • Asset tracking and lifecycle management
  • Configuration drift detection
  • Change history and audit trails

Components

Discovery (discovery/)

Auto-discovery scripts for:

  • Proxmox clusters and nodes
  • Network devices (switches, routers)
  • Omada controllers and access points
  • Storage systems
  • Other infrastructure components

Database (database/)

Inventory database schema and management:

  • PostgreSQL schema for inventory
  • Migration scripts
  • Query utilities
  • Backup/restore procedures

Discovery

Auto-Discovery

# Discover all infrastructure
./discovery/discover-all.sh --site us-east-1

# Discover Proxmox infrastructure
./discovery/discover-proxmox.sh --site us-east-1

# Discover network infrastructure
./discovery/discover-network.sh --site us-east-1

# Discover Omada infrastructure
./discovery/discover-omada.sh --controller omada.sankofa.nexus

Scheduled Discovery

Discovery can be scheduled via cron or Kubernetes CronJob:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: infrastructure-discovery
spec:
  schedule: "0 */6 * * *"  # Every 6 hours
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: discovery
            image: infrastructure-discovery:latest
            command: ["./discovery/discover-all.sh"]

Database Schema

Tables

  • sites: Physical sites/locations
  • nodes: Compute nodes (Proxmox, Kubernetes)
  • vms: Virtual machines
  • network_devices: Switches, routers, access points
  • storage_pools: Storage systems
  • networks: Network segments and VLANs
  • inventory_history: Change history

Schema Location

See database/schema.sql for complete database schema.

Usage

Query Inventory

# List all sites
./database/query.sh "SELECT * FROM sites"

# List nodes for a site
./database/query.sh "SELECT * FROM nodes WHERE site_id = 'us-east-1'"

# Get VM inventory
./database/query.sh "SELECT * FROM vms WHERE site_id = 'us-east-1'"

Update Inventory

# Update node information
./database/update-node.sh \
  --node pve1 \
  --site us-east-1 \
  --status online \
  --cpu 32 \
  --memory 128GB

Configuration Drift Detection

# Detect configuration drift
./discovery/detect-drift.sh --site us-east-1

# Compare with expected configuration
./discovery/compare-config.sh \
  --site us-east-1 \
  --expected expected-config.yaml

Integration

API Integration

The inventory system provides a REST API for integration:

# Get site inventory
curl https://api.sankofa.nexus/inventory/sites/us-east-1

# Get node details
curl https://api.sankofa.nexus/inventory/nodes/pve1

# Update inventory
curl -X POST https://api.sankofa.nexus/inventory/nodes \
  -H "Content-Type: application/json" \
  -d '{"name": "pve1", "site": "us-east-1", ...}'

Portal Integration

The inventory is accessible via the Portal UI:

  • Infrastructure explorer
  • Asset management
  • Configuration comparison
  • Change history

Configuration

Discovery Configuration

discovery:
  sites:
    - id: us-east-1
      proxmox:
        endpoints:
          - https://pve1.sankofa.nexus:8006
          - https://pve2.sankofa.nexus:8006
      network:
        snmp_community: public
        devices:
          - 10.1.0.1  # switch-01
          - 10.1.0.254  # router-01
      omada:
        controller: omada.sankofa.nexus
        site_id: us-east-1

Database Configuration

database:
  host: postgres.inventory.svc.cluster.local
  port: 5432
  database: infrastructure
  username: inventory
  password: ${DB_PASSWORD}
  ssl_mode: require

Backup and Recovery

Backup Inventory

# Backup inventory database
./database/backup.sh --output inventory-backup-$(date +%Y%m%d).sql

Restore Inventory

# Restore inventory database
./database/restore.sh --backup inventory-backup-20240101.sql

Reporting

Generate Reports

# Generate inventory report
./database/report.sh --site us-east-1 --format html

# Generate asset report
./database/asset-report.sh --format csv