Azure:有什么方法可以为测试/生产部署不同的实例大小 [英] Azure: Is there any way to deploy different instance sizes for test/production

查看:18
本文介绍了Azure:有什么方法可以为测试/生产部署不同的实例大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个部署到两个独立托管服务的 Windows Azure 站点.一台用于测试,一台用于生产.当我们准备好推送到生产时,我们在生产服务中启动一个临时部署,推送到那里,然后进行 VIP 交换.一切都很好.

问题是,现在我们想从 XS Web 实例升级,但是在测试部署上花费额外的钱真的没有意义.有没有什么办法可以用一个XS实例进行测试,然后说中型实例进行生产?我知道我可以更改每个服务配置的实例数量,但我只能更改所有配置的实例大小.

我想在配置中保留 XS,然后记得在部署到生产之前将其切换到 Medium.有什么理由让我不应该这样做吗?有没有更好的办法?

干杯!

解决方案

有几种方法可以做到这一点...更简单的方法是对 CCPROJ 文件进行一些黑客攻击":

1) 为每个与配置名称(Release/Debug/QA/UAT/etc)匹配的环境创建 CSDEF 文件的克隆:ServiceDefinition.Release.csdef、ServiceDefinition.Debug.csdef等

2) 使用记事本编辑器将这些文件手动添加到 CCPROJ 文件

3) 定义将 ServiceDefinition.$(ConfigurationName).csdef 复制到 ServiceDefintion.csdef 的预构建事件命令

瞧,现在您的 ServiceDefintion 将适应您使用的任何配置.

如果您想变得更有趣或查看更多详细信息,请查看此博客条目,它可以帮助您统一切换各种设置

http://www.paraleap.com/blog/post/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.aspx

这是一个有效的配置.请注意,其他文件被包含为无"类型而不是 ServiceDefinition 以避免多重定义错误.

 <ServiceConfiguration Include="ServiceConfiguration.Local.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Development 1.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Development 2.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Local Dev 1.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Local Dev 2.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.QA 1.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.QA 2.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Pre-Production 1.cscfg"/><ServiceConfiguration Include="ServiceConfiguration.Production.cscfg"/><ServiceDefinition Include="ServiceDefinition.csdef"/><None Include="ServiceDefinition.Local.csdef"/><None Include="ServiceDefinition.Development 1.csdef"/><None Include="ServiceDefinition.Development 2.csdef"/><None Include="ServiceDefinition.Local Dev 1.csdef"/><None Include="ServiceDefinition.Local Dev 2.csdef"/><None Include="ServiceDefinition.QA 1.csdef"/><None Include="ServiceDefinition.QA 2.csdef"/><None Include="ServiceDefinition.Pre-Production 1.csdef"/><None Include="ServiceDefinition.Production.csdef"/></项目组>

I have a Windows Azure site which is deployed to two separate hosted services. One for test, one for production. When we're ready to push to production, we spin up a staging deployment in the production service, push there, then do a VIP swap. All good.

The question is, now we want to move up from XS web instances, but it doesn't really make sense to spend the extra money on the test deployment. Is there any way to use an XS instance for test, and then say medium instances for production? I know I can change the number of instances for each service config, but I can only change the instance size for all configs.

I'm thinking of just leaving it XS in the config, and then remembering to switch it to Medium before I deploy to production. Is there any reason why I shouldn't do this? Is there a better way?

Cheers!

解决方案

There are a few ways to do this... Simpler way is to do a little "hacking" of the CCPROJ file:

1) create a clone of the CSDEF file for every environment that matches the Configuration Name (Release/Debug/QA/UAT/etc): ServiceDefinition.Release.csdef, ServiceDefinition.Debug.csdef, etc.

2) Add those files manually to the CCPROJ file by using a notepad editor

3) Define a Pre-Build Event command that copies the ServiceDefinition.$(ConfigurationName).csdef into ServiceDefintion.csdef

voila, now your ServiceDefintion will adapt to whatever configuration you're using.

If you want to get fancier or see more details, check out this blog entry that can help you switch all sorts of settings in unison

http://www.paraleap.com/blog/post/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.aspx

Edit: Here is a config that works. Notice that other files are included as type "None" instead of ServiceDefinition to avoid the multiple definitions error.

  <ItemGroup>
    <ServiceConfiguration Include="ServiceConfiguration.Local.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Development 1.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Development 2.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Local Dev 1.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Local Dev 2.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.QA 1.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.QA 2.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Pre-Production 1.cscfg" />
    <ServiceConfiguration Include="ServiceConfiguration.Production.cscfg" />
    <ServiceDefinition Include="ServiceDefinition.csdef" />
    <None Include="ServiceDefinition.Local.csdef" />
    <None Include="ServiceDefinition.Development 1.csdef" />
    <None Include="ServiceDefinition.Development 2.csdef" />
    <None Include="ServiceDefinition.Local Dev 1.csdef" />
    <None Include="ServiceDefinition.Local Dev 2.csdef" />
    <None Include="ServiceDefinition.QA 1.csdef" />
    <None Include="ServiceDefinition.QA 2.csdef" />
    <None Include="ServiceDefinition.Pre-Production 1.csdef" />
    <None Include="ServiceDefinition.Production.csdef" />
  </ItemGroup>

这篇关于Azure:有什么方法可以为测试/生产部署不同的实例大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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