master
 1workers Integer(ENV['WEB_CONCURRENCY'] || 2)
 2threads_count = Integer(ENV['MAX_THREADS'] || 5)
 3threads threads_count, threads_count
 4
 5rails_root = File.expand_path("../..", __FILE__)
 6
 7environment ENV['RAILS_ENV'] || "production"
 8
 9bind "unix:#{rails_root}/tmp/sockets/puma.sock"
10bind "tcp://127.0.0.1:9292"
11
12# Set master PID and state locations
13pidfile "#{rails_root}/tmp/pids/puma.pid"
14state_path "#{rails_root}/tmp/pids/puma.state"
15activate_control_app
16
17on_worker_boot do
18  require "active_record"
19  ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
20  ActiveRecord::Base.establish_connection
21end