-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
3.8.0: rails s -b 0.0.0.0 will set port to default puma port #1255
Comments
Same here. This was introduced by #1234, which adds 3 different sources of configuration. I tried to fix this, but I'm not sure my code is correct: host = options[:Host] || default_options[:Host] || ::Puma::Configuration::DefaultTCPHost
port = options[:Port] || default_options[:Port] || ::Puma::Configuration::DefaultTCPPort
self.set_host_port_to_config(host, port, user_config) (This code doesn't care default_config, so I'm not sure my code is correct) |
Paging @schneems |
Well 💩. Thanks for the issue. I'll be able to take a look but it probably won't be for a few days I'm currently a bit sick. |
So. I'm seeing a different behavior:
Can you give me an example app that reproduces the problem? |
You can see the full logs.
here.
I think this puma server listens Incidentally, this is a just generated rails application by the following command:
|
see, rails/rails#28513
|
This still seems to happen with Rails 5.1.0.rc2 (not sure who's fault it is, Rails or Puma…):
|
oh, sorry, I might be using my forked puma gem... It seems not fixed yet... |
Just to confirm, I just tested this on a brand new Rails app generated with Rails 5.1.0.rc2 on Ruby 2.4.1 (on macOS Sierra). The same issue persists. |
Able to repro with rails master
|
The issue is how we're doing defaults
What is happening is Here's that method
|
To build a "binds" we need a host IP (via Host) and a port. We were running into a problem where a Host was being explicitly set via user but the Port was being defaulted to by Rails. When this happened the Host was used, but Puma would accidentally use it's own default port 9292 instead of Rail's port of 3000. The fix was to use the "default" port passed in from a framework (if available) when no explicitly set Port is provided.
We are hitting the same issue. Any thoughts as to a fix? For now we are explicitly setting the port in our docker spin up script. Edit: Ah, I see the commit. Thanks for all your hard work! |
To build a "binds" we need a host IP (via Host) and a port. We were running into a problem where a Host was being explicitly set via user but the Port was being defaulted to by Rails. When this happened the Host was used, but Puma would accidentally use it's own default port 9292 instead of Rail's port of 3000. The fix was to use the "default" port passed in from a framework (if available) when no explicitly set Port is provided.
Steps to reproduce
rails s -b 0.0.0.0
Expected behavior
Listening on tcp://0.0.0.0:3000
Actual behavior
Listening on tcp://0.0.0.0:9292
System configuration
In docker env:
Ruby version: 2.4.1
Rails version: 5.1.0rc1, not tested with 4.x
Quick solution
Run
rails s -b 0.0.0.0 -p 3000
The text was updated successfully, but these errors were encountered: