运行 不同的 rails webserver 根据选择

Running different rails webserver as per choice

现在默认情况下每当我 运行 rails s 它开始 rails with puma

我希望能够在我的开发环境中 运行 webrick,因为使用 byebug 调试时 puma 不能正常工作

# Gemfile
gem 'puma'

# config/puma.rb
workers Integer(ENV['WEB_CONCURRENCY'] || 2)

threads_count = Integer(ENV['MAX_THREADS'] || 5)

threads threads_count, threads_count

preload_app!

rackup      DefaultRackup

port        ENV['PORT']     || 3000

environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  ActiveRecord::Base.establish_connection
end

您可以通过将 puma gem 仅限于生产环境(如果适合您的需要也可以进行测试)来实现此目的。

# Gemfile
group :test, :production do
  gem 'puma'
end

然后 运行 bundle install --without test production.