Files
nairobi/config/puma.rb
Javi Martín 1e32455cd9 Add puma configuration to version control
We were using Capistrano's shared folder because it was the default
folder used by the capistrano-puma gem. However, it's easier to manage
it if it's under version control.

So we're moving the old `puma.rb` to `puma/development.rb`, and we use
the new `puma.rb` file for all environments except development. Anyone
installing CONSUL can change these files at will or change the specific
files for preproduction, production and staging environments.
2019-11-13 13:28:27 +01:00

37 lines
752 B
Ruby

#!/usr/bin/env puma
rails_root = File.expand_path("../..", __FILE__)
directory rails_root
rackup "#{rails_root}/config.ru"
environment "production"
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"
threads 0, 16
workers 2
preload_app!
restart_command "bundle exec --keep-file-descriptors puma"
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