92 lines
2.9 KiB
Text
92 lines
2.9 KiB
Text
|
|
#!/usr/bin/env nu
|
||
|
|
# Demo 1: Provisioning Básico - Rust Meetup 2025
|
||
|
|
# Este script demuestra el uso básico del sistema de provisioning
|
||
|
|
|
||
|
|
# Configurar ambiente para la demo
|
||
|
|
print "🎬 Demo 1: Provisioning Básico"
|
||
|
|
print "=============================="
|
||
|
|
|
||
|
|
# Paso 1: Generar nueva infraestructura
|
||
|
|
print "\n📋 Paso 1: Generando nueva infraestructura..."
|
||
|
|
sleep 1sec
|
||
|
|
print "$ provisioning generate infra --new rust-meetup-demo"
|
||
|
|
|
||
|
|
# Simular la creación (en demo real, ejecutar el comando real)
|
||
|
|
print "✅ Infraestructura 'rust-meetup-demo' creada"
|
||
|
|
print "📁 Directorio: $env.PROVISIONING_INFRA_PATH/rust-meetup-demo"
|
||
|
|
|
||
|
|
# Paso 2: Mostrar configuración generada
|
||
|
|
print "\n🔍 Paso 2: Examinando configuración generada..."
|
||
|
|
sleep 1sec
|
||
|
|
print "$ provisioning show settings --infra rust-meetup-demo --out json"
|
||
|
|
|
||
|
|
# Simular salida JSON estructurada
|
||
|
|
let demo_config = {
|
||
|
|
main_name: "rust-meetup-demo"
|
||
|
|
main_title: "Rust Meetup Demo Infrastructure"
|
||
|
|
provider: "aws"
|
||
|
|
region: "eu-west-1"
|
||
|
|
servers: [
|
||
|
|
{
|
||
|
|
hostname: "demo-server-01"
|
||
|
|
instance_type: "t3.medium"
|
||
|
|
cpu: 2
|
||
|
|
memory: "4GB"
|
||
|
|
storage: "20GB"
|
||
|
|
purpose: "demo"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
taskservs: ["kubernetes", "youki", "cosmian-kms"]
|
||
|
|
}
|
||
|
|
|
||
|
|
print ($demo_config | to json)
|
||
|
|
|
||
|
|
# Paso 3: Validar configuración (modo check)
|
||
|
|
print "\n✅ Paso 3: Validando configuración (modo check)..."
|
||
|
|
sleep 1sec
|
||
|
|
print "$ provisioning server create --infra rust-meetup-demo --check"
|
||
|
|
print "🔍 Modo check: No se crearán recursos reales"
|
||
|
|
print "✅ Configuración válida"
|
||
|
|
print "💰 Costo estimado: $45/mes"
|
||
|
|
print "⏱️ Tiempo estimado: 5-7 minutos"
|
||
|
|
|
||
|
|
# Paso 4: Crear servidores reales
|
||
|
|
print "\n🚀 Paso 4: Creando servidores..."
|
||
|
|
sleep 1sec
|
||
|
|
print "$ provisioning server create --infra rust-meetup-demo --wait"
|
||
|
|
print "🔄 Creando servidor demo-server-01..."
|
||
|
|
print "⏳ Esperando que el servidor esté listo..."
|
||
|
|
sleep 2sec
|
||
|
|
print "✅ Servidor demo-server-01 creado y listo"
|
||
|
|
print "🌐 IP pública: 203.0.113.42"
|
||
|
|
print "🔑 SSH: ssh -i ~/.ssh/provisioning ec2-user@203.0.113.42"
|
||
|
|
|
||
|
|
# Paso 5: Verificar estado
|
||
|
|
print "\n📊 Paso 5: Verificando estado de la infraestructura..."
|
||
|
|
sleep 1sec
|
||
|
|
print "$ provisioning show servers --infra rust-meetup-demo"
|
||
|
|
|
||
|
|
let server_status = [
|
||
|
|
{
|
||
|
|
hostname: "demo-server-01"
|
||
|
|
status: "running"
|
||
|
|
public_ip: "203.0.113.42"
|
||
|
|
private_ip: "10.0.1.100"
|
||
|
|
instance_type: "t3.medium"
|
||
|
|
uptime: "2 minutes"
|
||
|
|
cost_hour: "$0.0464"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
print ($server_status | table)
|
||
|
|
|
||
|
|
print "\n🎯 Demo completada!"
|
||
|
|
print "⭐ Ventajas mostradas:"
|
||
|
|
print " - Configuración declarativa con tipos"
|
||
|
|
print " - Validación antes de crear recursos"
|
||
|
|
print " - Salida estructurada (JSON/YAML/tabla)"
|
||
|
|
print " - Mejor debugging y error reporting"
|
||
|
|
|
||
|
|
# Cleanup opcional
|
||
|
|
print "\n🧹 Para limpiar recursos de demo:"
|
||
|
|
print "$ provisioning server delete --infra rust-meetup-demo --yes"
|