简体   繁体   English

自动部署到Azure

[英]Automated deployment to Azure

I am investigating ways to automate deployment of a specific build of a product to a specific Azure Cloud Service or VM. 我正在研究将产品的特定内部版本自动部署到特定的Azure云服务或VM的方法。

The following steps would be automated, with as little manual intervention as possible: 以下步骤将自动执行,并尽可能减少手动干预:

  • Create a Cloud Service or VM 创建云服务或虚拟机
  • Install a specific build of the product (as a standalone exe or Windows service, not IIS ) 安装产品的特定内部版本(作为独立的exe或Windows服务, 而不是IIS
  • Tweak the configuration files(s) 调整配置文件
  • Set up user account(s) 设置用户帐户
  • Run the exe/service 运行exe /服务

The code is currently in Visual Studio Online / TFS. 该代码当前在Visual Studio Online / TFS中。 We have Cruise Control .NET CI set up and we are looking at moving to TeamCity. 我们已经建立了Cruise Control .NET CI,我们正在考虑迁移到TeamCity。 This will be used for the usual QA & Production type environments, but also for ad-hoc deployment eg if a trial feature has been added to the product and we want to deploy that to a new VM for a specific customer to play around with. 这将用于通常的质量检查和生产类型的环境, 也可用于临时部署,例如,如果已将试用功能添加到产品中,并且我们希望将其部署到新的VM中,以供特定客户使用。 Ideally we would be able to use the command line or a UI to pick the build, create the VM and specify any configuration changes. 理想情况下,我们将能够使用命令行或UI来选择构建,创建VM并指定任何配置更改。

One possible solution might be Octopus Deploy although I don't think this would be able to actually create an Azure VM. 一种可能的解决方案可能是Octopus Deploy,尽管我认为这无法真正创建Azure VM。 I will probably also look at the Azure API, and also TFS deploy. 我可能还会看一下Azure API,以及TFS部署。

Basically is this feasible, and are there any proven alternatives that I'm missing, in order to narrow down my research? 基本上这是可行的,为了缩小我的研究范围,我是否缺少任何经过验证的替代方案?

Thanks in advance! 提前致谢!

While Octopus Deploy can do many things, in this particular scenario of yours, you're asking it to do three types of work - release management, automated provisioning and configuration management. 尽管Octopus Deploy可以做很多事情,但是在您的这种特定情况下,您要求它执行三种类型的工作-版本管理,自动配置和配置管理。 It's a fine line between automation awesomeness and a really sticky situation. 这是自动化出色与真正棘手的情况之间的一条很好的界限。

Of the tasks you're asking, almost all of them can be done within Octopus today. 在您要求的任务中,几乎所有任务都可以在八达通内完成。 I'd argue that it may be possible to Create a cloud service or VM. 我认为可能可以创建云服务或VM。 If there's some PowerShell cmdlet/library that allows you to spin up VMs with authentication, odds are you can do it Octopus - but it may not be the right tool to do that job today. 如果有一些PowerShell cmdlet /库允许您通过身份验证启动虚拟机,那么您很有可能可以使用 Octopus-但它可能不是当今完成此工作的正确工具。 Why? 为什么?

In my opinion, it distorts the barrier between Developers, DevOps and SysAdmins. 我认为,这扭曲了Developers,DevOps和SysAdmins之间的障碍。 Whether you use Chef, Puppet, Salt, etc. whatever configuration management you have, that needs a whole layer of users with the expertise to back it up - often said expertise of system which the very developers who want such flexibility may not have. 无论您使用Chef,Puppet,Salt等任何配置管理工具,都需要一整层用户来支持它的专业知识-通常说的系统专业知识可能是那些想要这种灵活性的开发人员所没有的。 Secondly, right now this isn't a focus within Octopus (yet). 其次,目前这不是章鱼的重点(尚未)。 I'd be hard pressed to say whether to use a tool such as Octopus on what it can do vs what it should do or not. 我很难说是否要使用Octopus之类的工具来决定它可以做什么与不应该做什么。

It's really nice that Azure now has support for preinstalling the Octopus tentacle for VMs. Azure现在支持预安装 VM 的Octopus触手 ,真是太好了。 But that requires additional info such as, the Server thumbprint, port other supplementary configuration info in order to automate vm provisioning. 但这需要其他信息,例如服务器指纹,端口其他补充配置信息,以自动进行虚拟机配置。 That configuration management - should it be under Octopus's control, or something like Chef or Puppet? 那种配置管理-应该在八达通的控制之下,还是像Chef或Puppet之类的东西? I honestly don't have an answer to this but my feeling as of now is not Octopus. 老实说,我没有答案,但是到目前为止我的感觉不是八达通。 Someday, perhaps, but until this is really ready and fully tested and vetted, I'd wait it out (a little) at least with Octopus. 也许有一天,但是直到这一切准备好并且经过全面测试和审查,我至少会等到章鱼(一点点)之后再等一下。

If you're the adventurous type, then by all means try out Octopus. 如果您是喜欢冒险的类型,那么一定要尝试一下章鱼。 I may do a PoC (proof of concept) of this infrastructure automation later this year, but to rely on it today for business/production usage as the primary means of infrastructure automation will be risky and require a lot of work and experimentation. 我可能会在今年晚些时候对该基础设施自动化进行PoC(概念验证),但是今天依靠它来进行业务/生产使用,因为基础设施自动化的主要手段将存在风险,并且需要大量工作和试验。 Again, I'm not saying it cannot be done, I'm questioning whether it should be done within Octopus as of this response today. 再说一次,我并不是说它不能完成,我是在质疑今天是否应该在章鱼内完成它。

If anything, from the Octopus Deploy side of things is this feasible? 如果有的话,从Octopus Deploy的角度来看这可行吗? Yes - it just hasn't quite been worked out yet. 是的-尚未完全解决。 Looking at what you want to do, I'd say it's a two-phase process: 1. spinning up the new VM, attaching the tentacle to the environment and 2. running the deployment process on that new VM. 看您想做什么,我会说这是一个分为两个阶段的过程:1.旋转新VM,将触手连接到环境,并2.在该新VM上运行部署过程。

I'd also recommend checking out the Octopus blog. 我还建议您查看八达通博客。 They're publicly talking about infrastructure automation. 他们公开谈论基础设施自动化。 You can read about it here: http://octopusdeploy.com/blog/rfc-cloud-and-infrastructure-automation-support 您可以在此处阅读有关内容: http : //octopusdeploy.com/blog/rfc-cloud-and-infrastructure-automation-support

I hope this response helps in some way. 我希望这个回应可以有所帮助。

The solution to the automated deployment in Azure is use ElasticBox. Azure中自动部署的解决方案是使用ElasticBox。

I will skip the details of all the configuration options for Azure supported by ElasticBox, as they are detailed in the documentation section: http://elasticbox.com/documentation/deploying-and-managing-instances/using-azure/ . 我将跳过ElasticBox支持的Azure的所有配置选项的详细信息,如文档部分所述: http ://elasticbox.com/documentation/deploying-and-managing-instances/using-azure/。

You only need to create a box (abstraction unit that ElasticBox uses to define the installation and configuration of the deployment of a service or application in any cloud) that takes care of the steps you need to be automated. 您只需要创建一个盒子(用于抽象化单元来定义任何云中服务或应用程序的部署的安装和配置的抽象单元)即可处理您需要自动化的步骤。 So finally you will deploy the vm with near no manual intervention, just one click or a command with some parameters. 因此,最后您几乎无需手动干预即可部署虚拟机,只需单击一下或使用带有某些参数的命令即可。

A box includes the variables necessary for your deployment and your scripts (In this case probably PowerShell, but they could be bash, python, perl, java, etc.) 一个框包含部署和脚本所需的变量(在这种情况下,可能是PowerShell,但可以是bash,python,perl,java等)。

When you deploy the box you create to deploy your application, ElasticBox will: 部署创建的框以部署应用程序时,ElasticBox将:

  • Create a Cloud Service or VM. 创建云服务或VM。 (ElasticBox takes care of provision the vm in your Azure provider, or any of your preferred cloud provider). (ElasticBox负责在您的Azure提供程序或任何首选的云提供程序中配置虚拟机)。

  • Install a specific build of the product (as a standalone exe or Windows service, not IIS) -> This should be your install event script. 安装特定版本的产品(作为独立的exe或Windows服务,而不是IIS) ->这应该是您的安装事件脚本。

  • Tweak the configuration files(s) -> This should be part of your configure event script. 调整配置文件->这应该是配置事件脚本的一部分。

  • Set up user account(s) -> This should be part of your configure event script. 设置用户帐户->这应该是配置事件脚本的一部分。

  • Run the exe/service -> This should be part of your start event script. 运行exe / service- >这应该是您的启动事件脚本的一部分。

ElasticBox has a command line tool that enables to do VM deployments of your boxes and also you can manage your deployed vms with it: https://pypi.python.org/pypi/ebcli ElasticBox有一个命令行工具,可用于对您的机器进行VM部署,您还可以使用它来管理已部署的vm: https//pypi.python.org/pypi/ebcli

It also support automatic termination of the vm after a custom time value. 它还支持在自定义时间值后自动终止虚拟机。

This is quite a broad question, but certainly the goal is achieveable via one of a number of methods. 这是一个相当广泛的问题,但是肯定可以通过多种方法之一实现目标。 While a bit old, Tom Hollander's blog on automated deployments is a good starting place. 虽然有点老,但Tom Hollander的有关自动部署的博客是一个很好的起点。 I've seen a lot of OctopusDeploy used as well as TeamCity but they all ultimately rely on Azure's PowerShell Cmdlets , Management Libraries in custom code or pure REST API calls. 我已经看到了很多OctopusDeploy和TeamCity被使用,但是它们最终都依赖于Azure的PowerShell Cmdlet ,自定义代码或纯REST API调用中的管理库

Just an FYI; 仅供参考; One option is to do everything by using the Azure Management API. 一种选择是使用Azure管理API进行所有操作。 I also like to reference the Azure Client Libraries in a VS project and do everything is C# code. 我还想在VS项目中引用Azure客户端库,并且所有操作都是C#代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM