--- 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:gravity/reth/gravity-testnet-reth-pruned-trace.yml # # docker compose up -d # # curl -X POST https://${IP}.traefik.me/gravity-testnet \ # -H "Content-Type: application/json" \ # --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' services: gravity-testnet: image: ${GRAVITY_RETH_IMAGE:-ghcr.io/galxe/gravity-reth}:${GRAVITY_TESTNET_RETH_VERSION:-v0.2.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) memlock: -1 # Disable memory locking limits (for in-memory DBs like MDBX) user: 0:0 ports: - 10052:10052 - 10052:10052/udp expose: - 8545 - 9001 - 8551 entrypoint: [reth, node] command: - --chain=gravity-testnet - --datadir=/execution - --discovery.port=10052 - --engine.cross-block-cache-size=${GRAVITY_TESTNET_RETH_STATE_CACHE:-4096} - --engine.memory-block-buffer-target=1024 - --engine.persistence-threshold=0 - --full - --max-inbound-peers=50 - --max-outbound-peers=50 - --metrics=0.0.0.0:9001 - --nat=extip:${IP} - --port=10052 - --rpc-cache.max-blocks=10000 - --rpc-cache.max-concurrent-db-requests=2048 - --rpc.gascap=600000000 - --rpc.max-blocks-per-filter=0 - --rpc.max-connections=50000 - --rpc.max-logs-per-response=0 - --http - --http.addr=0.0.0.0 - --http.api=eth,net,web3,txpool,debug - --http.corsdomain=* - --http.port=8545 - --ws - --ws.addr=0.0.0.0 - --ws.api=eth,net,web3,txpool,debug - --ws.origins=* - --ws.port=8545 - --authrpc.addr=0.0.0.0 - --authrpc.jwtsecret=/jwtsecret restart: unless-stopped stop_grace_period: 5m networks: - chains volumes: - ${GRAVITY_TESTNET_RETH_PRUNED_TRACE_DATA:-gravity-testnet-reth-pruned-trace}:/execution - .jwtsecret:/jwtsecret:ro - /slowdisk:/slowdisk logging: *logging-defaults labels: - prometheus-scrape.enabled=true - prometheus-scrape.port=9001 - prometheus-scrape.path=/metrics - traefik.enable=true - traefik.http.middlewares.gravity-testnet-reth-pruned-trace-stripprefix.stripprefix.prefixes=/gravity-testnet - traefik.http.services.gravity-testnet-reth-pruned-trace.loadbalancer.server.port=8545 - ${NO_SSL:-traefik.http.routers.gravity-testnet-reth-pruned-trace.entrypoints=websecure} - ${NO_SSL:-traefik.http.routers.gravity-testnet-reth-pruned-trace.tls.certresolver=myresolver} - ${NO_SSL:-traefik.http.routers.gravity-testnet-reth-pruned-trace.rule=Host(`$DOMAIN`) && (Path(`/gravity-testnet`) || Path(`/gravity-testnet/`))} - ${NO_SSL:+traefik.http.routers.gravity-testnet-reth-pruned-trace.rule=Path(`/gravity-testnet`) || Path(`/gravity-testnet/`)} - traefik.http.routers.gravity-testnet-reth-pruned-trace.middlewares=gravity-testnet-reth-pruned-trace-stripprefix, ipallowlist shm_size: 2gb gravity-testnet-node: image: ${GRAVITY_APTOSBFT_IMAGE:-ghcr.io/galxe/gravity_node}:${GRAVITY_TESTNET_APTOSBFT_VERSION:-v1.10.0} user: 0:0 ports: - 15052:26180 - 15053:26181 - 9001:9001 environment: - GRAVITY_NETWORK=testnet - IP=${IP} entrypoint: [/bin/bash, -c] command: - | # Generate or use existing consensus config if [ ! -f /config/public_full_node.yaml ]; then gravity-node init --config-dir /config --chain testnet fi # Start the consensus node exec gravity-node run --config /config/public_full_node.yaml restart: unless-stopped stop_grace_period: 5m networks: - chains volumes: - ${GRAVITY_TESTNET_RETH_PRUNED_TRACE_CONSENSUS_DATA:-gravity-testnet-reth-pruned-trace-consensus}:/data/consensus:rw - ./gravity/testnet/genesis.blob:/config/genesis.blob:ro - ./gravity/testnet/public_full_node.yaml:/config/public_full_node.yaml:ro - ./gravity/testnet/waypoint.txt:/config/waypoint.txt:ro healthcheck: test: [CMD-SHELL, wget -qO- http://localhost:9001/health || exit 1] interval: 30s timeout: 10s retries: 3 start_period: 60s logging: *logging-defaults labels: - prometheus-scrape.enabled=true - prometheus-scrape.port=9001 volumes: gravity-testnet-reth-pruned-trace: gravity-testnet-reth-pruned-trace-consensus: x-upstreams: - id: $${ID} labels: provider: $${PROVIDER} connection: generic: rpc: url: $${RPC_URL} ws: frameSize: 20Mb msgSize: 50Mb url: $${WS_URL} chain: gravity-testnet method-groups: enabled: - debug - filter - trace methods: disabled: enabled: - name: txpool_content # TODO: should be disabled for rollup nodes ...