Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[Roadmap] add port check to docker compose / up #2138

Closed
SleeplessByte opened this issue Aug 6, 2020 · 8 comments
Closed

[Roadmap] add port check to docker compose / up #2138

SleeplessByte opened this issue Aug 6, 2020 · 8 comments
Assignees
Labels

Comments

@SleeplessByte
Copy link
Member

I've lost 2 days last weekend because of a doubly bound port. The problem is that if one service binds on "0:0:0:0" + port and one service on localhost / local ip + port, the OS will not error and get into a broken state. This is also because docker injects itself into routing files, on ipv4.

Either way.

We should have an extra script that check if ports are occupied/bound before starting the services, so we can actually bail out and error.

@iHiD
Copy link
Member

iHiD commented Aug 6, 2020

So my understanding is that the network is self-contained within Docker except for any ports that are exposed. I feel like the only port that should be exposed is the 3020 one. At the moment, two other ports are exposed, which I believe is what hurt you.

So if those understandings/assumptions are correct, then we just need to ensure 3020 isn't already used when running the script?

@SleeplessByte
Copy link
Member Author

SleeplessByte commented Aug 6, 2020

Correct on checking the exposed port. And if possible, when running in interactive mode (not CI=1) ask the user to change, or give an actionable error.

- 3035:3035
This was death for me

@iHiD
Copy link
Member

iHiD commented Aug 6, 2020

@joshgoebel We ok just to expose 3020?

@joshgoebel
Copy link
Contributor

Wait, what am I missing. 3035 is the webpack hosting... and 3334 is the websocket... both these things need to go all the way thru to the client so they are accessible in the browser... so it seems we need all 3 ports, no?

I'm more curious how I could reproduce/detect the problem? @SleeplessByte Which OS are you on again?

@joshgoebel
Copy link
Contributor

@SleeplessByte How did you get yourself in that situation? Multiple instances of the dev stack? Or is it simpler than that?

@iHiD
Copy link
Member

iHiD commented Aug 6, 2020

@joshgoebel Working on a different (non-exercism) product. The port silently clashes, so assets hit Exercism for compilation.

You're right about us probably needing the ports. I'll leave @SleeplessByte to help solve this! :)

@SleeplessByte
Copy link
Member Author

Webpack runs on port 3035 by default. That means by default this project will clash with any project using webpacker (such as any modern rails project). Because docker doesn't bind on my local IP, but 0:0:0:0, it won't actually error. That will cause the webpacker from exercism to work alongside a local isntance, making the local instance report the correct manifest, but the exercism files being available on the port, breaking everything without explanation.

rails/webpacker#767

In reality we want to run everything on non-default ports, preferably something we can configure easily (but with non-standard defaults, just like we don't run on 3000 for rails).

@joshgoebel
Copy link
Contributor

I wasn't aware that Rails itself seems to proxy requests itself thru to the dev server rather than expose it's port... so if this is indeed the case (the URL of the dev server is never handed out)... does it need to be exposed to the outside world at all - or can we just map the outside web port and web socket port?

@iHiD iHiD closed this as completed Jan 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants