rails: Rails 5 - Puma default port does not take effect
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
- Create new rails project (normal or api).
- Change a line in
config/puma.rb
to:port ENV.fetch("PORT") { 3010 }
. - Run
$ 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 of 3010
.
System configuration
Rails version: 5.0.0.beta3
Ruby version: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 6
- Comments: 33 (25 by maintainers)
Commits related to this issue
- Puma port config doesn't work yet. See https://github.com/rails/rails/issues/24435 — committed to jmuheim/base by jmuheim 7 years ago
- [close #24435] Send user_supplied_options to server Currently when Puma gets a `:Port` it doesn't know if it is Rails' default port or if it is one that is specified by a user. Because of this it ass... — committed to schneems/rails by schneems 7 years ago
- Merge pull request #28137 from schneems/schneems/fix-default-puma-port [close #24435] Send user_supplied_options to server — committed to rails/rails by schneems 7 years ago
This works for me
Are you using Puma 3.0 or above?
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
config/boot.rb
), the port can be changed for the app.This was fixed with Puma v3.7.1, please upgrade!!
These are a issue of Puma. Ref: https://github.com/puma/puma/issues/1200
Actually I can set the port via
PORT
environment variable, but it fails it I userails s -p 3001
.Wow. This is going deeper than I thought.
@prathamesh-sonpatki that will not work.
config/puma.rb
will blow away on the rack config option.Hence I mentioned we need to parse the
config/puma.rb
if present and actually pass port to puma via rack option, which is what I had worked on to support.Again, we need to consider if we need to treat puma as a special case. Either way just passing puma config via
-c
is a bad option as that will have side effects on rack.