#!/usr/bin/env bash set -euo pipefail # Load IP configuration SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true # Complete Node List Deployment - Orchestrates all steps # 1. Verify node lists # 2. Deploy to all nodes # 3. Verify p2p-host configuration # 4. Provide restart instructions set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' CYAN='\033[0;36m' MAGENTA='\033[0;35m' NC='\033[0m' log_info() { echo -e "${BLUE}[INFO]${NC} $1"; } log_success() { echo -e "${GREEN}[✓]${NC} $1"; } log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; } log_error() { echo -e "${RED}[ERROR]${NC} $1"; } log_section() { echo -e "\n${CYAN}════════════════════════════════════════════════════════════════${NC}"; echo -e "${MAGENTA} $1${NC}"; echo -e "${CYAN}════════════════════════════════════════════════════════════════${NC}\n"; } log_section "Complete Node List Deployment - ChainID 138" # Step 1: Verify node lists log_section "Step 1: Verifying Node Lists" if [ -f "$PROJECT_ROOT/scripts/besu/verify-and-update-node-lists.sh" ]; then "$PROJECT_ROOT/scripts/besu/verify-and-update-node-lists.sh" else log_warn "Verification script not found - skipping" fi # Step 2: Deploy to all nodes log_section "Step 2: Deploying Node Lists to All Nodes" read -p "Deploy static-nodes.json and permissioned-nodes.json to all nodes? (y/N): " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then if [ -f "$PROJECT_ROOT/scripts/besu/deploy-node-lists-to-all-nodes.sh" ]; then "$PROJECT_ROOT/scripts/besu/deploy-node-lists-to-all-nodes.sh" else log_error "Deployment script not found" exit 1 fi else log_info "Skipping deployment" fi # Step 3: Verify p2p-host configuration log_section "Step 3: Verifying p2p-host Configuration" if [ -f "$PROJECT_ROOT/scripts/besu/verify-p2p-host-config.sh" ]; then "$PROJECT_ROOT/scripts/besu/verify-p2p-host-config.sh" else log_warn "p2p-host verification script not found - skipping" fi # Step 4: Summary and next steps log_section "Deployment Complete - Next Steps" log_info "To apply changes, restart Besu services on all nodes:" log_info "" log_info "For each node:" log_info " ssh root@${PROXMOX_HOST_ML110:-192.168.11.10}" log_info " pct exec -- systemctl restart besu-rpc.service" log_info " # OR" log_info " pct exec -- systemctl restart besu-validator.service" log_info " pct exec -- systemctl restart besu-sentry.service" log_info "" log_info "After restart, verify peer connections:" log_info " cast rpc admin_peers " log_info "" log_info "Expected results:" log_info " - All nodes should have multiple peers connected" log_info " - Enodes should match the static-nodes.json entries" log_info " - IP addresses in enodes should match node IPs" log_info "" log_success "Node list deployment orchestration complete!"