Fransurbo
Fransurbo

Reputation: 465

How to deploy container to ECS+Fargate+CodeDeploy without load balancer?

I have an app that comes in two pieces:

  1. The (Ruby/Rails) main app which is also the web frontend
  2. A Sidekiq event handler

The first one is not a problem, done that. CodeDeploy will deploy the new version by creating the new service(s) on the "blue load balancer target group" and start moving the traffic to them in a blue/green setup.

However, Sidekiq doesn't have a port, so no health check. This is the problem I'm having now, the NLB doesn't validate the health of the container, so it keeps restarting and the deploy eventually times out because it can't get a clean service.

I'm not sure if this is a ECS limitation or a CodeDeploy limitation (or a "me limitation" :) ), but it seems I have to have a load balancer for that to work.

But something about that just rings wrong! I'm sure AWS must have thought about "worker containers", right? How do you setup an ECS cluster with two services, each with one task - the two parts above. And how do you then use CodeDeploy to deploy to that service/task? Or do you deploy Sidekiq (in this case) in some other way?

Having two services, I can scale them individually.

At the moment, I have a CodePipeline, triggering a CodeBuild to build the image, push that into ECR then trigger CodeDeploy to do the deployment. It worked initially when I had one service, with the two tasks, but then both would scale simultaneously which isn't what I want in the end.

Upvotes: 1

Views: 414

Answers (1)

Conor Hayes
Conor Hayes

Reputation: 1

For anyone looking at this now (me), the answer is to use ECS Rolling Update (per this troubleshooting article), and use the circuit breaker or CloudWatch alarms to detect failure to reach steady state.

I had a similar problem, in which I had a service which is intended to consume messages from an SQS queue, and then perform a variety of other actions on other AWS services in response. Since this doesn't actually service net traffic, I was stuck when I tried to use CodeDeploy for its automatic rollbacks.

Upvotes: 0

Related Questions