Tuesday, July 20, 2010

(QA) Testing, Staging and Production environments are now available with Heroku

Hi There,
Deploying application in multiple environements is a better approach for a successfull appliation. This is the default behaviour of the rails application to maintain deployment in development, testing and production environments. Development and testing versions are live on developer's local system and production environement lives on actual server.
Now heroku offers us to maintain the application with these three evnironments in live server withing heroku so that clients and your colleagues can provide feedback and suggestions on your application before pushing them to production.

Ex: If you want to deploy an application called "myapp" in Heroku. First create the production,staging and testing(QA) versions of the application, should use --remote option to override the defaults for the git repository names.

$ heroku create myapp-production --remote production
$ heroku create myapp-staging --remote staging
$ heroku create myapp-qa --remote qa

Now, if you want to deploy code to a particular environemt, do so by specifying the appropriate option
Ex:
$ git push staging master

and if you need to run db migrations use below

$ heroku rake db:migrate --remote staging
Finally, If you probably want to periodically copy your production data into your staging environment:

$ heroku db:pull --remote production

$ heroku db:push --remote staging

Now, when you want to deploy code to a particular environment, do so by specifying the appropriate remote:

$ git push staging master

And if you need to run migrations:

$ heroku rake db:migrate --remote staging

Finally, you will probably want to periodically copy your production data into your staging environment:

$ heroku db:pull --remote production

$ heroku db:push --remote staging

Note: Keep in mind that any environment variables you create or add-ons you add must be duplicated across environments for a consistent experience. For example, if you begin using memcache on your staging app, be sure to install it on your production app before you deploy your new code.

For more details
http://jqr.github.com/2009/04/25/deploying-multiple-environments-on-heroku.html
http://stackoverflow.com/questions/1279787/staging-instance-on-heroku

No comments: