Thursday, April 29, 2010

Rails application deployment with heroku

Install git
Generate RSA public and Private keys in your system
Required Gems
Heroko
Taps - By default heroku uses postgreSQL as the database, so use this gem to convert your database from mysql to postgresql.

First create an account in heroku.com website.
Open terminal and CD to the application you want to deploy
#git init
#git add .
#git commit -m 'First submit'
Till now one empty git repository (.git) created in your local application folder and save the changes in the local repository.

#heroku create appname
It will ask you the email and password which you have already signup in heroku.com and create the appname in heroku as subdomain. i.e appname.heroku.com

#git push heroku master
This command will transfer all your files from local repo to the heroku application.

Process for Database Push and Pull
#heroku rake db:migrate
This will migrate all your local db to heroku, Make sure to maintain migrations clearly
#heroku rake db:push

Sometimes you may face many problems in db migrations, so take care of db migrations. If you face problems, just us heroku db:push without heroku rake db:migrate.

#Other commands
#heroku db:pull
to pull the db from heroku
#heroku db:open
to c all heroku commands


Repeate the above process when you change any modification to the files.

No comments: