Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
147 lines
5.3 KiB
Bash
Executable File
147 lines
5.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Deploy updated Besu node configuration files to all running Besu nodes
|
|
# Updates permissions-nodes.toml and permissioned-nodes.json with new IP addresses
|
|
|
|
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
|
|
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[1;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
|
|
log_warn() { echo -e "${YELLOW}[⚠]${NC} $1"; }
|
|
log_error() { echo -e "${RED}[✗]${NC} $1"; }
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
CONFIG_DIR="${PROJECT_ROOT}/smom-dbis-138-proxmox/config"
|
|
|
|
# Proxmox hosts
|
|
PROXMOX_HOSTS=("${PROXMOX_HOST_ML110:-192.168.11.10}" "${PROXMOX_HOST_R630_01:-192.168.11.11}" "${PROXMOX_HOST_R630_02:-192.168.11.12}")
|
|
|
|
# All Besu node VMIDs (validators, sentries, RPC nodes)
|
|
# Updated: 2500→2101, 2501→2201, 2502→2301
|
|
declare -a BESU_VMIDS=(
|
|
# Validators
|
|
1000 1001 1002 1003 1004
|
|
# Sentries
|
|
1500 1501 1502 1503
|
|
# RPC nodes (updated VMIDs)
|
|
2101 2201 2301
|
|
)
|
|
|
|
echo ""
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo "🚀 Deploy Besu Node Configuration Files"
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
# Check if config files exist
|
|
if [ ! -f "${CONFIG_DIR}/permissions-nodes.toml" ]; then
|
|
log_error "permissions-nodes.toml not found: ${CONFIG_DIR}/permissions-nodes.toml"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -f "${CONFIG_DIR}/permissioned-nodes.json" ]; then
|
|
log_error "permissioned-nodes.json not found: ${CONFIG_DIR}/permissioned-nodes.json"
|
|
exit 1
|
|
fi
|
|
|
|
log_success "Configuration files found"
|
|
log_info " - permissions-nodes.toml"
|
|
log_info " - permissioned-nodes.json"
|
|
echo ""
|
|
|
|
# Deploy to each host
|
|
deployed_count=0
|
|
failed_count=0
|
|
|
|
for host in "${PROXMOX_HOSTS[@]}"; do
|
|
log_info "Processing host: $host"
|
|
|
|
# Copy files to host
|
|
log_info " Copying files to $host..."
|
|
if scp -o ConnectTimeout=5 -o StrictHostKeyChecking=no \
|
|
"${CONFIG_DIR}/permissions-nodes.toml" \
|
|
"${CONFIG_DIR}/permissioned-nodes.json" \
|
|
"root@${host}:/tmp/" 2>/dev/null; then
|
|
log_success " ✓ Files copied"
|
|
else
|
|
log_warn " ✗ Failed to copy files (host may be unreachable)"
|
|
continue
|
|
fi
|
|
|
|
# Deploy to each VMID on this host
|
|
for vmid in "${BESU_VMIDS[@]}"; do
|
|
log_info " Checking VMID $vmid..."
|
|
|
|
# Check if container exists and is running
|
|
status=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "root@${host}" \
|
|
"pct status $vmid 2>/dev/null || echo 'not found'" || echo "unreachable")
|
|
|
|
if echo "$status" | grep -q "running"; then
|
|
log_info " Deploying to VMID $vmid..."
|
|
|
|
# Deploy files
|
|
deploy_result=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "root@${host}" << DEPLOY_SCRIPT
|
|
pct push $vmid /tmp/permissions-nodes.toml /etc/besu/permissions-nodes.toml 2>&1
|
|
pct push $vmid /tmp/permissioned-nodes.json /etc/besu/permissioned-nodes.json 2>&1
|
|
pct exec $vmid -- chown besu:besu /etc/besu/permissions-nodes.toml /etc/besu/permissioned-nodes.json 2>&1
|
|
if pct exec $vmid -- test -f /etc/besu/permissions-nodes.toml && \
|
|
pct exec $vmid -- test -f /etc/besu/permissioned-nodes.json; then
|
|
echo "SUCCESS"
|
|
else
|
|
echo "FAILED"
|
|
fi
|
|
DEPLOY_SCRIPT
|
|
)
|
|
|
|
if echo "$deploy_result" | grep -q "SUCCESS"; then
|
|
log_success " ✓ VMID $vmid: Files deployed"
|
|
deployed_count=$((deployed_count + 1))
|
|
else
|
|
log_error " ✗ VMID $vmid: Deployment failed"
|
|
failed_count=$((failed_count + 1))
|
|
fi
|
|
elif echo "$status" | grep -q "stopped"; then
|
|
log_warn " ⚠ VMID $vmid: Container is stopped (skipping)"
|
|
elif echo "$status" | grep -q "not found"; then
|
|
log_warn " ⚠ VMID $vmid: Not found on this host"
|
|
else
|
|
log_warn " ⚠ VMID $vmid: Status unknown ($status)"
|
|
fi
|
|
done
|
|
|
|
# Cleanup temp files
|
|
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no "root@${host}" \
|
|
"rm -f /tmp/permissions-nodes.toml /tmp/permissioned-nodes.json" 2>/dev/null || true
|
|
|
|
echo ""
|
|
done
|
|
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
log_info "Deployment Summary:"
|
|
log_success " Deployed: $deployed_count nodes"
|
|
if [ $failed_count -gt 0 ]; then
|
|
log_warn " Failed: $failed_count nodes"
|
|
fi
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
echo ""
|
|
|
|
log_info "Next Steps:"
|
|
echo " 1. Restart Besu services on all nodes:"
|
|
echo " ssh root@<host> 'pct exec <vmid> -- systemctl restart besu.service'"
|
|
echo " 2. Verify peer connections are working"
|
|
echo " 3. Check logs for any connection errors"
|
|
echo ""
|