paritytech / zombienet

A cli tool to easily spawn ephemeral Polkadot/Substrate networks and perform tests against them.
https://paritytech.github.io/zombienet/
GNU General Public License v3.0
160 stars 91 forks source link

Dockerizing Zombienet #1921

Open dudo50 opened 4 hours ago

dudo50 commented 4 hours ago

Issue Description

Currently, even after exposing endpoints my dockerized version of zombienet doesn't seem to allow to connect into PJS,

Sn

Zombienet starts fine

S

Steps to reproduce the issue

Steps to reproduce the issue

  1. Running docker build
  2. Starting docker
  3. Clicking on zombienet endpoint

Describe the results you received

So when I click on Zombienet endpoint it stays on initiating in PJS and it never connects to zombienet

Describe the results you expected

How can I ensure, that zombienet endpoints are accessible?

Zombienet version

Latest

Provider

Native

Provider version

latest polkadot parachain and polkadot relay chain

Here, I expose ports
EXPOSE 20000-80000

I use this command 
# Launch zombienet
CMD ["./zombienet-linux-x64", "-p", "native", "-c", "1", "spawn", "config-both.toml"]

Upstream Latest Release

Yes

Additional environment details

Linux docker container:

official rust one

FROM rust:latest

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

Screenshots

No response

pepoviola commented 3 hours ago

Hi @dudo50, thanks for the feedback. Just to understand and try to reproduce. You are using zombienet native provider inside a docker container right? which url are you using for connecting to pjs?

Thanks again for the feedback!

dudo50 commented 3 hours ago

Thanks @pepoviola for quick reply - the "Direct link"

eg: │ Direct Link │ https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:40895#/explorer

Yes, I use native

Thanks once again for your time!

pepoviola commented 2 hours ago

Hi @dudo50, the Direct link will not work if you expose the ports in the container since is using 127.0.0.1 as ip instead of the ip of the container. You will need to publish the ports to allocate those on your host machine or change the ip to use the one from the container. Is something you see viable in your use-case?

Thanks!

dudo50 commented 2 hours ago

Thanks @pepoviola - Can you provide some guidance on how to do this?

It is definitely viable.

Thanks!

pepoviola commented 2 hours ago

Thanks @pepoviola - Can you provide some guidance on how to do this?

It is definitely viable.

Thanks!

Great, yes. can you pointing here the repo/docker script you are using? Thanks!

dudo50 commented 2 hours ago

Sure @pepoviola ! Here is directly the link to dockerfile: https://github.com/paraspell-research/xcnft-pallet/blob/main/Dockerfile

Also here are my build and my run commands: docker build --platform linux/x86_64 -t polkadot-sdk-image:latest . docker run --network=host --platform linux/x86_64 --rm -it polkadot-sdk-image:latest

Thanks again!

pepoviola commented 1 hour ago

Hi @dudo50, can you use something like

[relaychain]

default_command = "../target/release/polkadot"
default_args = [ "-lparachain=debug" ]

chain = "rococo-local"

  [[relaychain.nodes]]
  name = "alice"
  rpc_port = 9910

  [[relaychain.nodes]]
  name = "bob"
  rpc_port = 9911

  [[relaychain.nodes]]
  name = "charlie"
  rpc_port = 9912

  [[relaychain.nodes]]
  name = "dave"
  rpc_port = 9913

[[parachains]]
id = 1000

  [parachains.collator]
  name = "parachain-A-1000-collator01"
  command = "../target/release/parachain-template-node"
    args = [
        "-lparachain=debug,xcm::process-message=trace,xcm::execute=trace,xcm::process=trace"
    ]
  rpc_port = 9920

[[parachains]]
id = 1001

  [parachains.collator]
  name = "parachain-A-1001-collator01"
  command = "../target/release/parachain-template-node-two"
  args = [
        "-lparachain=debug,xcm::process-message=trace,xcm::execute=trace,xcm::process=trace"
    ]
  rpc_port = 9921

and the when you run use

  docker run --network=host --platform linux/x86_64 -p 9910-9913:9910-9913 -p 9920-9921:9920-9921 --rm -it polkadot-sdk-image:latest

So you publish the fixed ports for pjs

Thanks!