Skip to content

Jul 25 / Rupak Ganguly

How to: Deploy application from Git repo to Heroku

Well, I am sure you have looked for a less expensive (maybe free!) Rails hosting solution. I use a solution that lets me test drive or deploy an idea I want to show to a client or a friend quickly. Anyway, the point of this article is a quick and possibly free deployment solution that does the job. It focuses on getting the application deployed rather than worry about the setup, database migrations and configuration involved at the hosting provider. I found Heroku to fit the bill perfectly. So, here is a run down on how you could try it as well.

Beyond the basic Heroku deployment scenario

I am assuming you can get up and running on the basics of Heroku by following the quick start instructions here, but I will be talking about a scenario which has a little twist. My scenario is that I have an existing app. on a remote repo (Unfuddle in my case or GitHub in your case or any other for that matter). I have my local machine setup with a clone from my remote repo. I have it all worked out and I make changes and push them to my remote repo.

Goal: I want to deploy my application “QParty” to Heroku. It is just a fun little  Follow my step-by-step directions to the goal.

1. Sync local repo to remote repo

Check to see if the local git repo is synced with remote master code repo at Unfuddle/GitHub.

Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ git push unfuddle master
Counting objects: 19, done.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (14/14), 1.21 KiB, done.
Total 14 (delta 8), reused 0 (delta 0)
To git@xxx.unfuddle.com:xxx/qparty.git
   593aae6..64d9cfb  master -> master

2. Install Heroku

The following command will install the Heroku gem if you don’t have it already.

Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ gem install heroku
Successfully installed rest-client-1.0.3
Successfully installed configuration-0.0.5
Successfully installed launchy-0.3.3
Successfully installed json-1.1.7-x86-mswin32
Successfully installed heroku-1.0
5 gems installed
Installing ri documentation for rest-client-1.0.3...
Installing ri documentation for launchy-0.3.3...
Installing ri documentation for json-1.1.7-x86-mswin32...
Installing ri documentation for heroku-1.0...
Installing RDoc documentation for rest-client-1.0.3...
Installing RDoc documentation for launchy-0.3.3...
Installing RDoc documentation for json-1.1.7-x86-mswin32...
Installing RDoc documentation for heroku-1.0...

3. Create a fresh new app at Heroku
Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ heroku create qparty
Enter your Heroku credentials.
Email: xxx@yyy.com
Password:
Uploading ssh public key C:\Users\Rupak/.ssh/id_rsa.pub
Created http://qparty.heroku.com/ | git@heroku.com:qparty.git 
Git remote heroku added

4. Push your code to Heroku and also deploy it
Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ git push heroku master
Counting objects: 13, done.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.89 KiB, done.
Total 7 (delta 6), reused 0 (delta 0)

-----> Heroku receiving push
-----> Rails app detected
       Compiled slug size is 252K

-----> Launching..... done http://qparty.heroku.com deployed to Heroku 
   64d9cfb..bfed5c3  master -> master
5. Check to see if your app is deployed at Heroku
Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ heroku list
favlist
qparty

Yeah, it is listed. Now, test the app at http://qparty.heroku.com in your favorite browser.

qparty

By the way, if you like to see some more information about your app at Heroku, do the following:

Rupak@RG4WIX /c/MyStuff/SvnCode/GitRepo/qparty
$ heroku info
=== qparty
Web URL:        http://qparty.heroku.com/ 
Git Repo:       git@heroku.com:qparty.git
Repo size:      484k
Slug size:      248k
Data size:      0K in 0 table
Owner:          xxx@yyy.com

That’s it. You have connected to your git repo, uploaded code to Heroku and deployed your application to Heroku in a snap.

One Comment

leave a comment
  1. Thomas / Aug 14 2009

    Great writeup. Found you through google. Wanted to add, in the comments section, a link to my own writeup about Heroku and what I had to do to get it working through a proxy server on Windows:

    http://regexeverything.wordpress.com/2009/07/02/heroku-through-a-proxy-server/

Leave a Comment