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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating to latest ssb-server breaks ssb-pub #638

Closed
ahdinosaur opened this issue Feb 17, 2019 · 10 comments
Closed

updating to latest ssb-server breaks ssb-pub #638

ahdinosaur opened this issue Feb 17, 2019 · 10 comments

Comments

@ahdinosaur
Copy link
Contributor

ahdinosaur commented Feb 17, 2019

hi folx 😺

i tried to update ssb-pub to use the latest ssb-server: ahdinosaur/ssb-pub#19

turns out, it doesn't work: 💥

ssb-server 14.1.2 /home/node/.ssb logging.level:notice
my key ID: VJM7w1W19ZsKmG2KnfaoKIM66BRoreEkzaVm/J//wl8=.ed25519
WARNING-DEPRECATION: ssb-links not installed as a plugin. If you are using git-ssb, ssb-npm or patchfoo please consider installing it
Listening on one.butt.nz:8008 (multiserver net plugin)
Listening on one.butt.nz:8989 (multiserver ws plugin)
ssb-friends: stream legacy api used
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRNOTAVAIL 138.68.8.185:8008
    at Server.setupListenHandle [as _listen2] (net.js:1343:19)
    at listenInCluster (net.js:1401:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1510:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:72:10)

where 138.68.8.185 is the public ip address of the server: one.butt.nz

the last working version was [email protected]: https://github.com/ssbc/scuttlebot-release/blob/9bb15aea49512a001a507c58ffe081490915a8af/npm-shrinkwrap.json

@ahdinosaur
Copy link
Contributor Author

after digging into a few rabbit holes, i think i found the reason for the break:

[email protected] depended on [email protected], where the net server starts using only the port as configuration: https://github.com/ssbc/multiserver/blob/b0e7e04942509eb2f598f8903a77572e0ab7cad2/plugins/net.js#L24

in the latest multiserver, the host is being used, which does not work for ssb-pub because it runs inside a docker container: https://github.com/ssbc/multiserver/blob/785de927772e1cdf22b7b8331f2f4d7686afc9aa/plugins/net.js#L43

i'm not sure how i'm supposed to fix this, i'm not having any success trying to update ~/.ssb/config to match the latest ssb-config documentation, nor do i really want to configure using anything but environment variables.

@ahdinosaur
Copy link
Contributor Author

ahdinosaur commented Feb 17, 2019

okay, got a working config:

{
  "connections": {
    "incoming": {
      "net": [
        { "scope": "public", "host": "0.0.0.0", "external": ["one.butt.nz"], "transform": "shs", "port": 8008 }
      ]
    },
    "outgoing": {
      "net": [{ "transform": "shs" }]
    }
  }
}

i also had to remove the ssb_host=one.butt.nz environment variable, because otherwise ssb-config would throw.

would folx be keen to add a top-level external env var, so with ssb_host=0.0.0.0 and ssb_external=one.butt.nz then ssb-config could create a config like this? or since this is already a change that will require a manual change from everyone running ssb-pub, maybe i just push a major version where from now on the admins need to manually muck with ~/.ssb/config. or i fork ssb-server and be opinionated, but i'd rather spend my energy on PeachCloud where i'm going to do that. hmm! ⛅

@ahdinosaur
Copy link
Contributor Author

i'm going to go forward with ahdinosaur/ssb-pub#20, where i accept that there's been a breaking change and help pub owners make the manual changes so they can follow the latest ssb-server, there's been unresolved issues in ssb-pub since the new config + connection changes. 💤

so maybe this can be closed? it seems like ssb-server is working, i just think it's not friendly to use. ❤️

@dominictarr
Copy link
Contributor

@ahdinosaur If ssb-pub had integration tests that I could run, i'd definitely run them as part of ssb-server release. (that's just a quick asside)

@mixmix this looks like the ssb-config that you changed recently is loading configuration differently, and breaking ssb-pub... @ahdinosaur what is the default configuration you were before this?

@ahdinosaur
Copy link
Contributor Author

@ahdinosaur If ssb-pub had integration tests that I could run, i'd definitely run them as part of ssb-server release. (that's just a quick asside)

@dominictarr yeah, that's a good idea for the future! ☀️

@mixmix this looks like the ssb-config that you changed recently is loading configuration differently, and breaking ssb-pub... @ahdinosaur what is the default configuration you were before this?

@dominictarr that was my first thought on what the problem was, but in both the current version of ssb-config and the version ssb-pub was using, the host was passed down into a default incoming net connection. as far as i can tell the problem is in how multiserver/plugins/net changed to actually use the host when starting the net server, before it only used the port: #638 (comment).

@ahdinosaur
Copy link
Contributor Author

@ahdinosaur If ssb-pub had integration tests that I could run, i'd definitely run them as part of ssb-server release. (that's just a quick asside)

@dominictarr although, now i realize this would be more tricky here, because ssb-pub is running as a Docker container, which is why the networking is different. well maybe not tricky, but i mean a proper integration test would have to use Docker to test what ssb-pub expects. for ssb-pub, ssb-server can't bind to the public ip address, because it's inside a container with a different networking interface, so it must bind to 0.0.0.0. then the client can connect to either the public ip address or 0.0.0.0.

@dominictarr
Copy link
Contributor

@ahdinosaur thanks. Could we use docker to test a range of network setups? because that is currently a pain point and has not much tests.

Originally it did just bind to '0.0.0.0' or "::" (the same, but in ipv6 form) by leaving the host off, but when noauth was introduced it was desired to only create a server specific interfaces (i.e. localhost)

Ideally, if you use a noauth local ws address (which @regular needs) it just listens on localhost but if you have a pub with a static ip address, it should just work without having to set that.

  • local ws address with noauth should bind localhost only and no other interfaces.
  • normal net should also bind local network, so that local gossip works.
  • pubs on digital ocean, etc should bind the public address, which they probably have.
  • @mixmix's home network has a public ipv6 address, but not a public ipv4 address

everyone (including me) wants this to be easy, without having to set custom configuration. No body has all these cases running side by side, and it's hard to test them all...

@ahdinosaur
Copy link
Contributor Author

water under the bridge by now 🐃 🍉

@JonTheNiceGuy
Copy link

JonTheNiceGuy commented Oct 24, 2019

Just to note, I've been bitten by this tonight without it being in docker. {CROPPED - now in #697}

@JonTheNiceGuy
Copy link

Actually, I'll open a fresh issue for this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants