190 lines
8.0 KiB
YAML
190 lines
8.0 KiB
YAML
---
|
|
x-logging-defaults: &logging-defaults
|
|
driver: json-file
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
# Usage:
|
|
#
|
|
# mkdir rpc && cd rpc
|
|
#
|
|
# git init
|
|
# git remote add origin https://github.com/StakeSquid/ethereum-rpc-docker.git
|
|
# git fetch origin vibe
|
|
# git checkout origin/vibe
|
|
#
|
|
# docker run --rm alpine sh -c "printf '0x'; head -c32 /dev/urandom | xxd -p -c 64" > .jwtsecret
|
|
#
|
|
# env
|
|
# ...
|
|
# IP=$(curl ipinfo.io/ip)
|
|
# DOMAIN=${IP}.traefik.me
|
|
# COMPOSE_FILE=base.yml:rpc.yml:ethereum/besu/ethereum-mainnet-besu-pruned-bonsai--nimbus.yml
|
|
#
|
|
# docker compose up -d
|
|
#
|
|
# curl -X POST https://${IP}.traefik.me/ethereum-mainnet-besu \
|
|
# -H "Content-Type: application/json" \
|
|
# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
|
|
|
|
services:
|
|
ethereum-mainnet-besu:
|
|
image: ${ETHEREUM_BESU_IMAGE:-hyperledger/besu}:${ETHEREUM_MAINNET_BESU_VERSION:-25.12.0}
|
|
sysctls:
|
|
# TCP Performance
|
|
net.ipv4.tcp_slow_start_after_idle: 0 # Disable slow start after idle
|
|
net.ipv4.tcp_no_metrics_save: 1 # Disable metrics cache
|
|
net.ipv4.tcp_rmem: 4096 87380 16777216 # Increase TCP read buffers
|
|
net.ipv4.tcp_wmem: 4096 87380 16777216 # Increase TCP write buffers
|
|
net.core.somaxconn: 32768 # Higher connection queue
|
|
# Memory/Connection Management
|
|
# net.core.netdev_max_backlog: 50000 # Increase network buffer
|
|
net.ipv4.tcp_max_syn_backlog: 30000 # More SYN requests
|
|
net.ipv4.tcp_max_tw_buckets: 2000000 # Allow more TIME_WAIT sockets
|
|
ulimits:
|
|
nofile: 1048576 # Max open files (for RPC/WS connections)
|
|
user: root
|
|
ports:
|
|
- 13205:13205
|
|
- 13205:13205/udp
|
|
expose:
|
|
- 8545
|
|
- 8546
|
|
- 9545
|
|
command:
|
|
- --Xbonsai-full-flat-db-enabled=true
|
|
- --data-path=/opt/besu/database
|
|
- --data-storage-format=BONSAI
|
|
- --engine-host-allowlist=*
|
|
- --engine-jwt-secret=/jwtsecret
|
|
- --engine-rpc-enabled=true
|
|
- --engine-rpc-port=8551
|
|
- --fast-sync-min-peers=1
|
|
- --host-allowlist=*
|
|
- --metrics-enabled=true
|
|
- --metrics-host=0.0.0.0
|
|
- --metrics-port=9545
|
|
- --network=mainnet
|
|
- --p2p-host=${IP}
|
|
- --p2p-port=13205
|
|
- --rpc-http-api=ETH,NET,WEB3,DEBUG,ADMIN,TXPOOL
|
|
- --rpc-http-enabled=true
|
|
- --rpc-http-host=0.0.0.0
|
|
- --rpc-http-max-active-connections=20000
|
|
- --rpc-http-port=8545
|
|
- --rpc-ws-api=ETH,NET,WEB3,DEBUG,ADMIN,TXPOOL
|
|
- --rpc-ws-enabled=true
|
|
- --rpc-ws-host=0.0.0.0
|
|
- --rpc-ws-port=8546
|
|
- --sync-mode=SNAP
|
|
restart: unless-stopped
|
|
stop_grace_period: 5m
|
|
networks:
|
|
- chains
|
|
volumes:
|
|
- ${ETHEREUM_MAINNET_BESU_PRUNED_BONSAI_DATA:-ethereum-mainnet-besu-pruned-bonsai}:/opt/besu/database
|
|
- .jwtsecret:/jwtsecret:ro
|
|
- /slowdisk:/slowdisk
|
|
logging: *logging-defaults
|
|
labels:
|
|
- prometheus-scrape.enabled=true
|
|
- prometheus-scrape.port=9545
|
|
- prometheus-scrape.path=/metrics
|
|
- traefik.enable=true
|
|
- traefik.http.middlewares.ethereum-mainnet-besu-pruned-bonsai-stripprefix.stripprefix.prefixes=/ethereum-mainnet-besu
|
|
- traefik.http.services.ethereum-mainnet-besu-pruned-bonsai.loadbalancer.server.port=8545
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.entrypoints=websecure}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.tls.certresolver=myresolver}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.rule=Host(`$DOMAIN`) && (Path(`/ethereum-mainnet-besu`) || Path(`/ethereum-mainnet-besu/`))}
|
|
- ${NO_SSL:+traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.rule=Path(`/ethereum-mainnet-besu`) || Path(`/ethereum-mainnet-besu/`)}
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.middlewares=ethereum-mainnet-besu-pruned-bonsai-stripprefix, ipallowlist
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.priority=50 # gets any request that is not GET with UPGRADE header
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.priority=100 # answers GET requests first
|
|
- traefik.http.services.ethereum-mainnet-besu-pruned-bonsai-ws.loadbalancer.server.port=8546
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.service=ethereum-mainnet-besu-pruned-bonsai-ws
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai.service=ethereum-mainnet-besu-pruned-bonsai
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.entrypoints=websecure}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.tls.certresolver=myresolver}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.rule=Host(`$DOMAIN`) && (Path(`/ethereum-mainnet-besu`) || Path(`/ethereum-mainnet-besu/`)) && Headers(`Upgrade`, `websocket`)}
|
|
- ${NO_SSL:+traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.rule=(Path(`/ethereum-mainnet-besu`) || Path(`/ethereum-mainnet-besu/`)) && Headers(`Upgrade`, `websocket`)}
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-ws.middlewares=ethereum-mainnet-besu-pruned-bonsai-stripprefix, ipallowlist
|
|
|
|
ethereum-mainnet-besu-node:
|
|
image: ${ETHEREUM_NIMBUS_IMAGE:-statusim/nimbus-eth2}:${ETHEREUM_MAINNET_NIMBUS_VERSION:-multiarch-v25.11.1}
|
|
user: root
|
|
ports:
|
|
- 18205:18205
|
|
- 18205:18205/udp
|
|
expose:
|
|
- 3500
|
|
entrypoint: /bin/sh -c '/home/user/nimbus-eth2/build/nimbus_beacon_node trustedNodeSync --network=mainnet --trusted-node-url=https://mainnet.beaconstate.info --backfill=false; exec /home/user/nimbus-eth2/build/nimbus_beacon_node "$@"' --
|
|
command:
|
|
- --history=prune
|
|
- --jwt-secret=/jwtsecret
|
|
- --metrics-address=0.0.0.0
|
|
- --metrics-port=8008
|
|
- --nat=extip:${IP}
|
|
- --network=mainnet
|
|
- --rest
|
|
- --rest-address=0.0.0.0
|
|
- --rest-port=3500
|
|
- --tcp-port=18205
|
|
- --udp-port=18205
|
|
- --web3-url=http://ethereum-mainnet-besu:8551
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- ethereum-mainnet-besu
|
|
networks:
|
|
- chains
|
|
volumes:
|
|
- ${ETHEREUM_MAINNET_BESU_PRUNED_BONSAI__NIMBUS_DATA:-ethereum-mainnet-besu-pruned-bonsai_nimbus}:/root/.cache/nimbus/BeaconNode
|
|
- .jwtsecret:/jwtsecret:ro
|
|
logging: *logging-defaults
|
|
labels:
|
|
- prometheus-scrape.enabled=true
|
|
- prometheus-scrape.port=8008
|
|
- prometheus-scrape.path=/metrics
|
|
- traefik.enable=true
|
|
- traefik.http.middlewares.ethereum-mainnet-besu-pruned-bonsai-node-stripprefix.stripprefix.prefixes=/ethereum-mainnet-besu
|
|
- traefik.http.services.ethereum-mainnet-besu-pruned-bonsai-node.loadbalancer.server.port=3500
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-node.entrypoints=websecure}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-node.tls.certresolver=myresolver}
|
|
- ${NO_SSL:-traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-node.rule=Host(`$DOMAIN`) && PathPrefix(`/ethereum-mainnet-besu/eth`)}
|
|
- ${NO_SSL:+traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-node.rule=PathPrefix(`/ethereum-mainnet-besu/eth`)}
|
|
- traefik.http.routers.ethereum-mainnet-besu-pruned-bonsai-node.middlewares=ethereum-mainnet-besu-pruned-bonsai-node-stripprefix, ipallowlist
|
|
|
|
volumes:
|
|
ethereum-mainnet-besu-pruned-bonsai:
|
|
ethereum-mainnet-besu-pruned-bonsai_nimbus:
|
|
|
|
x-upstreams:
|
|
- id: $${ID}
|
|
labels:
|
|
provider: $${PROVIDER}
|
|
connection:
|
|
generic:
|
|
rpc:
|
|
url: $${RPC_URL}
|
|
ws:
|
|
frameSize: 20Mb
|
|
msgSize: 50Mb
|
|
url: $${WS_URL}
|
|
chain: ethereum
|
|
method-groups:
|
|
enabled:
|
|
- debug
|
|
- filter
|
|
methods:
|
|
disabled:
|
|
enabled:
|
|
- name: txpool_content # TODO: should be disabled for rollup nodes
|
|
- id: $${ID}-beacon-chain
|
|
chain: eth-beacon-chain
|
|
labels:
|
|
provider: $${PROVIDER}-beacon-chain
|
|
connection:
|
|
generic:
|
|
rpc:
|
|
url: $${RPC_URL}
|
|
... |