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

Test port 80 rather than just try to use it: Graceful sharing and management #126

Closed
rfay opened this issue Apr 5, 2017 · 9 comments
Closed
Assignees
Milestone

Comments

@rfay
Copy link
Member

rfay commented Apr 5, 2017

What happened (or feature request):

People will have processes on their machine that use port 80. We need to handle that situation by

Edit: Note that 3306 was originally mentioned here, but we no longer expose 3306 directly, and docker should be choosing an unused port???

Original OP continues:

I noticed in the ddev describe PR #116 that mysql is expected to be exposed on the local machine as port 3306. I don't think it currently is, but when we expose it, it will just be no end of support complaints if it is exposed on 3306, as many people like me are running mysql locally for a variety of reasons.

Update: As long as ddev properly detects collisions and gives simple instructions to the user, that approach of detect-warn-assist is fine.

It's worth considering exposing http on a port other than 80 as well, although this is more problematic since browsers absolutely love port 80.

What you expected to happen:

I expect ddev sites to respect existing listeners when exposing ports.

How to reproduce it (as minimally and precisely as possible):

Create a ddev site and see where the mysql port is exposed. ddev describe will tell this in the future. Alternately, run the mysql client with mysql -h127.0.0.1 -uroot and see which mysql server you get.

Anything else do we need to know:

Related source links or issues (like source JIRA issue):

@beeradb
Copy link
Contributor

beeradb commented Apr 5, 2017

I don't think there's anything inherently wrong w/ defaulting to 80/3306, we just need to make sure there's an easy way to change the default if there's a port conflict. It's also worth deciding if the value gained by using those default ports is worth the inevitable support requests.

@rfay
Copy link
Member Author

rfay commented Apr 5, 2017

I can buy that: If the detection and feedback given to the user are adequate, all is good.

@rfay rfay changed the title ddev mysql mapped port should be something besides 3306 ddev mysql mapped port should be something besides 3306 (or detect/handle feedback well) Apr 5, 2017
@rickmanelius
Copy link
Contributor

To weigh in on this, Brad and I surfaced this in the conversation re:custom containers #121. As noted, we will need to warn if there is collisions and provide a manner of configuring around.

@rfay rfay added the incubate label Apr 18, 2017
@rickmanelius rickmanelius added this to the v1.0 milestone May 16, 2017
@rfay rfay changed the title ddev mysql mapped port should be something besides 3306 (or detect/handle feedback well) Test ports 80 and 3306, etc rather than just try to use them: Graceful sharing and management May 16, 2017
@rfay
Copy link
Member Author

rfay commented May 16, 2017

I edited the OP and updated the title.

@rfay rfay changed the title Test ports 80 and 3306, etc rather than just try to use them: Graceful sharing and management Test port 80 rather than just try to use it: Graceful sharing and management Jun 8, 2017
@rickmanelius
Copy link
Contributor

Looks like this could be a quick win and allow ddev to play nicer in the larger ecosystem.

@rickmanelius rickmanelius modified the milestones: v1.1, v1.0 Jun 27, 2017
@rickmanelius
Copy link
Contributor

Assigned to @nmccrory. Please post a suggested plan of attack and I'd love for @rfay to provide feedback during that process as well as the resulting PR given that he's done a great job defining the issue and desired result.

@rfay
Copy link
Member Author

rfay commented Sep 26, 2017

The key issue that needs to be sorted here is whether we're going to provide configuration for an alternate port. IMO we should start by just testing and explaining, rather than trying to solve the alternate port problem.

Spun off the config-for-alternate-ports problem into #481

@rfay
Copy link
Member Author

rfay commented Sep 26, 2017

Strategy for this:

  • Before docker-compose up, probe port 80 and 443 on local machine.
  • If connection is established, fail with explanation of what is happening.
  • Add documentation on how to find out what is occupying a port on mac/linux/maybe-windows
  • Suggest some common turn-off-webserver techniques

@rfay
Copy link
Member Author

rfay commented Sep 26, 2017

After reading some of the comments in https://www.reddit.com/r/golang/comments/34efmu/checking_tcp_port_in_go/ (testing for a listener is not enough) it's worth thinking a little further. The problem is we don't want to use root (which you'd need to do to directly bind to those). However, docker has supercow privs and can bind to those. So we might want to issue a docker run (with port binding on 80/443) on a trivial docker container and harvest the results of those to determine whether we'll be able to get 80/443.

docker run -it -p80:80 -p443:443 busybox:1.27.2

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