Files
proxmox/scripts/archive/consolidated/fix/fix-vmid2400-dependencies.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

228 lines
8.2 KiB
Bash
Executable File

#!/bin/bash
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
# Fix Dependency Services for VMID 2400 RPC Translator
# Fixes Redis, Web3Signer, and Vault services on r630-01
set -e
PROXMOX_HOST="${PROXMOX_HOST_R630_01}" # r630-01
REDIS_VMID=106
WEB3SIGNER_VMID=107
VAULT_VMID=108
# 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"; }
echo "========================================="
echo "Fixing Dependency Services for VMID 2400"
echo "========================================="
echo ""
# 1. Fix Redis Configuration
log_info "1. Fixing Redis (VMID $REDIS_VMID)..."
log_info " Current: Listening on 127.0.0.1:6379"
log_info " Target: Listening on 192.168.11.110:6379"
# Backup current config
ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $REDIS_VMID -- cp /etc/redis/redis.conf /etc/redis/redis.conf.backup.$(date +%Y%m%d_%H%M%S)" 2>/dev/null || true
# Update Redis configuration
ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" << 'REDIS_FIX'
pct exec 106 -- sed -i 's/^bind 127.0.0.1 ::1/bind 192.168.11.110/' /etc/redis/redis.conf
pct exec 106 -- sed -i 's/^protected-mode yes/protected-mode no/' /etc/redis/redis.conf
pct exec 106 -- systemctl restart redis-server
sleep 2
pct exec 106 -- systemctl status redis-server --no-pager | head -5
REDIS_FIX
# Verify Redis
log_info " Verifying Redis..."
REDIS_TEST=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $REDIS_VMID -- redis-cli -h 192.168.11.110 ping 2>&1" 2>/dev/null || echo "FAILED")
if echo "$REDIS_TEST" | grep -q "PONG"; then
log_success " Redis is now accessible on 192.168.11.110:6379"
else
log_error " Redis verification failed: $REDIS_TEST"
fi
echo ""
# 2. Fix Web3Signer Service
log_info "2. Fixing Web3Signer (VMID $WEB3SIGNER_VMID)..."
# Check if Web3Signer is installed
WEB3SIGNER_INSTALLED=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $WEB3SIGNER_VMID -- ls -d /opt/web3signer* 2>/dev/null | head -1" 2>/dev/null || echo "")
if [ -z "$WEB3SIGNER_INSTALLED" ]; then
log_warn " Web3Signer not found in /opt/web3signer*"
log_warn " Please install Web3Signer first (see DEPLOYMENT.md)"
log_warn " Skipping Web3Signer fix..."
else
log_info " Found Web3Signer at: $WEB3SIGNER_INSTALLED"
# Check for systemd service
SERVICE_FILE=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $WEB3SIGNER_VMID -- ls /etc/systemd/system/web3signer.service 2>/dev/null || echo ''" 2>/dev/null || echo "")
if [ -z "$SERVICE_FILE" ]; then
log_warn " Systemd service file not found"
log_warn " Please create web3signer.service (see DEPLOYMENT.md)"
else
log_info " Enabling and starting Web3Signer service..."
ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" << 'WEB3SIGNER_FIX'
pct exec 107 -- systemctl daemon-reload
pct exec 107 -- systemctl enable web3signer
pct exec 107 -- systemctl start web3signer
sleep 3
pct exec 107 -- systemctl status web3signer --no-pager | head -10
WEB3SIGNER_FIX
# Verify Web3Signer
log_info " Verifying Web3Signer..."
WEB3SIGNER_TEST=$(curl -s --connect-timeout 3 http://192.168.11.111:9000/upcheck 2>&1 || echo "FAILED")
if echo "$WEB3SIGNER_TEST" | grep -q "OK"; then
log_success " Web3Signer is now accessible on 192.168.11.111:9000"
else
log_warn " Web3Signer verification failed: $WEB3SIGNER_TEST"
log_warn " Check service logs: pct exec 107 -- journalctl -u web3signer -n 50"
fi
fi
fi
echo ""
# 3. Fix Vault Service
log_info "3. Fixing Vault (VMID $VAULT_VMID)..."
# Check if Vault is installed
VAULT_INSTALLED=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" \
"pct exec $VAULT_VMID -- which vault 2>/dev/null" 2>/dev/null || echo "")
if [ -z "$VAULT_INSTALLED" ]; then
log_warn " Vault not found"
log_warn " Please install Vault first (see DEPLOYMENT.md)"
log_warn " Skipping Vault fix..."
else
log_info " Found Vault at: $VAULT_INSTALLED"
# Enable and start Vault
log_info " Enabling and starting Vault service..."
ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" << 'VAULT_FIX'
pct exec 108 -- systemctl enable vault
pct exec 108 -- systemctl start vault
sleep 3
pct exec 108 -- systemctl status vault --no-pager | head -10
VAULT_FIX
# Verify Vault
log_info " Verifying Vault..."
VAULT_TEST=$(curl -s --connect-timeout 3 http://192.168.11.112:8200/v1/sys/health 2>&1 || echo "FAILED")
if echo "$VAULT_TEST" | grep -q "initialized"; then
log_success " Vault is now accessible on 192.168.11.112:8200"
else
log_warn " Vault verification failed: $VAULT_TEST"
log_warn " Vault may need initialization (see DEPLOYMENT.md)"
log_warn " Check service logs: pct exec 108 -- journalctl -u vault -n 50"
fi
fi
echo ""
# 4. Test Connectivity from VMID 2400
log_info "4. Testing connectivity from VMID 2400..."
TRANSLATOR_HOST="${PROXMOX_HOST_ML110}" # ml110
# Test Redis
log_info " Testing Redis connection..."
REDIS_CONN=$(ssh -o StrictHostKeyChecking=no root@"$TRANSLATOR_HOST" \
"pct exec 2400 -- nc -zv -w 2 192.168.11.110 6379 2>&1" 2>/dev/null || echo "FAILED")
if echo "$REDIS_CONN" | grep -q "succeeded\|open"; then
log_success " Redis: Connection successful"
else
log_warn " Redis: Connection failed - $REDIS_CONN"
fi
# Test Web3Signer
log_info " Testing Web3Signer connection..."
WEB3SIGNER_CONN=$(ssh -o StrictHostKeyChecking=no root@"$TRANSLATOR_HOST" \
"pct exec 2400 -- nc -zv -w 2 192.168.11.111 9000 2>&1" 2>/dev/null || echo "FAILED")
if echo "$WEB3SIGNER_CONN" | grep -q "succeeded\|open"; then
log_success " Web3Signer: Connection successful"
else
log_warn " Web3Signer: Connection failed - $WEB3SIGNER_CONN"
fi
# Test Vault
log_info " Testing Vault connection..."
VAULT_CONN=$(ssh -o StrictHostKeyChecking=no root@"$TRANSLATOR_HOST" \
"pct exec 2400 -- nc -zv -w 2 192.168.11.112 8200 2>&1" 2>/dev/null || echo "FAILED")
if echo "$VAULT_CONN" | grep -q "succeeded\|open"; then
log_success " Vault: Connection successful"
else
log_warn " Vault: Connection failed - $VAULT_CONN"
fi
echo ""
# 5. Check RPC Translator Health
log_info "5. Checking RPC Translator health endpoint..."
HEALTH=$(curl -s http://${RPC_THIRDWEB_PRIMARY}:9545/health 2>/dev/null | jq -r '.status' 2>/dev/null || echo "unknown")
if [ "$HEALTH" = "ok" ]; then
log_success " RPC Translator health: OK"
elif [ "$HEALTH" = "degraded" ]; then
log_warn " RPC Translator health: DEGRADED (some components may still be unhealthy)"
else
log_warn " RPC Translator health: $HEALTH"
fi
# Show component status
COMPONENTS=$(curl -s http://${RPC_THIRDWEB_PRIMARY}:9545/health 2>/dev/null | jq -r '.components | to_entries[] | "\(.key): \(.value.healthy)"' 2>/dev/null || echo "")
if [ -n "$COMPONENTS" ]; then
echo "$COMPONENTS" | while read -r line; do
if echo "$line" | grep -q "true"; then
log_success " $line"
else
log_warn " $line"
fi
done
fi
echo ""
# Summary
echo "========================================="
echo "Summary"
echo "========================================="
echo ""
log_info "Fixes applied:"
log_info "1. Redis: Updated bind address to 192.168.11.110"
log_info "2. Redis: Disabled protected mode"
log_info "3. Web3Signer: Attempted to start service (if installed)"
log_info "4. Vault: Enabled and started service"
echo ""
log_info "Next steps:"
log_info "- Verify all services are running: systemctl status on each VMID"
log_info "- Check RPC Translator logs: journalctl -u rpc-translator-138 -f"
log_info "- Monitor health endpoint: curl http://${RPC_THIRDWEB_PRIMARY}:9545/health"
echo ""