如何使用 CodeDeploy 和包含多个目标组的 AutoScalingGroup 部署代码 [英] How to deploy code using CodeDeploy with AutoScalingGroup containing multiple target group

查看:19
本文介绍了如何使用 CodeDeploy 和包含多个目标组的 AutoScalingGroup 部署代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况.

  • 一个实例包含三个应用程序 [4000、4001、4002].

  • one instance with three application [ 4000, 4001, 4002 ].

创建了一个 ALB 并使用规则将 3 个域重定向到三个目标组

Created an ALB and redirected 3 domains to three target groups using rules

当我使用 Code-deploy [Blue-green] 创建应用程序时,它一次只要求一个目标组.但我有三个目标群体与自动缩放组.

When I use to create an application in Code-deploy [Blue-green], it asks for only one target group at a time. But I have three target groups associated with the autoscaling group.

部署后,它不会向其他两个目标组注册实例.我尝试创建不同的 ALB,即三个具有三个目标组的 ALB.但我最终在代码部署中向一个目标组发送流量.

After Deployment it is not registering instances with other two target groups. I tried Creating Different ALB, i.e., three ALB with three target groups. But I end up in code deploy sending traffic to one target group.

我直接从 bitbucket 部署代码.我需要代码来部署 [Blue-green] 以向所有三个目标组自动注册实例.但是根据 AWS CodeDeploy 文档,在代码部署时只能选择一个目标组.非常感谢任何形式的帮助.

I am deploying code directly from bitbucket. I need code to deploy [Blue-green] to register instance automatically with all three target groups. But as per AWS CodeDeploy documentation, only one target group can be selected at the time of code deploy. Any kind of help is much appreciated.

推荐答案

目前,CodeDeploy 不支持在单个部署中配置多个目标组.有一些变通方法,但它们并不出色.

At the moment, CodeDeploy does not support configuring multiple target groups in a single deployment. There are workarounds, but they're not awesome.

1.将每个应用程序分解为自己的部署组并单独部署

您可以在不同的部署组中单独部署每个应用程序,这将允许您注册/取消注册到每个目标组.但是,这种方法不适用于蓝/绿部署.

You could deploy each application separately in a different deployment group, which would allow you to register/deregister to each target group. However, this approach would not work with blue/green deployments.

2.在您的用户脚本中注册/取消注册 2 个目标群体

您可以将您的 appspec 配置为使用脚本从 2 个目标组注册和注销.Github 上有一个示例脚本,但不建议在生产环境中使用.

You could configure your appspec to register and deregister from 2 targets groups using a script. There is a sample script on Github, though it's not not recommended for production use.

3.将您的应用程序分成 3 组实例

现在,您正在同一台主机上运行 3 个不同的应用程序.您可能有充分的理由这样做,但如果您可以将应用程序分解为 3 组不同的主机,则可以将它们分解为 3 个不同的部署组,并且仍然使用蓝/绿部署.

Right now, you're running 3 different applications on the same hosts. You probably have good reason to do that, but if you could break out the applications into 3 different sets of hosts, you could break them into 3 different deployment groups and still use blue/green deployments.

这篇关于如何使用 CodeDeploy 和包含多个目标组的 AutoScalingGroup 部署代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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