分期或生产实例? [英] Staging or Production Instance?

查看:162
本文介绍了分期或生产实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有在服务运行时会告诉我,如果我目前临时或生产跑哪儿了吗?手动修改配置,并从生产似乎有点麻烦。

Is there anywhere in the service runtime that would tell me if I'm currently running on 'Staging' or 'Production'? Manually modifying the config to and from production seems a bit cumbersome.

推荐答案

当你根据,如果你在正式版或分期你真的应该不会改变你的配置。生产部署之前临时区域的目的不是要成为一个QA的环境中,但只有保持区域。

You should really not change your configurations when you're based upon if you're in Prod or Staging. Staging area is not designed to be a "QA" environment but only a holding-area before production is deployed.

当您上传新的部署,目前在那里你上传你的包被破坏,是停机10-15分钟,而虚拟机的上传和开始发生部署插槽。如果上传直接进入生产,这是15分钟停工停产。因此,暂存区域被发明:您上传到登台,测试的东西,然后单击交换按钮,您的临时环境奇迹般地变成生产(虚拟IP交换)。
因此,您的分期确实应该是100%相同的生产。

When you upload a new deployment, current deployment slot where you upload your package to is destroyed and is down for 10-15minutes while upload and start of VM's is happening. If you upload straight into production, that's 15 minutes of production downtime. Thus, Staging area was invented: you upload to staging, test the stuff, and click "Swap" button and your Staging environment magically becomes Production (virtual IP swap). Thus, your staging should really be 100% the same as your production.

我想你要找的是QA /测试环境?你应该开辟测试环境的新服务有自己的正式版/舞台。在这种情况下,你会想维护多个配置文件集,每部署环境一组(生产,检测等)

What I think you're looking for is QA/testing environment? You should open up a new service for Testing environment with its own Prod/Staging. In this case, you will want to maintain multiple configuration file sets, one set per deployment environment (Production, Testing, etc.)

有管理发生这种情况,特别是有关于.config文件,自有* .cscfg文件顶部Azure的配置地狱很多方面。我preFER与A​​zure项目做到这一点的方法如下:
安装一个小的配置项目中,有创建文件夹,那场比赛的部署类型。在每个文件夹设置组的* .config&放大器; *匹配特定的部署环境.cscfg文件:在Visual Studio调试,测试,发布......这些都是设置为好,因为构建目标类型。我的配置项目的每一个编译过程中出现小的xcopy命令,从配置项目构建目标文件夹中的所有文件拷贝到Config项目的根文件夹。

There are many ways to manage configuration-hell that occurs, especially with Azure that has on top of .config files, its own *.cscfg files. The way I prefer to do it with Azure project is as follows: Setup a small Config project, create folders there that match Deployment types. Inside each folder setup sets of *.config & *.cscfg files that match to particular deployment environment: Debug, Test, Release... these are setup in Visual Studio as well , as build target types. I have a small xcopy command that occurs during every compile of the Config project that copies all the files from Build Target folder of Config project into root folder of the Config project.

然后在解决所有其他项目,链接从配置项目的根文件夹中的.config或.cscfg文件。

Then every other project in the solution, LINKS to the .config or .cscfg file from the root folder of the Config project.

瞧,我CONFIGS神奇地适应每一个构建配置自动。我也用的.config变换来管理发行与非发布版本的目标调试信息。

Voila, my configs magically adapt to every build configuration automatically. I also use .config transformations to manage debugging information for Release vs. non-Release build targets.

如果你读过这一切,仍然希望得到在生产与暂存状态在运行时,然后:
获取 deploymentId RoleEnvironment.DeploymentId
然后使用管理API以适当的 X509证书来获得你的服务的 Azure的结构并调用 GetDeployments 方法(它的REST API,但有一个抽象库)。

If you've read all this and still want to get at the Production vs. Staging status at runtime, then: Get deploymentId from RoleEnvironment.DeploymentId Then use Management API with a proper X509 certificate to get at the Azure structure of your Service and call the GetDeployments method (it's rest api but there is an abstraction library).

希望这有助于

编辑:根据要求有关配置字符串的设置和环境之间切换的博客文章@ <一个href=\"http://www.paraleap.com/blog/post/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.aspx\">http://www.paraleap.com/blog/post/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.aspx

blog post as requested about the setup of configuration strings and switching between environments @ http://www.paraleap.com/blog/post/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.aspx

这篇关于分期或生产实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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