什么是部署使用codeDeploy和CI工具,分布式应用程序的好方法? [英] What is a good way to deploy a distributed application using CodeDeploy and a CI tool?

查看:273
本文介绍了什么是部署使用codeDeploy和CI工具,分布式应用程序的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用AWS,这似乎是一个很好的方式,将应用程序部署到一个新创建的实例是通过AWS codeDeploy。这种工作方式如下:

When using AWS, it seems a nice way to deploy an application to a newly created instance is via AWS CodeDeploy. This works as follows:

  1. 设置了一个自动缩放组应用程序
  2. 在写用户数据的bash脚本,这将把C $ cDeploy代理$从S3,安装并启动它自动缩放组
  3. 设置了其部署到自动缩放组codeDeploy部署组

现在,当一个应用程序包(如JAR或Debian包)部署到部署组时,它会自动部署到自动缩放组中启动新的实例。

Now, when an application bundle (e.g. jar or debian package) is deployed to the deployment group, it will be deployed automatically to new instances launched in the auto-scaling group.

我的问题是:怎么能这样部署策略配合与CI工具如特拉维斯CI

My question is: how can this deployment strategy fit with a CI tool like Travis CI?

具体做法是:

  • 如何codeDeploy拿起一个CI工具如特拉维斯CI建一个包?是否构建工作需要将包上传到S3?
  • 在C $ cDeploy如何$用于逐步部署应用程序(在同一时间,例如一个实例)?
  • 这是否部署战略要求每个运行实例被关闭,取而代之,或者是部署在现有的情况下,应用程序的新版本?如果是前者,机器的IP地址将在部署过程中发生变化,因此如何能其他服务发现新部署的应用程序(即没有硬codeD IP地址)?

推荐答案

TL;博士版本:

  • 在构建作业需要的软件包上传到S3。
  • 使用一次部署配置。
  • 应用程序的新版本部署在现有的实例。

好吧,这里的长版:

我建议你试试部署演练或采取的外观在概念在文档。它可以帮助你熟悉codeDeploy更快。

I recommend you try the Deployment Walkthrough or take a looks at Concepts in the documentation. It should help you get familiar with CodeDeploy faster.

您不必使用自动缩放组codeDeploy,如果你不想。 codeDeploy与自动缩放集成,您可以管理需要的大小动态地分开部署到他们的code更改车队,但是这不是要​​求使用codeDeploy。您也可以手动启动一些EC2实例,安装主机代理,然后标记它们成组的部署 - 但他们不会部署到自动上推出类似的会自动缩放实例。在这两种情况下,你可以随时创建舰队广泛的部署。

You don't have to use an AutoScaling group with CodeDeploy if you don't want to. CodeDeploy with AutoScaling integration allows you to manage fleets that need to change in size dynamically separately from the code that is deployed to them, but that is not a requirement to use CodeDeploy. You can also launch some EC2 instances manually, install the host agent, and then tag them into a deployment group - but they won't get deployed to automatically on launch like the AutoScaling instances would. In either case, you can always create fleet wide deployments.

您将不得不做一些工作,它与您的CI工具集成。 codeDeploy不直接管理你的构​​建工件,使你的构建过程将需要做的。有自动部署,你将需要:

You'll have to do some work to integrate it with your CI tool. CodeDeploy doesn't directly manage your build artifacts, so your build process will need to do that. To have automatic deployments, your will need to:

  1. 创建一个档案捆绑的 appspec.yml ,你需要处理的安装/升级任何脚本,并构建文物。
  2. 上传捆绑到S3。
  3. 创建一个部署在codeDeploy。
  1. Create a archive bundle with an appspec.yml, any scripts you need to handle the install/upgrade, and your build artifacts.
  2. Upload the bundle to S3.
  3. Create a deployment in CodeDeploy.

您可能想看看 codePipeline 作为一个连续的例子该公司的集成与codeDeploy输送系统。

You might want to look at CodePipeline as an example of a continuous delivery system that's integrated with CodeDeploy.

codeDeploy使用部署的configs来控制如何积极它部署到你的舰队中的实例。 (这个配置被忽略的自动部署,因为每个实例另案处理)codeDeploy将失败部署和停止部署到新的实例,如果它不能可能失败的另一个实例不违反在部署配置的限制。

CodeDeploy uses deployment configs to control how aggressively it deploys to the instances in your fleet. (This config gets ignored for automatic deployments, since each instance is handled separately.) CodeDeploy will fail your deployment and stop deploying to new instances if it cannot potentially fail another instance without violating the constraints in the deployment config.

有3 <一href="http://docs.aws.amazon.com/$c$cdeploy/latest/APIReference/API_CreateDeploymentGroup.html#-CreateDeploymentGroup-request-DeploymentConfigName"相对=nofollow>建部署的configs,并且你可以通过命令行或的 API 如果你需要一个不同。要部署到只有一个实例的时间,你可以使用 codeDeployDefault.OneAtATime 部署配置,允许至多有一个不健康的主机,在任何给定的时间。

There are three built in deployment configs, and you can create your own via the CLI or API if you need a different one. To deploy to only one instance at a time, you can use the CodeDeployDefault.OneAtATime deployment config, which allows at most one unhealthy host at any given time.

这篇关于什么是部署使用codeDeploy和CI工具,分布式应用程序的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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