Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Thin as default in Rails 3

I've been starting Thin with thin -V start in development.

However, I would like Thin to be the default instead of WEBrick and to be able to start it with rails s.

Is there a way to set Thin as the default instead of WEBrick in Rails 3?

If that's not possible, is there at least a way to start it in the test environment automatically?

like image 752
deb Avatar asked Aug 12 '11 23:08

deb


2 Answers

I sent a pull request on the Github repository of rack and it was accepted: https://github.com/rack/rack/commit/b487f02b13f42c5933aa42193ed4e1c0b90382d7

In a near future, we will be able to use Thin just by adding gem 'thin' to our Gemfile and starting app with rails s.

Note that this may be a temporary measure, however.

I chose Thin because Mongrel was not maintained currently and no other server seemed to suit as an alternative to Mongrel.

like image 138
Tsutomu Avatar answered Sep 21 '22 13:09

Tsutomu


Alternatively you could use foreman, especially if your web applications tend to get more complicated to run (background workers, clock processes to handle scheduling, etc.)

Taking thin as an example, you would need to create a Procfile in your Rails app with the following content:

web: bundle exec rails server thin -p $PORT 

Then just:

foreman start 

to start your server.

like image 21
zaiste Avatar answered Sep 25 '22 13:09

zaiste