Application Deployment On Heroku

Heroku offers Ruby web developers instant deployment, fast & easy scaling, and vast tool selection. Now we can concentrate on building our applications and forget the tedious deployment and server administration tasks that used to strangle our productivity. We can deploy fast, scale quickly, and adjust to circumstance as needs arise.

This article will explain to you how to deploy your applications on the popular platform. It is cloud based application platform for easy deployment of your applications. The integration with Cloud9 IDE makes your development process even more agile.

When you use the platform for deploying your application you need to make sure of the following-

1. B y default the cloud platform will have shared database and it will be postgresql database.

2. All your migrations must be postgresql compatible.

3. Use pg gem in your application

4. You need to have suitable addons of heroku for deploying your application

Specify heroku gem in your gem file of app that you want to deploy

gem ‘heroku’

$ bundle install

SSH Key Generation:

$ ssh-keygen -t rsa

The above command will generate public key inside /home/Username/.ssh/

$ heroku accounts:add

Account name should be your heroku login


1. Initialize pg gem in your Gemfile in order to use postgresql database.

gem ‘pg’

2. Bundle install after initializing the gem

$ bundle install

3. Even though you are using SVN repository, it’s better to use git repository for deploying your applications to the cloud platform. If you are using SVN and if you would like to initialize git repository only to push updates to heroku then follow the steps below

$ git init

$ git add .

$ git commit -m “init”

This creates a local git repository where you will be adding the files which you update or add from your svn repository.

If you have to work with the cloud platform from your application you should generate ssh keys and add the public key to the heroku.

You can do it from the steps given here:

4.After adding the keys login to the cloud platform using the command below with the credentials and check whether you are able to login.

$ heroku login
Enter your Heroku credentials.
Email: [email protected]
Could not find an existing public key.
Would you like to generate one? [Yn] 
Generating new SSH public key.
Uploading ssh public key /Users/name/.ssh/

5. If you are able to login to the cloud application, then from your application folder create an application in heroku using 

ceder rack of heroku
$ heroku create –stack cedar myap

6. After creating the application you need have a remote repository and one remote git repository should be added to heroku also.

$ git remote -v
$ git remote add heroku [email protected]:myapp.
$ git init

This creates a remote repository in heroku and will be initialized with the local repository.

7. Since you will be using SVN repository you need to add this in order to ignore the .svn hidden files which comes into application after updating from repository and you can do that here by using the things below.

$ echo .svn > .gitignore
$ svn propset svn:ignore .gi

8. After executing this you need to add the files to local repository and commit them.

$ git add
$ git commit -m “using git for heroku deployment”

9. After you commit the updates to heroku repository and create the application, you can push the updates to the application with this command : 

$ git push heroku master

10. Migrate the database migrations into heroku shared database using

$ heroku run rake db:create

$ heroku run rake db:migrate

For all the commands available with heroku you can check the commands here.

Push updates to heroku ( Default Environment: production already set)

->Update code from subversion repository

$ svn update

->Check the status of the files

$ git status

->Manage the added and removed files from the git using git commands

$ git rm file # to remove the file

->Add files to local git repository

$ git add

->Push updates of code to local repository

$ git commit -m “Message”

The above command commits all the files, if you want to push only specific files into git repository then you should specify the file name after the commit.

After you commit the code to local git repository, you need to push to heroku

$ git push heroku master

This pushes the code which was updated after the last push and launches the instance on heroku server.

->To check the application logs use

$ heroku logs –tail

->To run application console use

$ heroku run console

->To check the heroku configuration of your application

$ heroku config

->To start start| stop| restart application use

$ heroku restart | stop | start

Set Your Domain Name

This command tells Heroku that your app should respond to requests to “”:

$heroku domains:add

Read More :

With ingenious solutions, progressive business values, and proven track record, RailsCarma is best suited to help you with all your development needs. Our development process is established heavily on unrelenting attention to details, including quality, design and excellence. We convert your ideas into reality. Connect to us through our Contact Us page.

Subscribe For Latest Updates

Related Posts

Leave a Comment

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