I am able to run a puma server in rails using either rails s puma
or just puma
.
According to this answer, running rails s puma
makes the server aware of the rails environment. It shows server errors etc that running puma
alone does not.
I want to set a config file like so:
config/puma.rb
workers Integer(ENV['PUMA_WORKERS'] || 3)
threads Integer(ENV['MIN_THREADS'] || 1), Integer(ENV['MAX_THREADS'] || 16)
rackup DefaultRackup
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'
...
If I run puma -C config/puma.rb
everything works. However if I run rails s puma
I can't work out how to give options to puma. I have tried the following:
rails s puma # Puma server works but no config file is passed in.
rails s puma -C config/puma.rb # Invalid option -C
rails s puma -c config/puma.rb # Undefined method 'workers'. So rails is
# trying to use the config instead of puma?
I have also tried putting the config file at config/puma/development.rb
as per the puma docs.
Appreciate any help on this :)
It is not possible to use rails s puma
to load your puma configuration file, as confirmed here https://github.com/puma/puma/issues/512, you might want to take a look at a similar question here How do I get 'puma' to start, automatically, when I run `rails server` (like Thin does) where this is discussed