- Added new deployment script references for Aave quote-push and treasury manager in .env.master.example. - Updated AGENTS.md to include information on GRU reference primacy versus public PMM mesh execution model. - Minor updates to various documentation files to reflect changes in policy and operational guidelines. Made-with: Cursor
198 lines
4.9 KiB
Bash
Executable File
198 lines
4.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Configure RPC nodes as Full Function or Standard Base type
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
source "${PROJECT_ROOT}/scripts/lib/load-project-env.sh"
|
|
|
|
log() { echo "[INFO] $1"; }
|
|
success() { echo "[✓] $1"; }
|
|
error() { echo "[ERROR] $1"; }
|
|
|
|
PROFILE=""
|
|
TARGET_VMIDS=()
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: ./scripts/configure-rpc-nodes.sh --profile <fullfunction|standardbase> --vmid <N> [--vmid <N> ...]
|
|
|
|
Options:
|
|
--profile <name> Required. Choose the config template to generate.
|
|
--vmid <N> Required. Generate config only for the selected VMIDs.
|
|
EOF
|
|
}
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--profile)
|
|
[[ $# -ge 2 ]] || { usage >&2; exit 2; }
|
|
PROFILE="$2"
|
|
shift 2
|
|
;;
|
|
--vmid)
|
|
[[ $# -ge 2 ]] || { usage >&2; exit 2; }
|
|
TARGET_VMIDS+=("$2")
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Unknown argument: $1" >&2
|
|
usage >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
[[ -n "$PROFILE" ]] || { usage >&2; exit 2; }
|
|
[[ ${#TARGET_VMIDS[@]} -gt 0 ]] || { usage >&2; exit 2; }
|
|
|
|
declare -A RPC_IPS=(
|
|
[2101]="${RPC_CORE_1:-192.168.11.211}"
|
|
[2201]="${RPC_PUBLIC_1:-192.168.11.221}"
|
|
[2301]="${RPC_PRIVATE_1:-192.168.11.232}"
|
|
[2303]="192.168.11.233"
|
|
[2304]="192.168.11.234"
|
|
[2305]="192.168.11.235"
|
|
[2306]="192.168.11.236"
|
|
[2307]="192.168.11.237"
|
|
[2308]="192.168.11.238"
|
|
[2400]="192.168.11.240"
|
|
[2401]="${RPC_THIRDWEB_1:-192.168.11.241}"
|
|
[2402]="${RPC_THIRDWEB_2:-192.168.11.242}"
|
|
[2403]="${RPC_THIRDWEB_3:-192.168.11.243}"
|
|
[2420]="192.168.11.172"
|
|
[2430]="192.168.11.173"
|
|
[2440]="192.168.11.174"
|
|
[2460]="192.168.11.246"
|
|
[2470]="192.168.11.247"
|
|
[2480]="192.168.11.248"
|
|
)
|
|
|
|
# Function to create full-function RPC config
|
|
create_fullfunction_config() {
|
|
local vmid=$1
|
|
local ip=$2
|
|
|
|
log "Creating full-function RPC config for VMID $vmid ($ip)"
|
|
|
|
cat > /tmp/besu-config-fullfunction-$vmid.toml << 'EOF'
|
|
# Full Function RPC Node Configuration
|
|
# Can deploy contracts and execute write transactions
|
|
|
|
network-id=138
|
|
p2p-host="0.0.0.0"
|
|
p2p-port=30303
|
|
|
|
rpc-http-enabled=true
|
|
rpc-http-host="0.0.0.0"
|
|
rpc-http-port=8545
|
|
rpc-http-api=["ETH","NET","WEB3","ADMIN","PERSONAL","MINER","DEBUG"]
|
|
rpc-http-cors-origins=["*"]
|
|
|
|
rpc-ws-enabled=true
|
|
rpc-ws-host="0.0.0.0"
|
|
rpc-ws-port=8546
|
|
rpc-ws-api=["ETH","NET","WEB3","ADMIN","PERSONAL","MINER","DEBUG"]
|
|
rpc-ws-origins=["*"]
|
|
|
|
rpc-http-api-enable-unsafe-txsigning=true
|
|
|
|
metrics-enabled=true
|
|
metrics-port=9545
|
|
metrics-host="0.0.0.0"
|
|
|
|
sync-mode="FULL"
|
|
logging="INFO"
|
|
|
|
permissions-nodes-config-file-enabled=true
|
|
permissions-nodes-config-file="/var/lib/besu/permissions/permissions-nodes.toml"
|
|
static-nodes-file="/var/lib/besu/static-nodes.json"
|
|
|
|
max-peers=50
|
|
data-path="/data/besu"
|
|
EOF
|
|
|
|
success "Created full-function config for VMID $vmid"
|
|
}
|
|
|
|
# Function to create standard base RPC config
|
|
create_standardbase_config() {
|
|
local vmid=$1
|
|
local ip=$2
|
|
|
|
log "Creating standard base RPC config for VMID $vmid ($ip)"
|
|
|
|
cat > /tmp/besu-config-standardbase-$vmid.toml << 'EOF'
|
|
# Standard Base RPC Node Configuration
|
|
# Read-only access for public services
|
|
|
|
network-id=138
|
|
p2p-host="0.0.0.0"
|
|
p2p-port=30303
|
|
|
|
rpc-http-enabled=true
|
|
rpc-http-host="0.0.0.0"
|
|
rpc-http-port=8545
|
|
rpc-http-api=["ETH","NET","WEB3"]
|
|
rpc-http-cors-origins=["*"]
|
|
|
|
rpc-ws-enabled=true
|
|
rpc-ws-host="0.0.0.0"
|
|
rpc-ws-port=8546
|
|
rpc-ws-api=["ETH","NET","WEB3"]
|
|
rpc-ws-origins=["*"]
|
|
|
|
metrics-enabled=true
|
|
metrics-port=9545
|
|
metrics-host="0.0.0.0"
|
|
|
|
sync-mode="FULL"
|
|
logging="WARN"
|
|
|
|
permissions-nodes-config-file-enabled=true
|
|
permissions-nodes-config-file="/var/lib/besu/permissions/permissions-nodes.toml"
|
|
static-nodes-file="/var/lib/besu/static-nodes.json"
|
|
|
|
max-peers=50
|
|
data-path="/data/besu"
|
|
EOF
|
|
|
|
success "Created standard base config for VMID $vmid"
|
|
}
|
|
|
|
log "==================================="
|
|
log "RPC Node Configuration Generator"
|
|
log "==================================="
|
|
echo ""
|
|
|
|
for vmid in "${TARGET_VMIDS[@]}"; do
|
|
ip="${RPC_IPS[$vmid]:-}"
|
|
if [[ -z "$ip" ]]; then
|
|
error "Unsupported VMID: $vmid"
|
|
exit 2
|
|
fi
|
|
case "$PROFILE" in
|
|
fullfunction) create_fullfunction_config "$vmid" "$ip" ;;
|
|
standardbase) create_standardbase_config "$vmid" "$ip" ;;
|
|
*)
|
|
error "Unknown profile: $PROFILE"
|
|
usage >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo ""
|
|
log "Configuration files created in /tmp/ for profile '$PROFILE':"
|
|
for vmid in "${TARGET_VMIDS[@]}"; do
|
|
case "$PROFILE" in
|
|
fullfunction) log " /tmp/besu-config-fullfunction-$vmid.toml → /opt/besu/config/" ;;
|
|
standardbase) log " /tmp/besu-config-standardbase-$vmid.toml → /opt/besu/config/" ;;
|
|
esac
|
|
done
|