I'm executing the following puma configuration
threads_count = Integer(ENV["DB_POOL"] || ENV["MAX_THREADS"] || 15)
threads threads_count, threads_count
workers 3
preload_app!
rackup DefaultRackup
port ENV["PORT"] || 3000
environment ENV["RACK_ENV"] || "development"
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end
before_fork do
ActiveRecord::Base.connection_pool.disconnect!
end
It works fine for production but I do not want to create 3 workers or use webrick in dev environment. If I try and wrap the worker specific code in env check, it breaks the puma DSL. Any other way I could run puma in non clustered mode in dev.