r-pay-ō.com

Rails – Getting your rails application deployed on Heroku

So I’m creating another application for my portfolio that will be a tracking tool for sales professionals. In several previous positions I’ve been in charge of sales teams or even entire divisions. Part of being a good manager/director is helping the representatives with their cold calls. One of the most basic ways to help sales reps stay productive and profitable is to track call volume (how many calls they make each day). Another basic metric worth tracking is call time (how long they actually talk to each person they’re calling each day). Now when call time is low, call volume needs to be high (if you’re not talking for very long you have time to make more calls) and vice-versa. Another metric I used to track personally (before I was managing anyone and I was tracking my activity just for myself) was how many calls I made where we talked for at least x amount of time. When I was a freight broker that number used to be 4 minutes. The belief at the time was that if you could keep someone talking for 4 minutes, than you could reasonably determine if they really had no need for your service or if they were just trying to get you off of the line.

The application I’m currently building is a tool for sales managers and representatives accurately track the above metrics and then see where they need to improve. Now I know I’m going to host this application on heroku and today we’re going to look at how to make that happen.

Get the database ready

So if we were preparing for heroku from the beginning we could just create our rails application with the following command:

command line
$ rails new myapp --database=postgresql

But I’ve already created my application in Cloud9 (plus I just enjoy this order of operations more) so we’ll have to retrofit it. First we’ll have to add a couple of gems to our production environment:

Gemfile
group :production do
gem 'pg'
gem 'rails_12factor'
end

We also need to move our sqlite3 gem from the main area to just our development environment so that it will look like this:

Gemfile
group :development, :test do
gem 'byebug'
gem 'sqlite3'
end

And then we’ll install the gems with:

Command Line
$ bundle install

Now we just need to commit all of our changes to our github repository: