Wednesday, April 28, 2010

Rails application deployment with heroku

Install git
Generate RSA public and Private keys in your system
Required Gems
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 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 and create the appname in heroku as subdomain. i.e

#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.

MYD files in mysql/data/database folder are not shown in database

When you copy the database from c:/appserv/mysql/data/ folder instead export from phpmyadmin, and paste the copied database in some other system in c:/appserv/mysql/data/ folder, some times it might not work properly, it creates the database in the phpmyamdin but tables are not shown in that db. Solution for this problem is make sure the folder in c:/appserv/mysql/data/ is writeble and executable, Provide full permissions to this folder to the user who uses the phpmyadmin.

Linux SSH Error - Remote host identification changed

Hi all,
when I try to connect to my remote host through ssh, it throws an error called Remote host identification is changed, below is the process for how can we get rid of this message.

The possible reasons for getting this error are:
If os and openssh in your system is reinstalled, or os or openssh is reinstalled in remote system.
You have assigned the IP address of one system to another system and trying to ssh.
You system is dual boot with different ssh keys in both flavors of linux.
You are using an IP for load balancing and trying to ssh to the same IP.
You generated new ssh keys for your system.

When you tries to login to a remote system through ssh, then the destination hosts provides it’s keys and asked whether these keys are trusted and then those keys are added to your trusted database(known_hosts file). Whenever you tries to login again to the same system, the received keys are checked against the keys available in your file and if both matches then the next step occurs, which is authentication. But if due to any of the above given reason, the keys doesn’t match, then you will get this error and won’t be able to login.

The solution for this problem is
Just remove the old key for remote host from your system's known_hosts file, So when you try to connect through ssh it will again ask you to store the key in the known_hosts file.
Completely Remove keys from known_hosts file
To remove the old keys from the known_hosts file, we can use -R option. This option will remove all the obsolete/old keys from your file. This can be used like this:
# ssh-keygen -R
# ssh-keygen -R

The path for known_hosts file is
In linux
home/venkat(username)/.ssh folder
In windows
c:/documentes and settings/venkat