Heroku, Thin and everything in between
Asked Answered
L

2

10

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?

Lille answered 24/12, 2011 at 16:16 Comment(2)
To use thin only in production you will need declare this in Gemfile group :production do; gem 'thin'; end and put this into Procfile: web: bundle exec rails server thin -p $PORT as described in devcenter.heroku.com/articles/rails3Barimah
Heroku recommends Unicorn for production apps nowHyperesthesia
S
30

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.

Situated answered 26/12, 2011 at 5:29 Comment(1)
I'm doing the exact same thing, with Rails 3.2.21, but it says: bundler: failed to load command: thin (/app/vendor/bundle/ruby/2.2.0/bin/thin)Comprehension
B
0

In order to skip installation of thin gem on your local machine, call bundler like this:

bundle install --without production
Beggs answered 3/7, 2013 at 22:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.