#!/bin/bash ####################################### # SIAX Agent - Preparar Binario para Distribución # Compila y copia el binario a web/static/binary/ ####################################### set -e GREEN='\033[0;32m' BLUE='\033[0;34m' RED='\033[0;31m' NC='\033[0m' echo -e "${BLUE}============================================${NC}" echo -e "${BLUE} Preparando SIAX Agent para Distribución${NC}" echo -e "${BLUE}============================================${NC}" echo "" # Compilar en release echo -e "${BLUE}📦 Compilando en modo release...${NC}" cargo build --release if [ ! -f "target/release/siax_monitor" ]; then echo -e "${RED}❌ Error: No se pudo compilar el binario${NC}" exit 1 fi echo -e "${GREEN}✅ Compilación exitosa${NC}" echo "" # Crear directorio para binarios echo -e "${BLUE}📁 Creando directorio web/static/binary/${NC}" mkdir -p web/static/binary # Copiar binario echo -e "${BLUE}📋 Copiando binario...${NC}" cp target/release/siax_monitor web/static/binary/siax-agent chmod +x web/static/binary/siax-agent echo -e "${GREEN}✅ Binario copiado a web/static/binary/siax-agent${NC}" echo "" # Mostrar información BINARY_SIZE=$(du -h web/static/binary/siax-agent | cut -f1) echo -e "${GREEN}============================================${NC}" echo -e "${GREEN} ✅ Preparación completada${NC}" echo -e "${GREEN}============================================${NC}" echo "" echo "📊 Tamaño del binario: $BINARY_SIZE" echo "📂 Ubicación: web/static/binary/siax-agent" echo "" echo "🚀 Ahora puedes:" echo "" echo " 1. Iniciar el servidor:" echo " cargo run --release" echo "" echo " 2. Desde otro servidor, instalar con:" echo " curl -sSL http://TU-SERVIDOR:8080/install.sh | sudo bash" echo "" echo " O especificar el servidor:" echo " curl -sSL http://TU-SERVIDOR:8080/install.sh | sudo SIAX_SERVER=TU-SERVIDOR:8080 bash" echo "" echo "Ejemplo VPN:" echo " curl -sSL http://10.8.0.1:8080/install.sh | sudo SIAX_SERVER=10.8.0.1:8080 bash" echo ""