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>
141 lines
4.6 KiB
Bash
Executable File
141 lines
4.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Check Prerequisites in Proxmox VM
|
|
# Verifies all required tools and dependencies are installed
|
|
|
|
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:-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 "Checking Prerequisites in VMID $VMID"
|
|
|
|
ERRORS=0
|
|
WARNINGS=0
|
|
|
|
# Check VM status
|
|
log_info "1. Checking 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 is running"
|
|
else
|
|
log_error "VM is not running: $VM_STATUS"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check Foundry
|
|
log_info "2. Checking Foundry installation..."
|
|
FOUNDRY_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- forge --version 2>&1" || echo "")
|
|
if echo "$FOUNDRY_CHECK" | grep -q "forge"; then
|
|
FORGE_VERSION=$(echo "$FOUNDRY_CHECK" | head -1)
|
|
log_success "Foundry: $FORGE_VERSION"
|
|
else
|
|
log_error "Foundry not installed"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check cast
|
|
log_info "3. Checking cast..."
|
|
CAST_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- cast --version 2>&1" || echo "")
|
|
if echo "$CAST_CHECK" | grep -q "cast"; then
|
|
log_success "Cast available"
|
|
else
|
|
log_error "Cast not available"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check bash
|
|
log_info "4. Checking bash..."
|
|
BASH_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- bash --version 2>&1 | head -1" || echo "")
|
|
if [ -n "$BASH_CHECK" ]; then
|
|
log_success "Bash: $(echo "$BASH_CHECK" | head -1)"
|
|
else
|
|
log_error "Bash not available"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Check bc (for calculations)
|
|
log_info "5. Checking 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 available"
|
|
else
|
|
log_warn "bc not available (needed for calculations)"
|
|
WARNINGS=$((WARNINGS + 1))
|
|
fi
|
|
|
|
# Check curl
|
|
log_info "6. Checking curl..."
|
|
CURL_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- which curl 2>&1" || echo "")
|
|
if echo "$CURL_CHECK" | grep -q "curl"; then
|
|
log_success "curl available"
|
|
else
|
|
log_warn "curl not available"
|
|
WARNINGS=$((WARNINGS + 1))
|
|
fi
|
|
|
|
# Check project directory
|
|
log_info "7. Checking 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_warn "Project directory not found: /home/intlc/projects/proxmox"
|
|
WARNINGS=$((WARNINGS + 1))
|
|
fi
|
|
|
|
# Check .env file
|
|
log_info "8. Checking .env file..."
|
|
ENV_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- test -f /home/intlc/projects/proxmox/smom-dbis-138/.env && echo 'exists' || echo 'missing'" 2>&1)
|
|
if echo "$ENV_CHECK" | grep -q "exists"; then
|
|
log_success ".env file exists"
|
|
else
|
|
log_warn ".env file not found"
|
|
WARNINGS=$((WARNINGS + 1))
|
|
fi
|
|
|
|
# Check RPC connectivity from VM
|
|
log_info "9. Checking RPC connectivity from VM..."
|
|
RPC_CHECK=$(ssh "${PROXMOX_USER}@${PROXMOX_HOST}" "pct exec $VMID -- cast chain-id --rpc-url http://${RPC_CORE_1}:8545 2>&1" || echo "")
|
|
if echo "$RPC_CHECK" | grep -q "138"; then
|
|
log_success "RPC accessible from VM: Chain ID 138"
|
|
else
|
|
log_error "RPC not accessible from VM: $RPC_CHECK"
|
|
ERRORS=$((ERRORS + 1))
|
|
fi
|
|
|
|
# Summary
|
|
log_section "Summary"
|
|
|
|
if [ "$ERRORS" -eq 0 ] && [ "$WARNINGS" -eq 0 ]; then
|
|
log_success "✅ All prerequisites met - Ready for deployment"
|
|
exit 0
|
|
elif [ "$ERRORS" -eq 0 ]; then
|
|
log_warn "⚠️ Prerequisites met with $WARNINGS warnings"
|
|
log_info "Warnings are non-blocking"
|
|
exit 0
|
|
else
|
|
log_error "✗ Prerequisites not met: $ERRORS errors, $WARNINGS warnings"
|
|
exit 1
|
|
fi
|