Heroku 上的暂存实例 [英] Staging instance on Heroku

查看:35
本文介绍了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 gem 通过其 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.

假设您是这种情况,您的部署工作流程可能类似于:

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天全站免登陆