diff --git a/hyperliquid/visor.Dockerfile b/hyperliquid/visor.Dockerfile new file mode 100644 index 00000000..65286a98 --- /dev/null +++ b/hyperliquid/visor.Dockerfile @@ -0,0 +1,29 @@ +FROM ubuntu:24.04 + +ARG CHAIN_NAME=Testnet + +# Define URLs as environment variables +ARG HL_VISOR_URL_TESTNET=https://binaries.hyperliquid-testnet.xyz/Testnet/hl-visor +ARG HL_VISOR_URL_MAINNET=https://binaries.hyperliquid.xyz/Mainnet/hl-visor + +WORKDIR /root + +# Configure chain to testnet +RUN echo "{\"chain\": \"${CHAIN_NAME}\"}" > /root/visor.json + +# Download and verify hl-visor binary +RUN if [ "$CHAIN_NAME" = "Testnet" ]; then \ + curl -o /root/hl-visor $HL_VISOR_URL_TESTNET; \ + else \ + curl -o /root/hl-visor $HL_VISOR_URL_MAINNET; \ + fi \ + && chmod +x /root/hl-visor \ + && mkdir -p /root/hl/data + +VOLUME /root/hl/data + +# Expose gossip ports +EXPOSE 4000-4010 + +# Run a non-validating node +ENTRYPOINT ["/root/hl-visor", "run-non-validator", "--replica-cmds-style", "recent-actions", "--serve-evm-rpc"] \ No newline at end of file diff --git a/hyperliquid/visor/hyperliquid-mainnet-visor-pruned.yml b/hyperliquid/visor/hyperliquid-mainnet-visor-pruned.yml new file mode 100644 index 00000000..e42e6199 --- /dev/null +++ b/hyperliquid/visor/hyperliquid-mainnet-visor-pruned.yml @@ -0,0 +1,103 @@ +--- +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:hyperliquid/visor/hyperliquid-mainnet-visor-pruned.yml +# +# docker compose up -d +# +# curl -X POST https://${IP}.traefik.me/hyperliquid-mainnet-pruned \ +# -H "Content-Type: application/json" \ +# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + +services: + hyperliquid-mainnet-pruned: + build: + context: ./hyperliquid + dockerfile: visor.Dockerfile + args: + CHAIN_NAME: Mainnet + 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: + - 4001:4001 + - 4001:4001/udp + - 4002:4002 + - 4002:4002/udp + expose: + - 3001 + restart: unless-stopped + stop_grace_period: 5m + networks: + - chains + volumes: + - ${HYPERLIQUID_MAINNET_VISOR_PRUNED_DATA:-hyperliquid-mainnet-visor-pruned}:/root/hl/data + - /slowdisk:/slowdisk + logging: *logging-defaults + labels: + - prometheus-scrape.enabled=false + - traefik.enable=true + - traefik.http.middlewares.hyperliquid-mainnet-visor-pruned-set-path.replacepath.path=/evm + - traefik.http.middlewares.hyperliquid-mainnet-visor-pruned-stripprefix.stripprefix.prefixes=/hyperliquid-mainnet-pruned + - traefik.http.services.hyperliquid-mainnet-visor-pruned.loadbalancer.server.port=8545 + - ${NO_SSL:-traefik.http.routers.hyperliquid-mainnet-visor-pruned.entrypoints=websecure} + - ${NO_SSL:-traefik.http.routers.hyperliquid-mainnet-visor-pruned.tls.certresolver=myresolver} + - ${NO_SSL:-traefik.http.routers.hyperliquid-mainnet-visor-pruned.rule=Host(`$DOMAIN`) && (Path(`/hyperliquid-mainnet-pruned`) || Path(`/hyperliquid-mainnet-pruned/`))} + - ${NO_SSL:+traefik.http.routers.hyperliquid-mainnet-visor-pruned.rule=Path(`/hyperliquid-mainnet-pruned`) || Path(`/hyperliquid-mainnet-pruned/`)} + - traefik.http.routers.hyperliquid-mainnet-visor-pruned.middlewares=hyperliquid-mainnet-visor-pruned-stripprefix, hyperliquid-mainnet-visor-pruned-set-path, ipallowlist + +volumes: + hyperliquid-mainnet-visor-pruned: + +x-upstreams: + - id: $${ID} + labels: + provider: $${PROVIDER} + connection: + generic: + rpc: + url: $${RPC_URL} + ws: + frameSize: 20Mb + msgSize: 50Mb + url: $${WS_URL} + chain: hyperliquid + method-groups: + enabled: + - debug + - filter + methods: + disabled: + enabled: + - name: txpool_content # TODO: should be disabled for rollup nodes +... \ No newline at end of file diff --git a/hyperliquid/visor/hyperliquid-testnet-visor-pruned.yml b/hyperliquid/visor/hyperliquid-testnet-visor-pruned.yml new file mode 100644 index 00000000..e1b09237 --- /dev/null +++ b/hyperliquid/visor/hyperliquid-testnet-visor-pruned.yml @@ -0,0 +1,103 @@ +--- +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:hyperliquid/visor/hyperliquid-testnet-visor-pruned.yml +# +# docker compose up -d +# +# curl -X POST https://${IP}.traefik.me/hyperliquid-testnet-pruned \ +# -H "Content-Type: application/json" \ +# --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' + +services: + hyperliquid-testnet-pruned: + build: + context: ./hyperliquid + dockerfile: visor.Dockerfile + args: + CHAIN_NAME: Testnet + 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: + - 4001:4001 + - 4001:4001/udp + - 4002:4002 + - 4002:4002/udp + expose: + - 3001 + restart: unless-stopped + stop_grace_period: 5m + networks: + - chains + volumes: + - ${HYPERLIQUID_TESTNET_VISOR_PRUNED_DATA:-hyperliquid-testnet-visor-pruned}:/root/hl/data + - /slowdisk:/slowdisk + logging: *logging-defaults + labels: + - prometheus-scrape.enabled=false + - traefik.enable=true + - traefik.http.middlewares.hyperliquid-testnet-visor-pruned-set-path.replacepath.path=/evm + - traefik.http.middlewares.hyperliquid-testnet-visor-pruned-stripprefix.stripprefix.prefixes=/hyperliquid-testnet-pruned + - traefik.http.services.hyperliquid-testnet-visor-pruned.loadbalancer.server.port=8545 + - ${NO_SSL:-traefik.http.routers.hyperliquid-testnet-visor-pruned.entrypoints=websecure} + - ${NO_SSL:-traefik.http.routers.hyperliquid-testnet-visor-pruned.tls.certresolver=myresolver} + - ${NO_SSL:-traefik.http.routers.hyperliquid-testnet-visor-pruned.rule=Host(`$DOMAIN`) && (Path(`/hyperliquid-testnet-pruned`) || Path(`/hyperliquid-testnet-pruned/`))} + - ${NO_SSL:+traefik.http.routers.hyperliquid-testnet-visor-pruned.rule=Path(`/hyperliquid-testnet-pruned`) || Path(`/hyperliquid-testnet-pruned/`)} + - traefik.http.routers.hyperliquid-testnet-visor-pruned.middlewares=hyperliquid-testnet-visor-pruned-stripprefix, hyperliquid-testnet-visor-pruned-set-path, ipallowlist + +volumes: + hyperliquid-testnet-visor-pruned: + +x-upstreams: + - id: $${ID} + labels: + provider: $${PROVIDER} + connection: + generic: + rpc: + url: $${RPC_URL} + ws: + frameSize: 20Mb + msgSize: 50Mb + url: $${WS_URL} + chain: hyperliquid-testnet + method-groups: + enabled: + - debug + - filter + methods: + disabled: + enabled: + - name: txpool_content # TODO: should be disabled for rollup nodes +... \ No newline at end of file