OffchainLabs / arbitrum-docs

Arbitrum Docs! Content + Webapp
https://developer.arbitrum.io/
179 stars 326 forks source link

Document new IPC support #34

Closed jmcph4 closed 2 months ago

jmcph4 commented 1 year ago

Is your feature request related to a problem? Please describe. IPC support recently landed in the 2.0.7 release. Notably, the official documentation for running a Nitro node currently lacks instructions on how to run a Nitro node both:

Describe the solution you'd like Instructions added to the official documentation for operating a Nitro node that includes (working) commands for starting the node from within Docker and that is able to communicate with host processes via IPC.

Describe alternatives you've considered None.

Additional context N/A

PlasmaPower commented 1 year ago

We'll properly document this at some point, but the general theory is to use the docker -v volume mount to get the ipc pipe out of the container, and then connect to it at the bound host path. Note this only works on Linux because Docker for Mac doesn't support it (yet).

jmcph4 commented 1 year ago

the general theory is to use the docker -v volume mount to get the ipc pipe out of the container, and then connect to it at the bound host path.

So my current set up is directly inspired from the official docs and is as follows:

$ docker run --rm -it -v ~/.arbitrum:/home/user/.arbitrum -v ~/arbitrum.sock:/home/user/guest.sock -p 0.0.0.0:8547:8547 -p 0.0.0.0:8548:8548 offchainlabs/nitro-node:v2.0.7-10b845c --l1.url https://rpc.flashbots.net --l2.chain-id=42161 --http.api=net,web3,eth,debug --http.corsdomain=* --http.addr=0.0.0.0 --http.vhosts=* --ipc.path="/home/user/guest.sock"
INFO [10-04|04:20:36.940] Running Arbitrum nitro node              revision=development vcs.time=development
INFO [10-04|04:20:36.940] connected to l1 chain                    l1url=https://rpc.flashbots.net l1chainid=1
INFO [10-04|04:20:36.941] Allocated cache and file handles         database=/home/user/.arbitrum/arb1/nitro/l2chaindata cache=16.00MiB handles=16 readonly=true
INFO [10-04|04:20:36.955] Opened ancient database                  database=/home/user/.arbitrum/arb1/nitro/l2chaindata/ancient readonly=true
INFO [10-04|04:20:36.955] Allocated cache and file handles         database=/home/user/.arbitrum/arb1/nitro/l2chaindata cache=16.00MiB handles=16
INFO [10-04|04:20:37.040] Opened ancient database                  database=/home/user/.arbitrum/arb1/nitro/l2chaindata/ancient readonly=false
INFO [10-04|04:20:37.069] Loaded most recent local header          number=22,291,077 hash=5194d3..9f265d td=83261 age=1mo2d21h
INFO [10-04|04:20:37.069] Loaded most recent local full block      number=22,291,077 hash=5194d3..9f265d td=83261 age=1mo2d21h
INFO [10-04|04:20:37.069] Loaded most recent local fast block      number=22,291,077 hash=5194d3..9f265d td=83261 age=1mo2d21h
INFO [10-04|04:20:37.075] Allocated cache and file handles         database=/home/user/.arbitrum/arb1/nitro/arbitrumdata cache=16.00MiB handles=16
INFO [10-04|04:20:37.109] Allocated cache and file handles         database=/home/user/.arbitrum/arb1/nitro/classic-msg cache=16.00MiB handles=16 readonly=true
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:43:58+0000 age=3h36m39s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:44:17+0000 age=3h36m20s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:45:22+0000 age=3h35m15s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:50:20+0000 age=3h30m17s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:50:42+0000 age=3h29m55s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:52:58+0000 age=3h27m39s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:55:38+0000 age=3h24m59s
WARN [10-04|04:20:37.115] Unclean shutdown detected                booted=2022-10-04T00:58:05+0000 age=3h22m32s
INFO [10-04|04:20:37.116] Starting peer-to-peer node               instance=nitro/vdevelopment/linux-amd64/go1.19.1
WARN [10-04|04:20:37.116] P2P server will be useless, neither dialing nor listening 
WARN [10-04|04:20:37.169] IPC opening failed                       url=/home/user/guest.sock error="listen unix /home/user/guest.sock: bind: address already in use"
INFO [10-04|04:20:37.170] New local node record                    seq=1,661,958,452,057 id=d0f07aafa353b21b ip=127.0.0.1 udp=0 tcp=0
INFO [10-04|04:20:37.170] Started P2P networking                   self=enode://1188805b826d792c6841ef55b5ed128f6bb9e31da91b807a110ba0edbc821e3771982337d11304778895ac14105b25989bdca9c823145863b9a97eabc6b1fd36@127.0.0.1:0
panic: Error starting node: listen unix /home/user/guest.sock: bind: address already in use

goroutine 1 [running]:
main.main()
    /workspace/cmd/nitro/nitro.go:336 +0x1f59
PlasmaPower commented 1 year ago

Maybe try bind mounting a folder with the ipc pipe instead of the pipe itself

jmcph4 commented 1 year ago

Maybe try bind mounting a folder with the ipc pipe instead of the pipe itself

On the host- or guest-side?

jmcph4 commented 1 year ago

So both of these invocations result in the same error:

Host-side:

$ docker run --rm -it -v ~/.arbitrum:/home/user/.arbitrum -v ~/socket_dir:/home/user/guest.sock -p 0.0.0.0:8547:8547 -p 0.0.0.0:8548:8548 offchainlabs/nitro-node:v2.0.7-10b845c --l1.url https://rpc.flashbots.net --l2.chain-id=42161 --http.api=net,web3,eth,debug --http.corsdomain=* --http.addr=0.0.0.0 --http.vhosts=* --ipc.path="/home/user/guest.sock"

Guest-side:

$ docker run --rm -it -v ~/.arbitrum:/home/user/.arbitrum -v ~/arbitrum.sock:/home/user/socket_dir -p 0.0.0.0:8547:8547 -p 0.0.0.0:8548:8548 offchainlabs/nitro-node:v2.0.7-10b845c --l1.url https://rpc.flashbots.net --l2.chain-id=42161 --http.api=net,web3,eth,debug --http.corsdomain=* --http.addr=0.0.0.0 --http.vhosts=* --ipc.path="/home/user/socket_dir/guest.sock"
ymonye commented 1 year ago

@jmcph4, I found your thread in Discord since I was wondering the same. Here's how I had IPC working under Docker on RHEL/AlmaLinux/Rocky Linux 8.5. I'm also running both Go-Ethereum & Arbitrum Classic Docker images under the same "eth-mainnet" Docker network.

docker run -d -it --ulimit nofile=1000000:1000000 --restart unless-stopped --stop-timeout 300 --log-opt max-size=10m --name arbitrum-nitro-mainnet --net eth-mainnet -v /arbitrum/nitro/mainnet/:/home/user/.arbitrum -p 0.0.0.0:8549:8549 -p 0.0.0.0:8550:8550 offchainlabs/nitro-node:v2.0.9-51f9452 --l1.url http://eth-mainnet:8545 --l2.chain-id=42161 --http.api=net,web3,eth,debug --http.corsdomain= --http.addr=0.0.0.0 --http.port=8549 --http.vhosts= --ws.addr=0.0.0.0 --ws.port=8550 --init.url="https://snapshot.arbitrum.io/mainnet/nitro.tar" --node.rpc.classic-redirect=http://eth-mainnet:8547 --node.caching.archive --ipc.path="/home/user/.arbitrum/arbitrum.ipc"