Deploying a Rails app on Heroku (paperclip, gems, yml)

I just moved my PlaygroundsRUs site from AWS to Heroku, and I couldn’t be happier. My first full month bill from Amazon was about $75, and $74 of that (99% of the total cost) was for running an instance. Harlan told me about Heroku after he deployed his ForkThis demo on there.

Most of the transition was smooth, but there were a few hiccups on the way. One of them still hasn’t been resolved (one of the plugins is having conflict with PostgresSQL, which is used by Heroku). I will enumerate what I had to go through so that it might be easier for you.

1. Secret YAML files

I have a public GitHub account for deploying on AWS using ec2onrails. Since it’s public and anyone can see it, I had to omit sensitive

.yml

files in config directory that contained passwords and keys. It’s easily done by specifying those files in

.gitignore

and listing them in

:nonvc_configs

in

config/deploy.rb

used by ec2onrails.

I found out that for Heroku, the same can be achieved by creating another branch, including those files, merging with master, and pushing it to Heroku. So, the following lines should do the trick.

git checkout production
[remove those yml files from .gitignore]
git merge master
git push heroku production:master

Continue reading