deployment - 在 Heroku 上暂存实例

标签 deployment heroku staging

我希望能够将代码推送到 dev.myapp.com 进行测试,然后推送到 www.myapp.com 进行生产使用。 Heroku 可以做到这一点吗?

最佳答案

您与 Heroku 的接口(interface)本质上是一个 Git 分支。 Heroku gem 通过其 API 完成一些工作,但在您的 Git 存储库中,它只是一个新的远程分支。

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 存储库:

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 作为我的 master。

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

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

关于deployment - 在 Heroku 上暂存实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1279787/

相关文章:

azure - 执行 Azure 网站临时交换时连接字符串被替换

WCF 服务部署 - 应用程序文件保存在哪里?

java - 如何使用 mysql 解决 Spring Boot 应用程序上的 "Communications link failure"问题?

ruby-on-rails-3 - 在 Rails、Heroku 和 Koala 中没有使用实时更新的来自 Facebook 的 POST

ruby-on-rails - Heroku带宽和空间

git - git 跟踪和 git 暂存的概念

git - 尝试设置 heroku 暂存站点 - "Resource not found "

java - 将另一个 servlet 部署到 wildfly 实例

deployment - Azure 升级域、域计数

windows - 我已经在 Windows Azure 上成功部署了 MVC3 网站,但它不起作用