kayac / ecspresso

ecspresso is a deployment tool for Amazon ECS
MIT License
824 stars 90 forks source link

v1.7.9 fails deployment app, which using B/G deployment with CodeDeploy #393

Closed hanocha closed 2 years ago

hanocha commented 2 years ago

We tried to deploy an ECS application using B/G deployment with CodeDeploy, by ecspresso v1.7.9, but it was failed with events log below.

Events:
2022/03/10 06:20:44 ... Registering a new task definition...
2022/03/10 06:20:45 ... Task definition is registered ...:33
2022/03/10 06:20:45 ... Updating service attributes...
2022/03/10 06:20:45 deploy FAILED. failed to update service attributes: InvalidParameterException: Unable to update load balancers on services with a CODE_DEPLOY deployment controller. Use AWS CodeDeploy to trigger a new deployment.

By ecspresso v1.7.8, we could deploy the application successfully.


FYI: ecs-service-def.json like below. And we didn't update the file, so it should not updates ECS service I think.

{
  "deploymentConfiguration": {
    "maximumPercent": 200,
    "minimumHealthyPercent": 100
  },
  "deploymentController": {
    "type": "CODE_DEPLOY"
  },
  "desiredCount": 1,
  "enableECSManagedTags": true,
  "enableExecuteCommand": false,
  "healthCheckGracePeriodSeconds": 0,
  "launchType": "FARGATE",
  "loadBalancers": [
    {
      "containerName": "app",
      "containerPort": 80,
      "targetGroupArn": "..."
    }
  ],
  "networkConfiguration": {
    "awsvpcConfiguration": {
      "assignPublicIp": "DISABLED",
      "securityGroups": ["..."],
      "subnets": ["...", "..."]
    }
  },
  "placementConstraints": [],
  "placementStrategy": [],
  "platformFamily": "Linux",
  "platformVersion": "1.4.0",
  "schedulingStrategy": "REPLICA",
  "serviceRegistries": [],
  "tags": []
}
fujiwara commented 2 years ago

Thank you for reporting!

When a deployment controller is CodeDeploy, LoadBalancers are controlled by CodeDeploy. So I think to fix this problem, remove loadBalancers elements in ecs-service-def.json.

I'll fix ecspresso too.

fujiwara commented 2 years ago

@hanocha I'm sorry to a wrong comment https://github.com/kayac/ecspresso/issues/393#issuecomment-1063793097 . AppSpec for CodeDeploy requires LoadBalancerInfo which generated by loadBalancers in service definition.

fixed in #394

hanocha commented 2 years ago

@fujiwara Thank you for your very fast response and fixing! 😄

Honestly, I came up with a solution like the comment after opening this issue, but I had not had enough time to try it 😢 sorry...

fujiwara commented 2 years ago

v1.7.10 released! 🙏 https://github.com/kayac/ecspresso/releases/tag/v1.7.10