-
Notifications
You must be signed in to change notification settings - Fork 21.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
Rails 5 - Puma default port does not take effect #24435
Comments
I think this issue has been fixed on master. cc @schneems |
This is not supported right now, unless you run with Going to close for now, as this is more of feature request right now. |
This should work on master. Can you please re-try with rails master and let me know if it is working? Make sure that spring is stopped. |
@schneems it's not- https://gist.github.com/vipulnsward/f3e1a3ae26f5160d9de5f6e2837ce13e |
If this is valid, I believe puma/puma#939 is a valid issue too. |
This works for me
Are you using Puma 3.0 or above? |
@schneems so the above would work because of
This issue is related to changing port value in |
I think this is an issue in puma, I posted a comment there |
We could add some logic in Rails to not specify port if puma is bundled and a WDYT? |
I think we should to full support on this, i.e if there is |
We can just send |
@prathamesh-sonpatki that will not work. ➜ puma-demo b rails s -c config/puma.rb
=> Booting Puma
=> Rails 5.0.0.beta3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Exiting
/Users/sward/work/experiments/puma-demo/config/puma.rb:8:in `<top (required)>': undefined method `threads' for main:Object (NoMethodError)
from /Users/sward/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-2.0.0.alpha/lib/rack/builder.rb:42:in `require'
from /Users/sward/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-2.0.0.alpha/lib/rack/builder.rb:42:in `parse_file'
from /Users/sward/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-2.0.0.alpha/lib/rack/server.rb:318:in `build_app_and_options_from_config'
from /Users/sward/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-2.0.0.alpha/lib/rack/server.rb:218:in `app'
from /Users/sward/work/rails/railties/lib/rails/commands/server.rb:59:in `app'
from /Users/sward/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-2.0.0.alpha/lib/rack/server.rb:353:in `wrapped_app'
from /Users/sward/work/rails/railties/lib/rails/commands/server.rb:124:in `log_to_stdout'
from /Users/sward/work/rails/railties/lib/rails/commands/server.rb:77:in `start'
from /Users/sward/work/rails/railties/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /Users/sward/work/rails/railties/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /Users/sward/work/rails/railties/lib/rails/commands/commands_tasks.rb:85:in `server'
from /Users/sward/work/rails/railties/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/sward/work/rails/railties/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>' Hence I mentioned we need to parse the Again, we need to consider if we need to treat puma as a special case. Either way just passing puma config via |
btw, another reason we can't just pass config is:
will always set ENV to |
I would say we can support PORT from |
When I made the change in Puma, I was thinking that Another thing that could have prevented this situation is if rack handler API supported a values hash and a "default" hash to differentiate between values a user actually supplied versus ones we've chosen. But it's far far too late for that. Maybe we could get that in for Rack 2.0 but I don't think any of us have the time right now. Right now I think our realistic options for moving forwards would be to either special case the Rails code, or to add some kind of a warning to the Puma code letting you know why we are connecting to a different port. |
That is a good point. |
Wow. This is going deeper than I thought. |
This still isn't fixed yet? In Rails 5.0.1, I have this exact behaviour. Just for the records: using the following code (in # Change default port of development server, see http://stackoverflow.com/questions/18103316
require 'rails/commands/server'
module DefaultOptions
def default_options
super.merge!(Port: 3001)
end
end
Rails::Server.send(:prepend, DefaultOptions) |
If you know how to fix in a sane way, by all means take a stab. |
Actually I can set the port via
|
It seems to work with the newest Rails version. The only strange thing is that in the console output, it first states port 3000, then 3001:
|
If you're using |
Thanks for pointing this out. |
When using
|
These are a issue of Puma. Ref: puma/puma#1200 |
This was fixed with Puma v3.7.1, please upgrade!! |
@guilleiguaran only the issue @detj was referring to was fixed. the original issue remains. |
[close #24435] Send user_supplied_options to server
So when using vagrant as dev environment and running rails s -b 0.0.0.0 doesn't work. I had to run rails s -p 3000 -b 0.0.0.0 everytime to access localhost:3030 |
Are you using master? |
master branch you mean? |
Yeah, this should be fixed on puma's master branch. Are you using master and still seeing the issue? |
Oh it is fixed now, I guess my coteam fixed the issue and I saw it was a bug from the newer puma version to the rails 5.1, he had to use the older version of puma to make it work. |
Especially prevents from comfortable SOA development, as you can't start different services at the same time and test the interactions between them.
Steps to reproduce
config/puma.rb
to:port ENV.fetch("PORT") { 3010 }
.$ rails s
.Expected behavior
Puma server should run on port
3010
.Actual behavior
Listening on tcp://localhost:3000
Puma server runs on port
3000
instead of3010
.System configuration
Rails version:
5.0.0.beta3
Ruby version:
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
The text was updated successfully, but these errors were encountered: