Search code examples
ruby-on-rails-3herokuthinwebrick

Heroku, Thin and everything in between


Looking at the logs, my cedar app currently runs webrick. Obviously, this is not the best choice for production app.

As noted all over the web, I should use Thin webserver.

But I would still like to use the simplicty of webrick on my development machine (windows).

As noted in the comments on Heroku cedar stack, thin and eventmachine the version that can be installed on windows for eventmachine (I also need some explanation on that gem) is 1.0.0.beta4 and heroku doesn't like that..

  1. How do I install thin (and eventmachine I guess) only on heroku and keep webrick for all my localhost needs?

  2. What is eventmachine and why do I need it?

  3. Is there a way to explicitly tell heroku to ignore what I want and use thin?


Solution

  • In your Gemfile, create or change the production group to include thin:

    group :production do
      gem 'thin'  
    end
    

    Then, in your Procfile (a file named Procfile placed in the root of your app), tell Heroku you want to use thin, like so:

    web: bundle exec thin start -p $PORT
    

    That will allow you to keep using Webrick in your local development environment while running thin in production on Heroku.