puma.rb 706 B

1234567891011121314151617181920212223242526
  1. persistent_timeout ENV.fetch('PERSISTENT_TIMEOUT') { 20 }.to_i
  2. max_threads_count = ENV.fetch('MAX_THREADS') { 5 }.to_i
  3. min_threads_count = ENV.fetch('MIN_THREADS') { max_threads_count }.to_i
  4. threads min_threads_count, max_threads_count
  5. if ENV['SOCKET']
  6. bind "unix://#{ENV['SOCKET']}"
  7. else
  8. bind "tcp://#{ENV.fetch('BIND', '127.0.0.1')}:#{ENV.fetch('PORT', 3000)}"
  9. end
  10. environment ENV.fetch('RAILS_ENV') { 'development' }
  11. workers ENV.fetch('WEB_CONCURRENCY') { 2 }.to_i
  12. preload_app!
  13. on_worker_boot do
  14. ActiveSupport.on_load(:active_record) do
  15. ActiveRecord::Base.establish_connection
  16. end
  17. end
  18. plugin :tmp_restart
  19. set_remote_address(proxy_protocol: :v1) if ENV['PROXY_PROTO_V1'] == 'true'