Heroku分期实例 [英] Staging instance on Heroku
问题描述
我想将代码推送到 dev.myapp.com
进行测试,然后到 www.myapp.com
用于生产使用。这是可能与Heroku吗?
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?
推荐答案
您对Heroku的界面本质上是一个Git分支。 Heroku宝石通过他们的API做了一些工作,但在你的Git仓库里,它只是一个新的远程分支。
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
一旦您在Heroku上设置了多个应用程序,您应该可以像这样配置您的Git仓库:
Once you set up multiple applications on Heroku, you should be able to configure your Git repository like this:
git remote add staging git@heroku.com:staging-yourapp.git
git push origin staging
git remote add production git@heroku.com:yourapp.git
git push origin production
我通常在一个工作部门工作,并使用Github作为我的主人。
I usually work in a 'working' branch, and use Github for my master.
假设您的情况,您的部署工作流程可能看起来像: p>
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
这篇关于Heroku分期实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!