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>
177 lines
6.4 KiB
Bash
Executable File
177 lines
6.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Setup VM for Bridge Deployment
|
|
# Installs all prerequisites in the Proxmox VM
|
|
|
|
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
|
|
|
|
PROXMOX_HOST="${PROXMOX_HOST:-${PROXMOX_HOST_ML110:-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 "Setup VM for Bridge Deployment"
|
|
log_info "VMID: $VMID"
|
|
log_info "Proxmox Host: $PROXMOX_HOST"
|
|
|
|
# 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_error "VM $VMID is not running"
|
|
exit 1
|
|
fi
|
|
log_success "VM is running"
|
|
|
|
# Step 1: Install system packages
|
|
log_section "Step 1: Install System Packages"
|
|
log_info "Installing bc, curl, git, build-essential..."
|
|
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c '
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get update -qq
|
|
apt-get install -y -qq bc curl git build-essential jq >/dev/null 2>&1
|
|
'" 2>&1
|
|
|
|
if [ $? -eq 0 ]; then
|
|
log_success "System packages installed"
|
|
else
|
|
log_error "Failed to install system packages"
|
|
exit 1
|
|
fi
|
|
|
|
# Step 2: Install Foundry
|
|
log_section "Step 2: Install Foundry"
|
|
log_info "Installing Foundry (this may take a few minutes)..."
|
|
|
|
FOUNDRY_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'which forge 2>/dev/null || echo missing'" 2>&1)
|
|
if echo "$FOUNDRY_CHECK" | grep -qv "missing"; then
|
|
log_success "Foundry already installed"
|
|
else
|
|
log_info "Installing Foundry..."
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c '
|
|
curl -L https://foundry.paradigm.xyz | bash
|
|
export PATH=\"\$HOME/.foundry/bin:\$PATH\"
|
|
foundryup
|
|
'" 2>&1 | tail -20
|
|
|
|
# Verify installation
|
|
FOUNDRY_VER=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'export PATH=\"\$HOME/.foundry/bin:\$PATH\" && forge --version 2>&1' | head -1" 2>&1)
|
|
if echo "$FOUNDRY_VER" | grep -q "forge"; then
|
|
log_success "Foundry installed: $FOUNDRY_VER"
|
|
else
|
|
log_error "Foundry installation may have failed"
|
|
log_info "Try manual installation: pct exec $VMID -- bash -c 'curl -L https://foundry.paradigm.xyz | bash && foundryup'"
|
|
fi
|
|
fi
|
|
|
|
# Step 3: Create project directory structure
|
|
log_section "Step 3: Create Project Directory"
|
|
log_info "Creating project directory structure..."
|
|
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c '
|
|
mkdir -p /home/intlc/projects/proxmox/smom-dbis-138
|
|
mkdir -p /home/intlc/projects/proxmox/scripts
|
|
chown -R intlc:intlc /home/intlc/projects 2>/dev/null || true
|
|
'" 2>&1
|
|
|
|
log_success "Project directories created"
|
|
|
|
# Step 4: Copy .env file
|
|
log_section "Step 4: Copy Environment File"
|
|
if [ -f "smom-dbis-138/.env" ]; then
|
|
log_info "Copying .env file to VM..."
|
|
ENV_CONTENT=$(cat "smom-dbis-138/.env")
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'cat > /home/intlc/projects/proxmox/smom-dbis-138/.env <<ENVEOF
|
|
$ENV_CONTENT
|
|
ENVEOF
|
|
chmod 600 /home/intlc/projects/proxmox/smom-dbis-138/.env
|
|
'" 2>&1
|
|
log_success ".env file copied"
|
|
else
|
|
log_warn ".env file not found locally - will need to be created in VM"
|
|
fi
|
|
|
|
# Step 5: Copy deployment script
|
|
log_section "Step 5: Copy Deployment Scripts"
|
|
log_info "Copying deployment scripts to VM..."
|
|
|
|
# Copy main deployment script
|
|
if [ -f "scripts/deploy-all-bridges-standalone.sh" ]; then
|
|
SCRIPT_CONTENT=$(cat "scripts/deploy-all-bridges-standalone.sh")
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'cat > /home/intlc/projects/proxmox/scripts/deploy-all-bridges-standalone.sh <<SCRIPTEOF
|
|
$SCRIPT_CONTENT
|
|
SCRIPTEOF
|
|
chmod +x /home/intlc/projects/proxmox/scripts/deploy-all-bridges-standalone.sh
|
|
'" 2>&1
|
|
log_success "Deployment script copied"
|
|
fi
|
|
|
|
# Copy gas price calculation script
|
|
if [ -f "scripts/calculate-chain138-gas-price.sh" ]; then
|
|
GAS_SCRIPT=$(cat "scripts/calculate-chain138-gas-price.sh")
|
|
ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'cat > /home/intlc/projects/proxmox/scripts/calculate-chain138-gas-price.sh <<GASEOF
|
|
$GAS_SCRIPT
|
|
GASEOF
|
|
chmod +x /home/intlc/projects/proxmox/scripts/calculate-chain138-gas-price.sh
|
|
'" 2>&1
|
|
log_success "Gas price script copied"
|
|
fi
|
|
|
|
# Step 6: Copy contract source files (if needed)
|
|
log_section "Step 6: Prepare Contract Files"
|
|
log_info "Checking if contract source files need to be copied..."
|
|
|
|
# We'll need the contract source files for compilation
|
|
# For now, we'll copy the essential structure
|
|
log_info "Contract files will be needed for compilation"
|
|
log_info "You may need to copy the entire smom-dbis-138 directory or mount it"
|
|
|
|
# Step 7: Verify prerequisites
|
|
log_section "Step 7: Verify Prerequisites"
|
|
|
|
# Check Foundry
|
|
FOUNDRY_VER=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash -c 'export PATH=\"\$HOME/.foundry/bin:\$PATH\" && forge --version 2>&1' | head -1" 2>&1)
|
|
if echo "$FOUNDRY_VER" | grep -q "forge"; then
|
|
log_success "Foundry: $FOUNDRY_VER"
|
|
else
|
|
log_error "Foundry not working"
|
|
fi
|
|
|
|
# Check bc
|
|
BC_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- which bc 2>&1" || echo "")
|
|
if echo "$BC_CHECK" | grep -q "bc"; then
|
|
log_success "bc installed"
|
|
else
|
|
log_error "bc not installed"
|
|
fi
|
|
|
|
# Check project directory
|
|
PROJECT_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- test -d /home/intlc/projects/proxmox && echo 'exists' || echo 'missing'" 2>&1)
|
|
if echo "$PROJECT_CHECK" | grep -q "exists"; then
|
|
log_success "Project directory exists"
|
|
else
|
|
log_error "Project directory missing"
|
|
fi
|
|
|
|
log_section "Setup Complete"
|
|
log_info "Next steps:"
|
|
log_info "1. Copy contract source files to VM (or mount project directory)"
|
|
log_info "2. Run: ./scripts/deploy-via-proxmox.sh"
|