Files
grecia/config/puma/defaults.rb
Javi Martín 69be13f7a7 Keep default puma settings in the test environment
The test environment was using the file in `config/puma.rb`, meaning it
wouldn't work with Rails 5.1, which uses a different setup for Puma.

I've decided to create a new file called `defaults.rb`, which will be
used in every environment but development and test. We could also add an
empty file in `config/puma/test.rb`; I think that's less intuitive, but
it's a subjective opinion.
2019-11-19 21:33:22 +01:00

38 lines
760 B
Ruby

#!/usr/bin/env puma
rails_root = File.expand_path("../../..", __FILE__)
directory rails_root
rackup "#{rails_root}/config.ru"
tag ""
pidfile "#{rails_root}/tmp/pids/puma.pid"
state_path "#{rails_root}/tmp/pids/puma.state"
stdout_redirect "#{rails_root}/log/puma_access.log", "#{rails_root}/log/puma_error.log", true
bind "unix://#{rails_root}/tmp/sockets/puma.sock"
daemonize
threads 0, 16
workers 2
preload_app!
restart_command "bundle exec --keep-file-descriptors puma"
plugin :tmp_restart
on_restart do
puts "Refreshing Gemfile"
ENV["BUNDLE_GEMFILE"] = ""
end
before_fork do
ActiveRecord::Base.connection_pool.disconnect!
end
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end