Files
ethereum-rpc-docker/babylon/babylond/babylon-mainnet-babylond-pruned.yml

128 lines
5.6 KiB
YAML

---
x-logging-defaults: &logging-defaults
driver: json-file
options:
max-size: "512m"
max-file: "2"
# 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:babylon/babylond/babylon-mainnet-babylond-pruned.yml
#
# docker compose up -d
#
# curl -X POST https://${IP}.traefik.me/babylon-mainnet-pruned \
# -H "Content-Type: application/json" \
# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
services:
babylon-mainnet-pruned:
build:
context: ./babylon
dockerfile: cometbft.Dockerfile
args:
CL_IMAGE: ${BABYLON_BABYLOND_IMAGE:-babylonlabs/babylond}
CL_VERSION: ${BABYLON_MAINNET_BABYLOND_VERSION:-v4.3.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:
- 10871:10871
- 10871:10871/udp
expose:
- 26657
- 26660
- 9090
- 1317
environment:
- CHAIN_ID=bbn-1
- GENESIS_URL=https://raw.githubusercontent.com/babylonlabs-io/networks/main/bbn-1/network-artifacts/genesis.json
- IP=${IP}
- MIN_GAS=0.002ubbn
- MONIKER=d${DOMAIN:-local}
- P2P_PORT=10871
- SEEDS=42fad8afbf7dfca51020c3c6e1a487ce17c4c218@babylon-seed-1.nodes.guru:55706,ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:20656
- STATESYNC_RPC=https://babylon-rpc.polkachu.com:443
- WASM_SNAPSHOT_URL=https://snapshots.polkachu.com/wasm/babylon/babylon_wasmonly.tar.lz4
restart: unless-stopped
stop_grace_period: 5m
networks:
- chains
volumes:
- ${BABYLON_MAINNET_BABYLOND_PRUNED_DATA:-babylon-mainnet-babylond-pruned}:/root/.babylond
- /slowdisk:/slowdisk
logging: *logging-defaults
labels:
- prometheus-scrape.enabled=true
- prometheus-scrape.port=26660
- prometheus-scrape.path=/metrics
- traefik.enable=true
- traefik.http.middlewares.babylon-mainnet-babylond-pruned-stripprefix.stripprefix.prefixes=/babylon-mainnet-pruned
- traefik.http.services.babylon-mainnet-babylond-pruned.loadbalancer.server.port=26657
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned.entrypoints=websecure}
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned.tls.certresolver=myresolver}
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned.rule=Host(`$DOMAIN`) && (Path(`/babylon-mainnet-pruned`) || Path(`/babylon-mainnet-pruned/`))}
- ${NO_SSL:+traefik.http.routers.babylon-mainnet-babylond-pruned.rule=Path(`/babylon-mainnet-pruned`) || Path(`/babylon-mainnet-pruned/`)}
- traefik.http.routers.babylon-mainnet-babylond-pruned.middlewares=babylon-mainnet-babylond-pruned-stripprefix, ipallowlist
- traefik.http.routers.babylon-mainnet-babylond-pruned.priority=50 # gets any request that is not GET with UPGRADE header
- traefik.http.routers.babylon-mainnet-babylond-pruned-ws.priority=100 # answers GET requests first
- traefik.http.middlewares.babylon-mainnet-babylond-pruned-set-ws-path.replacepath.path=/websocket
- traefik.http.services.babylon-mainnet-babylond-pruned-ws.loadbalancer.server.port=26657
- traefik.http.routers.babylon-mainnet-babylond-pruned-ws.service=babylon-mainnet-babylond-pruned-ws
- traefik.http.routers.babylon-mainnet-babylond-pruned.service=babylon-mainnet-babylond-pruned
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned-ws.entrypoints=websecure}
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned-ws.tls.certresolver=myresolver}
# case-insensitive Upgrade: python websocket-client sends "WebSocket" (capital W)
- ${NO_SSL:-traefik.http.routers.babylon-mainnet-babylond-pruned-ws.rule=Host(`$DOMAIN`) && (Path(`/babylon-mainnet-pruned`) || Path(`/babylon-mainnet-pruned/`)) && HeadersRegexp(`Upgrade`, `(?i)websocket`)}
- ${NO_SSL:+traefik.http.routers.babylon-mainnet-babylond-pruned-ws.rule=(Path(`/babylon-mainnet-pruned`) || Path(`/babylon-mainnet-pruned/`)) && HeadersRegexp(`Upgrade`, `(?i)websocket`)}
- traefik.http.routers.babylon-mainnet-babylond-pruned-ws.middlewares=babylon-mainnet-babylond-pruned-stripprefix, babylon-mainnet-babylond-pruned-set-ws-path, ipallowlist
volumes:
babylon-mainnet-babylond-pruned:
x-upstreams:
- id: $${ID}
labels:
provider: $${PROVIDER}
connection:
generic:
rpc:
url: $${RPC_URL}
ws:
frameSize: 20Mb
msgSize: 50Mb
url: $${WS_URL}
chain: babylon
method-groups:
enabled:
- debug
- filter
methods:
disabled:
enabled:
- name: txpool_content # TODO: should be disabled for rollup nodes
...