Deploying Rails Web App For Newbies

The first time I deployed my rails app, I deployed with standard Web brick server. In fact I deployed a couple of Rails apps using Web brick. It was only after listening to a podcast from Ruby Rogues I realised I needed to update my applications. During this podcast everyone made fun of Devs who deploy Rails using Web brick. I was so ashamed that I was one those Devs, so I decided to fix the problem.

Why is it not good to use Web Brick server in Production?

Well Web brick is more of a development server thus it is only meant to be used in development environment.

How to resolve this problem?

It’s actually simple, all you need to do is specify an alternative server in your Gemfile under your Prod settings. The server which I’m using is thin
. It’s that’s simple.
If you’re running your rails app in Heroku change your Procfile

Gemfile

group :production do
  gem 'pg'
  gem 'thin'
end

Procfile

  web: bundle exec rails server thin -p $PORT -e $RACK_ENV as

That’s it’s.

Do you have more tips and tricks to share regarding deploying Rails Web App? If you do please kindly share them in the comments section.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.