Files
proxmox/scripts/apply-public-rpc-config-2201.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

68 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Apply public RPC config to VMID 2201 (besu-rpc-public-1).
# Ensures no permissions allow contract deployment: account permissioning enabled
# with empty allowlist (permissions-accounts-public.toml).
# Run from project root; requires pct (typically on Proxmox host).
set -euo pipefail
VMID=2201
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SOURCE_CONFIG="$PROJECT_ROOT/smom-dbis-138/config"
CONFIG_RPC_PUBLIC="$SOURCE_CONFIG/config-rpc-public.toml"
PERM_ACCOUNTS_PUBLIC="$SOURCE_CONFIG/permissions-accounts-public.toml"
PERM_NODES="$SOURCE_CONFIG/permissions-nodes.toml"
log() { echo "[INFO] $1"; }
success() { echo "[✓] $1"; }
warn() { echo "[WARN] $1"; }
err() { echo "[ERROR] $1"; }
if [[ ! -f "$CONFIG_RPC_PUBLIC" ]]; then
err "Config not found: $CONFIG_RPC_PUBLIC"
exit 1
fi
if [[ ! -f "$PERM_ACCOUNTS_PUBLIC" ]]; then
err "Permissions file not found: $PERM_ACCOUNTS_PUBLIC"
exit 1
fi
if ! pct status "$VMID" &>/dev/null; then
err "VMID $VMID not found or pct not available (run on Proxmox host?)."
exit 1
fi
if ! pct status "$VMID" 2>/dev/null | grep -q running; then
warn "VMID $VMID is not running. Start it first, then re-run."
exit 1
fi
log "Applying public RPC config to VMID $VMID (no contract deployment)..."
# Copy main config (paths in config use /data/besu, /genesis/, /permissions/)
pct push "$VMID" "$CONFIG_RPC_PUBLIC" "/etc/besu/config-rpc-public.toml"
pct exec "$VMID" -- chown besu:besu /etc/besu/config-rpc-public.toml 2>/dev/null || true
# Ensure /permissions exists and copy permissions-accounts-public.toml
pct exec "$VMID" -- mkdir -p /permissions
pct push "$VMID" "$PERM_ACCOUNTS_PUBLIC" "/permissions/permissions-accounts-public.toml"
pct exec "$VMID" -- chown -R besu:besu /permissions 2>/dev/null || true
if [[ -f "$PERM_NODES" ]]; then
pct push "$VMID" "$PERM_NODES" "/permissions/permissions-nodes.toml"
pct exec "$VMID" -- chown besu:besu /permissions/permissions-nodes.toml 2>/dev/null || true
fi
# Point systemd to config-rpc-public.toml if besu-rpc.service exists
if pct exec "$VMID" -- systemctl cat besu-rpc.service &>/dev/null; then
pct exec "$VMID" -- bash -c 'sed -i "s|--config-file=\$BESU_CONFIG/[^ ]*|--config-file=\$BESU_CONFIG/config-rpc-public.toml|g" /etc/systemd/system/besu-rpc.service 2>/dev/null || true'
pct exec "$VMID" -- systemctl daemon-reload
log "Restarting besu-rpc.service..."
pct exec "$VMID" -- systemctl restart besu-rpc.service
success "Config applied and besu-rpc restarted."
else
log "besu-rpc.service not found; config files are in place. Restart Besu manually if needed."
success "Config files applied."
fi