views:

1711

answers:

2

I'd like to be able to push code to dev.myapp.com for testing and then to www.myapp.com for production use. Is this possible with Heroku?

A: 

I can't provide many details but:

Heroku can integrate with Git externally. You could deveop in dev.myapp.com. Once it is ready, checkin to the www.myapp.com Git repository and it should deploy it.

So basically, you have two Heroku instances. You use Git to create a "patch" from your dev instance and use that to update the "prod" instance.

-Dave

Dave
+24  A: 

Your interface to Heroku is essentially a Git branch. The Heroku gem does some work through their API, but within your Git repository, it's just a new remote branch.

heroku create yourapp # production
git br -D heroku # delete the default branch

heroku create staging-yourapp # staging
git br -D heroku # delete the default branch

Once you set up multiple applications on Heroku, you should be able to configure your Git repository like this:

git remote add staging [email protected]:staging-yourapp.git
git push origin staging

git remote add production [email protected]:yourapp.git
git push origin production

I usually work in a 'working' branch, and use Github for my master.

Assuming that's the case for you, your deploy workflow would probably look something like:

git co -b working
# do some work

# push to github:
git co master
git merge working
git push

# push to staging:
git co staging
git merge master
git push origin staging

# push to production
git co production
git merge master
git push origin production
Luke Bayes
Thanks -- this makes some sense (I suck at git). Question: Suppose I'm working on some cutting-edge changes on branch "edge". How can I push that branch to staging-myapp without affecting myapp (which currently is running on the master branch)? Does `git push staging edge work`?
Horace Loeb
I think you might want to post this as a new question Horace...
Luke Bayes
In the interest of getting you going, you would just merge edge to your staging branch and push it. Your production branch is separate and clean. You can always branch it and make changes that only merge back there.
Luke Bayes