You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.6 KiB

10 months ago
7 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
7 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. # This configuration file will be evaluated by Puma. The top-level methods that
  2. # are invoked here are part of Puma's configuration DSL. For more information
  3. # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
  4. # Puma can serve each request in a thread from an internal thread pool.
  5. # The `threads` method setting takes two numbers: a minimum and maximum.
  6. # Any libraries that use thread pools should be configured to match
  7. # the maximum value specified for Puma. Default is set to 5 threads for minimum
  8. # and maximum; this matches the default thread size of Active Record.
  9. max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5)
  10. min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
  11. threads min_threads_count, max_threads_count
  12. # Specifies that the worker count should equal the number of processors in production.
  13. if ENV['RAILS_ENV'] == 'production'
  14. require 'concurrent-ruby'
  15. worker_count = Integer(ENV.fetch('WEB_CONCURRENCY') { Concurrent.physical_processor_count })
  16. workers worker_count if worker_count > 1
  17. end
  18. # Specifies the `worker_timeout` threshold that Puma will use to wait before
  19. # terminating a worker in development environments.
  20. worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
  21. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
  22. port ENV.fetch('PORT', 3000)
  23. # Specifies the `environment` that Puma will run in.
  24. environment ENV.fetch('RAILS_ENV') { 'development' }
  25. # Specifies the `pidfile` that Puma will use.
  26. pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
  27. # Allow puma to be restarted by `bin/rails restart` command.
  28. plugin :tmp_restart