puma.rb 737 B

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