Heroku分期实例 [英] Staging instance on Heroku

查看:102
本文介绍了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

我通常在一个工作部门工作,并使用Gi​​thub作为我的主人。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆