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>
172 lines
5.4 KiB
Bash
Executable File
172 lines
5.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Reassign all VLAN 200 containers to VLAN 11 IPs
|
|
# Since VLAN 11 cannot reach VLAN 200, we need to move all containers to VLAN 11
|
|
|
|
set -uo pipefail
|
|
|
|
NODE_IP="192.168.11.11"
|
|
|
|
# VLAN 200 containers that need reassignment
|
|
declare -A vlan200_containers=(
|
|
["10000"]="order-postgres-primary"
|
|
["10001"]="order-postgres-replica"
|
|
["10020"]="order-redis"
|
|
["10030"]="order-identity"
|
|
["10040"]="order-intake"
|
|
["10050"]="order-finance"
|
|
["10060"]="order-dataroom"
|
|
["10070"]="order-legal"
|
|
["10080"]="order-eresidency"
|
|
["10090"]="order-portal-public"
|
|
["10091"]="order-portal-internal"
|
|
["10092"]="order-mcp-legal"
|
|
["10200"]="order-prometheus"
|
|
["10201"]="order-grafana"
|
|
["10202"]="order-opensearch"
|
|
["10210"]="order-haproxy"
|
|
["10230"]="order-vault"
|
|
["10232"]="CT10232"
|
|
)
|
|
|
|
# Available IPs in VLAN 11 (192.168.11.0/24)
|
|
# Reserved: 10-25 (physical servers), avoiding conflicts with existing assignments
|
|
available_ips=(
|
|
"192.168.11.35"
|
|
"192.168.11.36"
|
|
"192.168.11.37"
|
|
"192.168.11.38"
|
|
"192.168.11.39"
|
|
"192.168.11.40"
|
|
"192.168.11.41"
|
|
"192.168.11.42"
|
|
"192.168.11.43"
|
|
"192.168.11.44"
|
|
"192.168.11.45"
|
|
"192.168.11.46"
|
|
"192.168.11.47"
|
|
"192.168.11.48"
|
|
"192.168.11.49"
|
|
"192.168.11.50"
|
|
"192.168.11.51"
|
|
"192.168.11.52"
|
|
"192.168.11.53"
|
|
"192.168.11.54"
|
|
"192.168.11.55"
|
|
"192.168.11.56"
|
|
"192.168.11.57"
|
|
"192.168.11.58"
|
|
)
|
|
|
|
# Check if we have enough IPs
|
|
if [ ${#available_ips[@]} -lt ${#vlan200_containers[@]} ]; then
|
|
echo "ERROR: Not enough available IPs. Need ${#vlan200_containers[@]}, have ${#available_ips[@]}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo "Reassigning VLAN 200 Containers to VLAN 11"
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo ""
|
|
echo "Containers to reassign: ${#vlan200_containers[@]}"
|
|
echo "Available IPs: ${#available_ips[@]}"
|
|
echo ""
|
|
|
|
# Create mapping
|
|
declare -a vmid_list=()
|
|
declare -a ip_list=()
|
|
index=0
|
|
|
|
for vmid in "${!vlan200_containers[@]}"; do
|
|
vmid_list+=("$vmid")
|
|
ip_list+=("${available_ips[$index]}")
|
|
((index++))
|
|
done
|
|
|
|
# Display mapping
|
|
echo "IP Reassignment Plan:"
|
|
echo "───────────────────────────────────────────────────────────"
|
|
for i in "${!vmid_list[@]}"; do
|
|
vmid="${vmid_list[$i]}"
|
|
new_ip="${ip_list[$i]}"
|
|
hostname="${vlan200_containers[$vmid]}"
|
|
old_ip=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct config $vmid 2>/dev/null | grep '^net0:' | grep -oP 'ip=\\K[^,]+' | cut -d'/' -f1" || echo "N/A")
|
|
printf " CT %-6s %-30s %-15s → %-15s\n" "$vmid" "$hostname" "$old_ip" "$new_ip"
|
|
done
|
|
echo ""
|
|
|
|
# Auto-proceed (non-interactive)
|
|
echo "Proceeding with reassignment automatically..."
|
|
|
|
echo ""
|
|
echo "Starting reassignment..."
|
|
echo ""
|
|
|
|
SUCCESS=0
|
|
FAILED=0
|
|
|
|
# Reassign each container
|
|
for i in "${!vmid_list[@]}"; do
|
|
vmid="${vmid_list[$i]}"
|
|
new_ip="${ip_list[$i]}"
|
|
hostname="${vlan200_containers[$vmid]}"
|
|
|
|
echo "Processing CT $vmid ($hostname)..."
|
|
|
|
# Stop container first
|
|
echo " Stopping container..."
|
|
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct stop $vmid 2>/dev/null" || true
|
|
sleep 2
|
|
|
|
# Get current network config
|
|
current_net=$(ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct config $vmid 2>/dev/null | grep '^net0:'" || echo "")
|
|
|
|
if [ -z "$current_net" ]; then
|
|
echo " ⚠️ No network config found, creating new..."
|
|
# Create new network config
|
|
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct set $vmid --net0 name=eth0,bridge=vmbr0,ip=${new_ip}/24,gw=192.168.11.1" 2>&1
|
|
else
|
|
# Extract bridge name (default to vmbr0 if not found)
|
|
bridge=$(echo "$current_net" | grep -oP 'bridge=\\K[^,]+' || echo "vmbr0")
|
|
|
|
# Update IP address
|
|
echo " Updating IP to $new_ip..."
|
|
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct set $vmid --net0 name=eth0,bridge=${bridge},ip=${new_ip}/24,gw=192.168.11.1" 2>&1
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo " ✅ IP updated to $new_ip"
|
|
|
|
# Start container
|
|
echo " Starting container..."
|
|
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@${NODE_IP} \
|
|
"pct start $vmid" 2>&1
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo " ✅ Container started"
|
|
((SUCCESS++))
|
|
else
|
|
echo " ⚠️ IP updated but container failed to start"
|
|
((FAILED++))
|
|
fi
|
|
else
|
|
echo " ❌ Failed to update IP"
|
|
((FAILED++))
|
|
fi
|
|
|
|
echo ""
|
|
sleep 1
|
|
done
|
|
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo "Reassignment Complete"
|
|
echo "═══════════════════════════════════════════════════════════"
|
|
echo " Success: $SUCCESS"
|
|
echo " Failed: $FAILED"
|
|
echo " Total: ${#vlan200_containers[@]}"
|
|
echo "═══════════════════════════════════════════════════════════"
|