如何在Rails 3中将Thin设置为默认值

deb*_*deb 34 ruby ruby-on-rails thin webrick ruby-on-rails-3

我一直thin -V start在开发Thin .

但是,我希望Thin是默认值而不是WEBrick,并且能够启动它rails s.

有没有办法在Rails 3中将Thin设置为默认值而不是WEBrick?

如果那是不可能的,那么至少有一种方法可以自动在测试环境中启动它吗?

Tsu*_*omu 46

我在机架的Github存储库上发送了一个pull请求,它被接受了:https: //github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7

在不久的将来,我们将能够使用Thin只需添加gem 'thin'到我们的Gemfile并启动应用程序rails s.

但请注意,这可能是一种临时措施.

我之所以选择Thin,是因为目前没有维护Mongrel,也没有其他服务器可以替代Mongrel.

  • 从昨天发布的Rails 3.2.0.rc2开始,当你的Gemfile有'gem'thin'`行时,`rails s`调用Thin.Yey! (15认同)

zai*_*ste 14

或者你可以使用foreman,特别是如果你的web应用程序运行起来更复杂(后台工作人员,处理调度的时钟进程等)

瘦身为例,您需要Procfile在Rails应用程序中创建一个包含以下内容的应用程序:

web: bundle exec rails server thin -p $PORT
Run Code Online (Sandbox Code Playgroud)

然后就是:

foreman start
Run Code Online (Sandbox Code Playgroud)

启动你的服务器.


epo*_*olf 8

您可以使用thin运行rails3 rails server thin

有关rails server -h更多选项,请参阅输出.