Files
proxmox/scripts/archive/consolidated/fix/fix-the-order-mapping.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

80 lines
3.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fix the-order.sankofa.nexus mapping and identify missing VMs
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="${1:-192.168.11.11}"
CONTAINER_ID="${2:-10233}"
# 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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Checking Order Services and Fixing the-order.sankofa.nexus"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Check Order portal services
log_info "Checking Order portal services..."
for vmid in 10090 10091 10092; do
status=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" "pct status $vmid 2>&1" | head -1 || echo "not found")
if echo "$status" | grep -q "running"; then
config=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" "pct config $vmid 2>/dev/null | grep -E '^hostname|^ip[0-9]' | head -2" || echo "")
log_info "VMID $vmid: $status"
if [ -n "$config" ]; then
echo "$config" | while read line; do
log_info " $line"
done
fi
elif echo "$status" | grep -q "not found\|does not exist"; then
log_warn "VMID $vmid: Does not exist"
else
log_info "VMID $vmid: $status"
fi
done
echo ""
log_info "Current the-order.sankofa.nexus mapping:"
CURRENT_MAPPING=$(ssh -o StrictHostKeyChecking=no root@"$PROXMOX_HOST" "pct exec $CONTAINER_ID -- docker exec npmplus node -e \"
const Database = require('better-sqlite3');
const db = new Database('/data/npmplus/database.sqlite', { readonly: true });
const host = db.prepare('SELECT id, domain_names, forward_host, forward_port FROM proxy_host WHERE domain_names LIKE \\\"%the-order.sankofa.nexus%\\\"').get();
if (host) {
console.log(JSON.stringify(host));
} else {
console.log('{}');
}
db.close();
\" 2>&1" || echo "{}")
if [ "$CURRENT_MAPPING" != "{}" ]; then
echo "$CURRENT_MAPPING" | jq -r '"Current: \(.domain_names | fromjson | join(", ")) → \(.forward_host):\(.forward_port)"' 2>/dev/null || echo "$CURRENT_MAPPING"
else
log_warn "the-order.sankofa.nexus not found in NPMplus"
fi
echo ""
log_warn "Please specify the correct target for the-order.sankofa.nexus:"
log_info " Options based on documentation:"
log_info " - VMID 10090 (order-portal-public): ${IP_SERVICE_36:-${IP_SERVICE_36:-${IP_SERVICE_36:-${IP_SERVICE_36:-192.168.11.36}}}}:80 or 3000"
log_info " - VMID 10091 (order-portal-internal): ${IP_SERVICE_35:-${IP_SERVICE_35:-${IP_SERVICE_35:-${IP_SERVICE_35:-192.168.11.35}}}}:80 or 3000"
log_info " - VMID 10092 (order-mcp-legal): ${IP_MIM_WEB:-192.168.11.37}:80 or 3000"
echo ""
log_info "Also, please specify which other VMs/services should be added to NPMplus."