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
This commit is contained in:
108
scripts/infrastructure/convert-csv-to-json.ts
Normal file
108
scripts/infrastructure/convert-csv-to-json.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
#!/usr/bin/env tsx
|
||||
/**
|
||||
* Convert CSV export to JSON format for infrastructure documentation
|
||||
* Usage: tsx scripts/infrastructure/convert-csv-to-json.ts
|
||||
*/
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
const PROJECT_ROOT = path.resolve(__dirname, '../..')
|
||||
const DATA_DIR = path.join(PROJECT_ROOT, 'docs/infrastructure/data')
|
||||
|
||||
interface Country {
|
||||
name: string
|
||||
region: 'Africa (Sub-Saharan)' | 'Middle East & North Africa' | 'Americas' | 'Asia-Pacific' | 'Europe'
|
||||
relationshipType: 'Full Diplomatic Relations' | 'Official (Non-Diplomatic)' | 'Ambassador Level' | 'Full Diplomatic Relations (Special Mission)'
|
||||
priority: 'Critical' | 'High' | 'Medium' | 'Low'
|
||||
cloudflareCoverage: boolean
|
||||
networkInfrastructurePriority: string
|
||||
notes?: string
|
||||
coordinates?: { lat: number; lng: number }
|
||||
}
|
||||
|
||||
// Country coordinates (approximate, can be enhanced with geocoding)
|
||||
const COUNTRY_COORDINATES: Record<string, { lat: number; lng: number }> = {
|
||||
'Italy': { lat: 41.9028, lng: 12.4964 },
|
||||
'Germany': { lat: 51.1657, lng: 10.4515 },
|
||||
'France': { lat: 46.2276, lng: 2.2137 },
|
||||
'Spain': { lat: 40.4637, lng: -3.7492 },
|
||||
'Brazil': { lat: -14.2350, lng: -51.9253 },
|
||||
'Argentina': { lat: -38.4161, lng: -63.6167 },
|
||||
'Philippines': { lat: 12.8797, lng: 121.7740 },
|
||||
'Kenya': { lat: -0.0236, lng: 37.9062 },
|
||||
'Ethiopia': { lat: 9.1450, lng: 38.7667 },
|
||||
'Lebanon': { lat: 33.8547, lng: 35.8623 },
|
||||
'Holy See (Vatican City)': { lat: 41.9029, lng: 12.4534 },
|
||||
}
|
||||
|
||||
function parseCSV(csvContent: string): Country[] {
|
||||
const lines = csvContent.trim().split('\n')
|
||||
const headers = lines[0].split(',').map(h => h.trim())
|
||||
|
||||
return lines.slice(1).map(line => {
|
||||
const values = line.split(',').map(v => v.trim())
|
||||
const country: Country = {
|
||||
name: values[0],
|
||||
region: values[1] as Country['region'],
|
||||
relationshipType: values[2] as Country['relationshipType'],
|
||||
priority: values[3] as Country['priority'],
|
||||
cloudflareCoverage: values[4] === 'Yes',
|
||||
networkInfrastructurePriority: values[5],
|
||||
notes: values[6] || undefined,
|
||||
coordinates: COUNTRY_COORDINATES[values[0]] || undefined,
|
||||
}
|
||||
return country
|
||||
})
|
||||
}
|
||||
|
||||
function main() {
|
||||
// Find the most recent CSV file
|
||||
const files = fs.readdirSync(DATA_DIR)
|
||||
.filter(f => f.startsWith('smom_countries_full_') && f.endsWith('.csv'))
|
||||
.sort()
|
||||
.reverse()
|
||||
|
||||
if (files.length === 0) {
|
||||
console.error('No CSV files found. Please run export-smom-countries.sh first.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const csvFile = path.join(DATA_DIR, files[0])
|
||||
console.log(`Reading CSV file: ${csvFile}`)
|
||||
|
||||
const csvContent = fs.readFileSync(csvFile, 'utf-8')
|
||||
const countries = parseCSV(csvContent)
|
||||
|
||||
// Write JSON file
|
||||
const jsonFile = path.join(DATA_DIR, 'smom_countries.json')
|
||||
fs.writeFileSync(jsonFile, JSON.stringify(countries, null, 2))
|
||||
console.log(`✓ Created ${jsonFile} with ${countries.length} countries`)
|
||||
|
||||
// Create summary statistics
|
||||
const summary = {
|
||||
total: countries.length,
|
||||
byRegion: countries.reduce((acc, c) => {
|
||||
acc[c.region] = (acc[c.region] || 0) + 1
|
||||
return acc
|
||||
}, {} as Record<string, number>),
|
||||
byPriority: countries.reduce((acc, c) => {
|
||||
acc[c.priority] = (acc[c.priority] || 0) + 1
|
||||
return acc
|
||||
}, {} as Record<string, number>),
|
||||
byRelationshipType: countries.reduce((acc, c) => {
|
||||
acc[c.relationshipType] = (acc[c.relationshipType] || 0) + 1
|
||||
return acc
|
||||
}, {} as Record<string, number>),
|
||||
lastUpdated: new Date().toISOString(),
|
||||
}
|
||||
|
||||
const summaryFile = path.join(DATA_DIR, 'smom_countries_summary.json')
|
||||
fs.writeFileSync(summaryFile, JSON.stringify(summary, null, 2))
|
||||
console.log(`✓ Created ${summaryFile}`)
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main()
|
||||
}
|
||||
|
||||
153
scripts/infrastructure/export-smom-countries.sh
Executable file
153
scripts/infrastructure/export-smom-countries.sh
Executable file
@@ -0,0 +1,153 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Export SMOM Country Relationships to CSV
|
||||
# Generates CSV files for Sovereign Order of Hospitallers country relationships
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
||||
OUTPUT_DIR="${PROJECT_ROOT}/docs/infrastructure/data"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
|
||||
mkdir -p "${OUTPUT_DIR}"
|
||||
|
||||
# Create comprehensive CSV with all countries
|
||||
cat > "${OUTPUT_DIR}/smom_countries_full_${TIMESTAMP}.csv" << 'EOF'
|
||||
Country,Region,Relationship Type,Priority,Cloudflare Coverage,Network Infrastructure Priority,Notes
|
||||
Angola,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Benin,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Burundi,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Burkina Faso,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Cameroon,Africa (Sub-Saharan),Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Cape Verde,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Central African Republic,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Chad,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Comoros,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Democratic Republic of the Congo,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Republic of the Congo,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Côte d'Ivoire,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Equatorial Guinea,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Eritrea,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Ethiopia,Africa (Sub-Saharan),Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Gabon,Africa (Sub-Saharan),Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
The Gambia,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Guinea,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Guinea-Bissau,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Kenya,Africa (Sub-Saharan),Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Lesotho,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Liberia,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Madagascar,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Mali,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Mauritania,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Mauritius,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Mozambique,Africa (Sub-Saharan),Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Namibia,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Niger,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
São Tomé and Príncipe,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Senegal,Africa (Sub-Saharan),Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Seychelles,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Sierra Leone,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Somalia,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
South Sudan,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Sudan,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Togo,Africa (Sub-Saharan),Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Egypt,Middle East & North Africa,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Jordan,Middle East & North Africa,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Lebanon,Middle East & North Africa,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Morocco,Middle East & North Africa,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Antigua and Barbuda,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Argentina,Americas,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
The Bahamas,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Belize,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Bolivia,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Brazil,Americas,Full Diplomatic Relations,High,Yes,Core Datacenter,
|
||||
Chile,Americas,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Colombia,Americas,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Costa Rica,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Cuba,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Dominican Republic,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Ecuador,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
El Salvador,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Grenada,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Guatemala,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Guyana,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Haiti,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Honduras,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Nicaragua,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Panama,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Paraguay,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Peru,Americas,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Saint Lucia,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Saint Vincent and the Grenadines,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Suriname,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Uruguay,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Venezuela,Americas,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Afghanistan,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Armenia,Asia-Pacific,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Cambodia,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Georgia,Asia-Pacific,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Kazakhstan,Asia-Pacific,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Kiribati,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Marshall Islands,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Micronesia (Federated States of),Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Nauru,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Philippines,Asia-Pacific,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Tajikistan,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Thailand,Asia-Pacific,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Timor-Leste,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Turkmenistan,Asia-Pacific,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Albania,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Andorra,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Austria,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Belarus,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Bosnia & Herzegovina,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Bulgaria,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Croatia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Cyprus,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Czechia,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Estonia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Germany,Europe,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Greece,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Holy See (Vatican City),Europe,Full Diplomatic Relations,Critical,Yes,Core Datacenter,
|
||||
Hungary,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Italy,Europe,Full Diplomatic Relations,Critical,Yes,Core Datacenter,
|
||||
Latvia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Liechtenstein,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Lithuania,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Malta,Europe,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Moldova,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Monaco,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Montenegro,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
North Macedonia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Poland,Europe,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Portugal,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Romania,Europe,Full Diplomatic Relations,Medium,Yes,Regional Datacenter,
|
||||
Russian Federation,Europe,Full Diplomatic Relations (Special Mission),Medium,Yes,Edge/CDN,Special Mission Status
|
||||
San Marino,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Serbia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Slovakia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Slovenia,Europe,Full Diplomatic Relations,Low,Yes,Edge/CDN,
|
||||
Spain,Europe,Full Diplomatic Relations,High,Yes,Regional Datacenter,
|
||||
Ukraine,Europe,Full Diplomatic Relations,Medium,Yes,Edge/CDN,
|
||||
Belgium,Europe,Official (Non-Diplomatic),High,Yes,Regional Datacenter,
|
||||
France,Europe,Official (Non-Diplomatic),High,Yes,Regional Datacenter,
|
||||
Canada,Americas,Official (Non-Diplomatic),High,Yes,Regional Datacenter,
|
||||
United Kingdom,Europe,Official (Non-Diplomatic),High,Yes,Regional Datacenter,
|
||||
State of Palestine,Middle East,Ambassador Level,Medium,Yes,Edge/CDN,Ambassador-level relations
|
||||
EOF
|
||||
|
||||
# Create regional summary CSV
|
||||
cat > "${OUTPUT_DIR}/smom_regions_summary_${TIMESTAMP}.csv" << 'EOF'
|
||||
Region,Total Countries,Full Diplomatic Relations,Official Relations,Ambassador Level,Core Datacenters,Regional Datacenters,Edge/CDN Only
|
||||
Africa (Sub-Saharan),36,36,0,0,0,4,32
|
||||
Middle East & North Africa,4,4,0,0,0,4,0
|
||||
Americas,27,26,1,0,1,3,23
|
||||
Asia-Pacific,14,14,0,0,0,5,9
|
||||
Europe,39,35,4,0,2,10,27
|
||||
Total,120,115,5,1,3,26,91
|
||||
EOF
|
||||
|
||||
echo "CSV files generated:"
|
||||
echo " - ${OUTPUT_DIR}/smom_countries_full_${TIMESTAMP}.csv"
|
||||
echo " - ${OUTPUT_DIR}/smom_regions_summary_${TIMESTAMP}.csv"
|
||||
185
scripts/infrastructure/generate-topology-data.ts
Normal file
185
scripts/infrastructure/generate-topology-data.ts
Normal file
@@ -0,0 +1,185 @@
|
||||
#!/usr/bin/env tsx
|
||||
/**
|
||||
* Generate network topology JSON from entity registry
|
||||
* Usage: tsx scripts/infrastructure/generate-topology-data.ts
|
||||
*/
|
||||
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import type { NetworkTopology, TopologyNode, TopologyEdge } from '../../src/lib/types/infrastructure'
|
||||
|
||||
const PROJECT_ROOT = path.resolve(__dirname, '../..')
|
||||
const DATA_DIR = path.join(PROJECT_ROOT, 'docs/infrastructure/data')
|
||||
const ENTITY_REGISTRY = path.join(PROJECT_ROOT, 'docs/infrastructure/ENTITY_REGISTRY.md')
|
||||
|
||||
// Generate topology data based on entity registry structure
|
||||
function generateTopologyData(): NetworkTopology[] {
|
||||
const topologies: NetworkTopology[] = []
|
||||
|
||||
// Cloudflare as root node
|
||||
const cloudflareNode: TopologyNode = {
|
||||
id: 'cloudflare',
|
||||
type: 'region',
|
||||
label: 'Cloudflare Global Network',
|
||||
region: 'Global',
|
||||
entity: 'Cloudflare',
|
||||
position: { x: 400, y: 50 },
|
||||
metadata: {
|
||||
asn: 'AS13335',
|
||||
dataCenters: 300,
|
||||
},
|
||||
}
|
||||
|
||||
// VM 137 - Cloudflare Tunnel
|
||||
const vm137Node: TopologyNode = {
|
||||
id: 'vm-137',
|
||||
type: 'vm',
|
||||
label: 'VM 137 (cloudflare-tunnel-vm)',
|
||||
region: 'Site 2',
|
||||
entity: 'Sankofa Phoenix',
|
||||
position: { x: 300, y: 200 },
|
||||
metadata: {
|
||||
vmid: 137,
|
||||
host: 'r630-01',
|
||||
ip: '192.168.11.11',
|
||||
function: 'Cloudflare Tunnel Agent',
|
||||
},
|
||||
}
|
||||
|
||||
// VM 136 - Nginx Proxy
|
||||
const vm136Node: TopologyNode = {
|
||||
id: 'vm-136',
|
||||
type: 'vm',
|
||||
label: 'VM 136 (nginx-proxy-vm)',
|
||||
region: 'Site 1',
|
||||
entity: 'Sankofa Phoenix',
|
||||
position: { x: 500, y: 200 },
|
||||
metadata: {
|
||||
vmid: 136,
|
||||
host: 'ml110-01',
|
||||
ip: '192.168.11.10',
|
||||
function: 'Reverse Proxy, SSL Termination',
|
||||
},
|
||||
}
|
||||
|
||||
// Regional topologies for SMOM
|
||||
const smomRegions = [
|
||||
{ name: 'Europe', x: 400, y: 350, countries: 35 },
|
||||
{ name: 'Americas', x: 200, y: 350, countries: 26 },
|
||||
{ name: 'Asia-Pacific', x: 600, y: 350, countries: 14 },
|
||||
{ name: 'Africa', x: 400, y: 500, countries: 36 },
|
||||
{ name: 'Middle East', x: 500, y: 500, countries: 4 },
|
||||
]
|
||||
|
||||
smomRegions.forEach((region, index) => {
|
||||
const regionNode: TopologyNode = {
|
||||
id: `region-${region.name.toLowerCase()}`,
|
||||
type: 'region',
|
||||
label: `${region.name} Region`,
|
||||
region: region.name,
|
||||
entity: 'Sovereign Order of Hospitallers',
|
||||
position: { x: region.x, y: region.y },
|
||||
metadata: {
|
||||
countries: region.countries,
|
||||
priority: index < 2 ? 'High' : 'Medium',
|
||||
},
|
||||
}
|
||||
|
||||
const datacenterNode: TopologyNode = {
|
||||
id: `dc-${region.name.toLowerCase()}`,
|
||||
type: 'datacenter',
|
||||
label: `${region.name} Datacenter`,
|
||||
region: region.name,
|
||||
entity: 'Sovereign Order of Hospitallers',
|
||||
position: { x: region.x, y: region.y + 100 },
|
||||
metadata: {
|
||||
tier: index < 2 ? 'Tier 1' : 'Tier 2',
|
||||
},
|
||||
}
|
||||
|
||||
const tunnelNode: TopologyNode = {
|
||||
id: `tunnel-${region.name.toLowerCase()}`,
|
||||
type: 'tunnel',
|
||||
label: `${region.name} Tunnel`,
|
||||
region: region.name,
|
||||
entity: 'Sovereign Order of Hospitallers',
|
||||
position: { x: region.x + 100, y: region.y },
|
||||
metadata: {
|
||||
tunnelId: `hospitallers-${region.name.toLowerCase()}-tunnel`,
|
||||
networkRoute: `10.${10 + index}.0.0/16`,
|
||||
},
|
||||
}
|
||||
|
||||
const edges: TopologyEdge[] = [
|
||||
{
|
||||
id: `edge-cloudflare-${region.name.toLowerCase()}`,
|
||||
source: 'cloudflare',
|
||||
target: regionNode.id,
|
||||
type: 'tunnel',
|
||||
metadata: { bandwidth: '10Gbps' },
|
||||
},
|
||||
{
|
||||
id: `edge-${region.name.toLowerCase()}-dc`,
|
||||
source: regionNode.id,
|
||||
target: datacenterNode.id,
|
||||
type: 'network-route',
|
||||
metadata: {},
|
||||
},
|
||||
{
|
||||
id: `edge-${region.name.toLowerCase()}-tunnel`,
|
||||
source: regionNode.id,
|
||||
target: tunnelNode.id,
|
||||
type: 'tunnel',
|
||||
metadata: {},
|
||||
},
|
||||
]
|
||||
|
||||
topologies.push({
|
||||
nodes: [cloudflareNode, vm137Node, vm136Node, regionNode, datacenterNode, tunnelNode],
|
||||
edges: [
|
||||
{
|
||||
id: 'edge-cloudflare-vm137',
|
||||
source: 'cloudflare',
|
||||
target: 'vm-137',
|
||||
type: 'tunnel',
|
||||
metadata: {},
|
||||
},
|
||||
{
|
||||
id: 'edge-vm137-vm136',
|
||||
source: 'vm-137',
|
||||
target: 'vm-136',
|
||||
type: 'network-route',
|
||||
metadata: {},
|
||||
},
|
||||
...edges,
|
||||
],
|
||||
region: region.name,
|
||||
entity: 'Sovereign Order of Hospitallers',
|
||||
lastUpdated: new Date().toISOString(),
|
||||
})
|
||||
})
|
||||
|
||||
return topologies
|
||||
}
|
||||
|
||||
function main() {
|
||||
const topologies = generateTopologyData()
|
||||
|
||||
// Write individual topology files
|
||||
topologies.forEach(topology => {
|
||||
const filename = `topology-${topology.region.toLowerCase().replace(/\s+/g, '-')}.json`
|
||||
const filepath = path.join(DATA_DIR, filename)
|
||||
fs.writeFileSync(filepath, JSON.stringify(topology, null, 2))
|
||||
console.log(`✓ Created ${filename}`)
|
||||
})
|
||||
|
||||
// Write combined topology file
|
||||
const combinedFile = path.join(DATA_DIR, 'network_topology.json')
|
||||
fs.writeFileSync(combinedFile, JSON.stringify(topologies, null, 2))
|
||||
console.log(`✓ Created network_topology.json with ${topologies.length} regional topologies`)
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user