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>
108 lines
3.4 KiB
Bash
Executable File
108 lines
3.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Fix hostname resolution issues on pve and pve2
|
|
# The issue: pve-cluster cannot resolve hostname to non-loopback IP
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# 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"; }
|
|
|
|
# Load IP configuration
|
|
source "${PROJECT_ROOT}/config/ip-addresses.conf" 2>/dev/null || true
|
|
|
|
# Host configuration
|
|
declare -A HOSTS
|
|
HOSTS[pve]="${PROXMOX_HOST_R630_01:-192.168.11.11}:password:pve:r630-01"
|
|
HOSTS[pve2]="${PROXMOX_HOST_R630_02:-192.168.11.12}:password:pve2:r630-02"
|
|
|
|
fix_host() {
|
|
local hostname="$1"
|
|
local ip="${HOSTS[$hostname]%%:*}"
|
|
local password="${HOSTS[$hostname]#*:}"
|
|
password="${password%%:*}"
|
|
local current_hostname="${HOSTS[$hostname]#*:*:}"
|
|
current_hostname="${current_hostname%%:*}"
|
|
local correct_hostname="${HOSTS[$hostname]##*:}"
|
|
|
|
log_info "=== Fixing ${hostname} (${ip}) ==="
|
|
echo ""
|
|
|
|
sshpass -p "$password" ssh -o StrictHostKeyChecking=no root@"$ip" bash <<ENDSSH
|
|
set -e
|
|
|
|
echo "=== Current Configuration ==="
|
|
echo "Hostname: \$(hostname)"
|
|
echo "IP Address: ${ip}"
|
|
echo ""
|
|
|
|
echo "=== Current /etc/hosts ==="
|
|
cat /etc/hosts
|
|
echo ""
|
|
|
|
echo "=== Fixing /etc/hosts ==="
|
|
# Backup
|
|
cp /etc/hosts /etc/hosts.backup.\$(date +%Y%m%d_%H%M%S)
|
|
|
|
# Remove any existing entries for this hostname and IP
|
|
sed -i "/${ip}/d" /etc/hosts
|
|
sed -i "/${current_hostname}/d" /etc/hosts
|
|
sed -i "/${correct_hostname}/d" /etc/hosts
|
|
|
|
# Add correct entry - hostname must resolve to non-loopback IP
|
|
echo "${ip} ${current_hostname} ${current_hostname}.sankofa.nexus ${correct_hostname} ${correct_hostname}.sankofa.nexus" >> /etc/hosts
|
|
|
|
echo "=== Updated /etc/hosts ==="
|
|
cat /etc/hosts
|
|
echo ""
|
|
|
|
echo "=== Testing hostname resolution ==="
|
|
getent hosts ${current_hostname} || echo "Resolution failed"
|
|
getent hosts ${ip} || echo "Reverse resolution failed"
|
|
echo ""
|
|
|
|
echo "=== Verifying IP is not loopback ==="
|
|
resolved_ip=\$(getent hosts ${current_hostname} | awk '{print \$1}')
|
|
if [[ "\$resolved_ip" == "${ip}" ]]; then
|
|
echo "SUCCESS: Hostname resolves to correct IP (${ip})"
|
|
else
|
|
echo "WARNING: Hostname resolves to: \$resolved_ip (expected ${ip})"
|
|
fi
|
|
echo ""
|
|
ENDSSH
|
|
|
|
echo ""
|
|
log_info "Attempting to start pve-cluster service..."
|
|
sshpass -p "$password" ssh -o StrictHostKeyChecking=no root@"$ip" bash <<'ENDSSH'
|
|
systemctl start pve-cluster || {
|
|
echo "Still failing, checking logs..."
|
|
journalctl -u pve-cluster --no-pager -n 5
|
|
}
|
|
sleep 2
|
|
systemctl status pve-cluster --no-pager -l | head -15 || true
|
|
ENDSSH
|
|
|
|
echo ""
|
|
log_success "Fix complete for ${hostname}"
|
|
echo "----------------------------------------"
|
|
echo ""
|
|
}
|
|
|
|
# Fix both hosts
|
|
fix_host "pve"
|
|
fix_host "pve2"
|
|
|
|
log_success "All hostname resolution fixes complete!"
|
|
log_info "Now try running the SSL/cluster fix script again:"
|
|
log_info " ./scripts/fix-proxmox-ssl-cluster.sh both"
|