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>
63 lines
2.7 KiB
Bash
63 lines
2.7 KiB
Bash
#!/usr/bin/env bash
|
|
# Ensure nginx on VMID 5000 proxies /api to Blockscout port 4000 so the SolaceScanScout UI can load blocks/transactions.
|
|
# Run from project root. Requires SSH to r630-02 or run on Proxmox host.
|
|
# Usage: bash scripts/ensure-explorer-nginx-api-proxy.sh [--force]
|
|
# --force: re-apply full nginx config (e.g. after adding no-cache for document).
|
|
|
|
set -euo pipefail
|
|
|
|
FORCE=""
|
|
[[ "${1:-}" == "--force" ]] && FORCE=1
|
|
|
|
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
|
|
|
|
VMID=5000
|
|
PROXMOX_R630_02="${PROXMOX_HOST_R630_02:-192.168.11.12}"
|
|
# Prefer repo-relative path so it works from any cwd
|
|
FIX_SCRIPT="${SCRIPT_DIR}/../explorer-monorepo/scripts/fix-nginx-serve-custom-frontend.sh"
|
|
[ ! -f "$FIX_SCRIPT" ] && FIX_SCRIPT="${PROJECT_ROOT}/explorer-monorepo/scripts/fix-nginx-serve-custom-frontend.sh"
|
|
|
|
run_in_5000() {
|
|
if command -v pct &>/dev/null; then
|
|
pct exec $VMID -- bash -c "$1"
|
|
else
|
|
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@"${PROXMOX_R630_02}" "pct exec $VMID -- bash -c '$1'"
|
|
fi
|
|
}
|
|
|
|
echo "=== Ensure Explorer nginx proxies /api to port 4000 ==="
|
|
echo "VMID: $VMID"
|
|
echo ""
|
|
|
|
# Quick check: does /api/ already exist? (skip if --force)
|
|
if [[ -z "$FORCE" ]] && run_in_5000 "grep -q 'location /api/' /etc/nginx/sites-available/blockscout 2>/dev/null"; then
|
|
echo "OK: nginx already has location /api/ — blocks/transactions should load."
|
|
run_in_5000 "nginx -t 2>/dev/null" && echo "nginx config valid."
|
|
echo "To re-apply full config (e.g. no-cache for document): $0 --force"
|
|
exit 0
|
|
fi
|
|
|
|
echo "location /api/ not found. Applying full nginx config (fix-nginx-serve-custom-frontend.sh)..."
|
|
echo ""
|
|
|
|
if [ ! -f "$FIX_SCRIPT" ]; then
|
|
echo "ERROR: $FIX_SCRIPT not found. Add /api/ manually on VM 5000:"
|
|
echo " location /api/ { proxy_pass http://127.0.0.1:4000; proxy_set_header Host \$host; proxy_set_header X-Real-IP \$remote_addr; proxy_set_header X-Forwarded-Proto \$scheme; }"
|
|
exit 1
|
|
fi
|
|
|
|
# Copy script into container and run (escape single quotes in script path for inner bash)
|
|
if command -v pct &>/dev/null; then
|
|
pct push $VMID "$FIX_SCRIPT" /tmp/fix-nginx.sh --perms 0755
|
|
pct exec $VMID -- bash /tmp/fix-nginx.sh
|
|
else
|
|
scp -o ConnectTimeout=10 -o StrictHostKeyChecking=no "$FIX_SCRIPT" root@${PROXMOX_R630_02}:/tmp/fix-nginx-explorer.sh
|
|
ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@${PROXMOX_R630_02} "pct push $VMID /tmp/fix-nginx-explorer.sh /tmp/fix-nginx.sh --perms 0755 && pct exec $VMID -- bash /tmp/fix-nginx.sh"
|
|
fi
|
|
|
|
echo ""
|
|
echo "Verify: open https://explorer.d-bis.org — Latest Blocks and Latest Transactions should load."
|
|
exit 0
|