Files
proxmox/scripts/archive/consolidated/deploy/deploy-all-via-proxmox-master.sh
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- 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>
2026-02-12 15:46:57 -08:00

150 lines
5.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Master Deployment Script for Proxmox
# Orchestrates complete deployment workflow
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
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$PROJECT_ROOT"
# Configuration
PROXMOX_HOST="${PROXMOX_HOST:-192.168.11.10}"
PROXMOX_USER="${PROXMOX_USER:-root}"
VMID="${VMID:-2101}"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
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"; }
log_section() { echo -e "\n${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"; echo -e "${CYAN}$1${NC}"; echo -e "${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}\n"; }
log_section "Master Deployment Script - Proxmox"
log_info "Proxmox Host: $PROXMOX_HOST"
log_info "VMID: $VMID"
log_info "Project Root: $PROJECT_ROOT"
# Step 1: Test Proxmox connectivity
log_section "Step 1: Test Proxmox Connectivity"
if ssh -o ConnectTimeout=5 "${PROXMOX_USER}@${PROXMOX_HOST}" "echo 'Connected'" 2>/dev/null; then
log_success "Proxmox host accessible"
else
log_error "Cannot connect to Proxmox host: $PROXMOX_HOST"
log_info "Ensure you're running from a system with network access to the Proxmox host"
exit 1
fi
# Step 2: Check VM status
log_section "Step 2: Check VM Status"
VM_STATUS=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct status $VMID 2>&1" || echo "")
if echo "$VM_STATUS" | grep -q "running"; then
log_success "VM $VMID is running"
else
log_error "VM $VMID is not running"
log_info "Start VM: ssh ${PROXMOX_USER}@${PROXMOX_HOST} 'pct start $VMID'"
exit 1
fi
# Step 3: Copy project files
log_section "Step 3: Copy Project Files"
if [ -f "scripts/copy-project-to-vm.sh" ]; then
log_info "Copying project files to VM..."
if ./scripts/copy-project-to-vm.sh 2>&1; then
log_success "Project files copied"
else
log_warn "Project copy had issues, but continuing"
fi
else
log_warn "Copy script not found, skipping file copy"
fi
# Step 4: Check prerequisites
log_section "Step 4: Check Prerequisites"
if [ -f "scripts/check-vm-prerequisites.sh" ]; then
if ./scripts/check-vm-prerequisites.sh 2>&1; then
log_success "Prerequisites verified"
else
log_warn "Some prerequisites missing"
log_info "Installing prerequisites..."
if [ -f "scripts/setup-vm-for-deployment.sh" ]; then
./scripts/setup-vm-for-deployment.sh 2>&1 || log_warn "Prerequisites setup had issues"
fi
fi
else
log_warn "Prerequisites check script not found"
fi
# Step 5: Execute deployment
log_section "Step 5: Execute Deployment"
log_info "Executing deployment in VMID $VMID..."
# Get deployment script content
if [ ! -f "scripts/deploy-all-bridges-standalone.sh" ]; then
log_error "Deployment script not found"
exit 1
fi
DEPLOY_SCRIPT_CONTENT=$(cat "scripts/deploy-all-bridges-standalone.sh")
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
LOG_FILE="/tmp/proxmox-deployment-$TIMESTAMP.log"
log_info "Deployment log: $LOG_FILE"
# Execute in VM
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c '
cd /home/intlc/projects/proxmox || cd /root/projects/proxmox || cd /tmp
export PATH=\"\$HOME/.foundry/bin:\$PATH\"
# Write deployment script
cat > /tmp/deploy-bridges.sh <<SCRIPTEOF
$DEPLOY_SCRIPT_CONTENT
SCRIPTEOF
chmod +x /tmp/deploy-bridges.sh
# Execute deployment
bash /tmp/deploy-bridges.sh 2>&1 | tee /tmp/deployment-$TIMESTAMP.log
'" 2>&1 | tee "$LOG_FILE"
DEPLOY_EXIT=$?
if [ "$DEPLOY_EXIT" -eq 0 ]; then
log_success "Deployment completed successfully!"
# Retrieve deployed addresses
log_section "Step 6: Retrieve Deployment Results"
DEPLOYED_ADDRESSES=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- cat /tmp/chain138-deployed-addresses-*.txt 2>/dev/null | tail -1" 2>&1 || echo "")
if [ -n "$DEPLOYED_ADDRESSES" ]; then
log_success "Deployed addresses:"
echo "$DEPLOYED_ADDRESSES"
echo "$DEPLOYED_ADDRESSES" > "/tmp/chain138-deployed-addresses-proxmox-$TIMESTAMP.txt"
log_info "Addresses saved to: /tmp/chain138-deployed-addresses-proxmox-$TIMESTAMP.txt"
else
log_warn "Could not retrieve deployed addresses"
fi
else
log_error "Deployment failed with exit code: $DEPLOY_EXIT"
log_info "Check logs: $LOG_FILE"
log_info "Check VM logs: ssh ${PROXMOX_USER}@${PROXMOX_HOST} 'pct exec $VMID -- cat /tmp/deployment-*.log'"
exit 1
fi
log_section "Deployment Complete"
log_success "✅ All deployments executed via Proxmox"
log_info "Review logs: $LOG_FILE"