tuddy
tuddy

Reputation: 1834

Rails3 & Git & Heroku - development/staging server

I have a Rails 3 app I'm developing with a team using Git/Github and deploying to a Heroku cedar stack. Our Github respository has 2 main branches Master and Development.

I would like to push our Development branch regularly to a different server on Heroku as a development/staging environment.

What's the cleanest simplest way to push our Development branch to a different app than Master without disrupting our Git flow much?

Thanks a lot!

Upvotes: 4

Views: 1238

Answers (3)

John Beynon
John Beynon

Reputation: 37507

You'll want to add a second git remote i.e. your second application's heroku git repo url to your app to be able to push to that from a single codebase.

At the moment you probably have the default remote origin named 'heroku' which is pushing to your production application.

You'll want to add a second remote origin pointing at your new heroku app that you intend to use for staging, eg

git remote add staging <git repo url from 'my apps' page on heroku>

once you have the new git origin set up you can push to it via;

git push staging <branch to deploy>:master

Upvotes: 7

Douglas F Shearer
Douglas F Shearer

Reputation: 26488

heroku_san is a Gem which allows complex deploy configurations when using Heroku, without the need to constantly specify which Heroku app you wish to push to on the command line. It would allow you to do exactly what you describe above.

Upvotes: 0

Neil Middleton
Neil Middleton

Reputation: 22238

Simple. Heroku always uses the master branch, but using Git will allow you to push /your/ development branch, to /their/ master

For instance:

git push heroku development:master

where heroku is your origin for your heroku development env, and development is your local development branch. You might also want to override the RACK_ENV var on Heroku too if you don't want your dev branch running in production mode (although, personally I would create a staging environment in your code which does caching etc, but not send email to production addresses etc)

Upvotes: 1

Related Questions