Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports to expose when running dat doctor in docker? #841

Closed
weiji14 opened this issue Aug 7, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@weiji14
Copy link

commented Aug 7, 2017

Hi, I'm trying to put together a 馃惓 docker-ized container for dat (source here) and am having problems with finding the right ports to expose so that dat doctor will run properly. End goal for me is to be able to run something like docker run --rm -it -v $PWD:/home/dat dat-docker dat share to share files via dat across computers rather than just on localhost, in a cross-platform way (via docker)!

I'm aware of #588 and have looked at the dat-doctor js file, which points me to opening up port 3282, but I'm still getting the error below when running DEBUG=dat* dat doctor inside my docker container. Error message in Linux below:

user@host:~$ cd ~/path/to/git-cloned/dat-docker && docker build -f Dockerfile -t dat .
.
.
.
user@host:~$ docker run --rm --it -v $PWD:/home/dat -P dat bash
dat@b4fd286d4b55:~$ DEBUG=dat* dat doctor
  dat dat 13.8.1 +0ms
  dat node v8.2.1 +2ms
  dat-doctor [info] Looking up public server address +36ms
[info] Testing connection to public peer
  dat-doctor Attempting connection to doctor, doctor1.publicbits.org +51ms
  dat-doctor Attempting connection to doctor, doctor1.publicbits.org +1ms
  dat-doctor Discovered doctor, 45.55.78.106:8887 +522ms
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +0ms
  dat-doctor Discovered doctor, 45.55.78.106:8887 +2ms
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +0ms
  dat-doctor Connection established to doctor +736ms
[info] TCP ONLY - success!
  dat-doctor Connection closed +249ms
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +3s
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +5s
[error] FAIL - Connection timeout, fail.
[error] FAIL - Unable to connect to public server.
[error] FAIL - Data was not echoed back from public server.

[info] End of phase one (Public Server), moving on to phase two (Peer to Peer via DNS)

[info] Public IP: 130.195.253.36
[info] Your public port was consistent across remote multiple hosts

To test p2p connectivity login to another computer and run:

  dat doctor 42eaec7408c2ee9334c6d176d51c785fc2fac208a248c2547e53cc017e3f4c58

Waiting for incoming connections... (local port: 3282)

Can someone point me to where in the dat-sphere I should look at to find the port (or port ranges) I'll need to open up/expose to get dat doctor working?

@joehand

This comment has been minimized.

Copy link
Member

commented Aug 8, 2017

Hi @weiji14, Dat's default port is 3282. It looks like you are exposing it correctly.

The dat doctor tries to connect via TCP and UTP. Your TCP connection succeeds but the UTP one fails. It does look like port 3282 is being used successfully.

It looks like maybe the UTP module wasn't installed successfully. You should be able to still connect via Dat but may struggle with hole-punching if UTP isn't working.

Was there a warning or something with npm install?

@joehand joehand added the Type: Bug label Aug 8, 2017

@ralphtheninja

This comment has been minimized.

Copy link
Contributor

commented Aug 9, 2017

@weiji14 Have you tried running the docker image using -p 3282:3282 -p 8887:8887 instead of -P?

@weiji14

This comment has been minimized.

Copy link
Author

commented Aug 9, 2017

@joehand I'm on my windows box right now and surprisingly, TCP and UTP works fine with no changes...

dat@6f9c5224bdd7:~$ DEBUG=dat* dat doctor
  dat dat 13.8.1 +0ms
  dat node v8.2.1 +3ms
  dat-doctor [info] Looking up public server address +39ms
[info] Testing connection to public peer
  dat-doctor Attempting connection to doctor, doctor1.publicbits.org +173ms
  dat-doctor Attempting connection to doctor, doctor1.publicbits.org +1ms
  dat-doctor Discovered doctor, 45.55.78.106:8887 +435ms
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +0ms
  dat-doctor Discovered doctor, 45.55.78.106:8887 +2ms
  dat-doctor Trying to connect to doctor, 45.55.78.106:8887 +0ms
  dat-doctor Connection established to doctor +638ms
  dat-doctor Connection established to doctor +4ms
[info] UTP ONLY - success!
  dat-doctor Connection closed +217ms
[info] TCP ONLY - success!
  dat-doctor Connection closed +258ms

[info] End of phase one (Public Server), moving on to phase two (Peer to Peer via DNS)

[info] Public IP: 114.110.34.166
[info] Your public port was inconsistent across remote multiple hosts
[error] Looks like you are behind a symmetric nat. Try enabling upnp.

To test p2p connectivity login to another computer and run:

  dat doctor 4ca59a42a25a7d20c031e332d91eac4eefe635a1b1139d69b6c6bb3c79370485

Waiting for incoming connections... (local port: 3282)

[0000-tcp] Connection established to remote peer
[0000-tcp] Connected closed

I think we can isolate this to linux for the meantime. I'll try and look out for the npm install errors when I have time with my linux box, but in theory, docker builds should be identical cross-platform. It might be a firewall related issue or something else I'll need to figure out. Is there another test I could run to see whether UTP connections are able to come in/go out?

@ralphtheninja I've actually tried using --network="host" before which is pretty much the same as -p 3282:3282 -p 8887:8887 but that didn't work (on Linux). Out of curiosity, what is port 8887 for?

@joehand

This comment has been minimized.

Copy link
Member

commented Aug 9, 2017

I realized there'd be an explicit message if UTP wasn't installed, so something else is blocking that connection. So you can forget the suggestion to check npm install, sorry.

That is strange that it works on windows but not linux. Now that I think about it, we've had some connection issues in docker on linux too. I'll try to run doctor on there tomorrow to see if I can reproduce.

I'll think about what other information we can add to dat doctor to help us debug this as well. Thanks!

@weiji14

This comment has been minimized.

Copy link
Author

commented Aug 18, 2017

I've tried a localized non-docker installation on my linux computer, and it seems that dat doctor can't connect to UTP either... So this might be a firewall issue I'm up against. I'm trying this in a university setting so that could be why.

Still would be useful to know what ports I would need to workaround things. I just realized UTP refers to Micro Transport Protocol - 碌TP (implemented through libutp and utp-native in dat), rather than the User Datagram Protocol - UDP. Somehow I thought it was a misspelling for some reason before 馃槅. Confusing too that 碌TP appears to be some variant of UDP 馃槙

Is there some other debugging command I can run to diagnose the situation? Ala iptables or something else?

@joehand

This comment has been minimized.

Copy link
Member

commented Oct 19, 2017

Ah, forgot about this issue. See the temporary solution via host networking mode: #858 (comment). We did quite a bit of debugging and had a real pain with dockers NAT, since it changes outbound ports with each connection.

Going to close in favor of #858 since its a bit higher in the stack.

@joehand joehand closed this Oct 19, 2017

@SvenDowideit

This comment has been minimized.

Copy link
Contributor

commented Mar 2, 2018

The problem you're having @weiji14 is that you can't use docker run -P, or docker run -p 3282

you need, as @mitar notes in #858 (comment) to tell docker to map the internal ports to the same ports on the host - docker run -p 3282:3282/tcp -p 3282:3282/udp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can鈥檛 perform that action at this time.