Giter Club home page Giter Club logo

Comments (9)

jasonmimick-aws avatar jasonmimick-aws commented on May 25, 2024

Hi @davidlondono -

Thanks for reporting the issue you're facing.

There is an addPortMappings section in the cdk code which should accomplish this. See https://github.com/search?q=repo%3Aaws-samples%2Famazon-ecs-fargate-cdk-v2-cicd%205000&type=code

Possibly something has changed in the CDK libs or how things are getting deployed.

Do you have any more information, logs, or details you can share?

Feel free to ping me on slack @mimjasov

from amazon-ecs-fargate-cdk-v2-cicd.

rverton avatar rverton commented on May 25, 2024

Hi @jasonmimick-aws,
but there is no http service (with a /health endpoint) for the amazonlinux:2022 image running on port 5000, so the initial deployment will get stuck when ECS is provisioned, isn't it?

const baseImage = 'public.ecr.aws/amazonlinux/amazonlinux:2022'

Thanks

from amazon-ecs-fargate-cdk-v2-cicd.

saurabhmarwaha avatar saurabhmarwaha commented on May 25, 2024

@jasonmimick-aws My stack is also stuck in progress endlessly. Is there a different image and port number we can use for initial deployment?

from amazon-ecs-fargate-cdk-v2-cicd.

rverton avatar rverton commented on May 25, 2024

Hey @saurabhmarwaha,
you can use public.ecr.aws/nginx/nginx-unprivileged as a 'dummy' container. I'm using it with port 8080. If you want/need port 80, you can use http://public.ecr.aws/nginx/nginx. They are also available as ARM containers.

from amazon-ecs-fargate-cdk-v2-cicd.

saurabhmarwaha avatar saurabhmarwaha commented on May 25, 2024

@rverton Container / Task is still taking unusually longer with below changes due to which stack continues to be In progress status. Is that how you are using a dummy container.

const baseImage = 'public.ecr.aws/nginx/nginx-unprivileged'

container.addPortMappings({
  containerPort: **8080**,
  protocol: ecs.Protocol.TCP
});

from amazon-ecs-fargate-cdk-v2-cicd.

rverton avatar rverton commented on May 25, 2024

@rverton Container / Task is still taking unusually longer with below changes due to which stack continues to be In progress status. Is that how you are using a dummy container.

const baseImage = 'public.ecr.aws/nginx/nginx-unprivileged'

container.addPortMappings({
  containerPort: **8080**,
  protocol: ecs.Protocol.TCP
});

You also need to adjust the health check because the nginx container will not have a /health endpoint:

    const fgService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, `${id}-ecs-service`, {
      cluster,
      // ...
    });

    fgService.targetGroup.configureHealthCheck({
      path: "/",
    });

from amazon-ecs-fargate-cdk-v2-cicd.

saurabhmarwaha avatar saurabhmarwaha commented on May 25, 2024

Still no progress. Stack is stuck in progress and task stopped eventually

const baseImage = 'public.ecr.aws/nginx/nginx-unprivileged'
const container = taskDef.addContainer('nodejs-docker-example', {
  image: ecs.ContainerImage.fromRegistry(baseImage),
  memoryLimitMiB: 256,
  cpu: 256,
  logging
});

container.addPortMappings({
  containerPort: 8080,
  protocol: ecs.Protocol.TCP
});

const fargateService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, "ecs-service", {
  cluster: cluster,
  taskDefinition: taskDef,
  publicLoadBalancer: true,
  desiredCount: 1,
  listenerPort: 80,
});

fargateService.targetGroup.configureHealthCheck({
  path: "/",
});

Task stopped at: 2024-01-30T08:41:02.149Z
CannotPullContainerError: pull image manifest has been retried 5 time(s): failed to resolve ref public.ecr.aws/nginx/nginx-unprivileged:latest: failed to do request: Head "https://public.ecr.aws/v2/nginx/nginx-unprivileged/manifests/latest": dial tcp 75.2.101.78:443: i/o timeout

Container

Container-2

from amazon-ecs-fargate-cdk-v2-cicd.

rverton avatar rverton commented on May 25, 2024

As I understand this error, ECS is not able to pull the container. Does your ECS service have a route to the public ECR repository?

from amazon-ecs-fargate-cdk-v2-cicd.

saurabhmarwaha avatar saurabhmarwaha commented on May 25, 2024

@rverton I believe you mean if subnet where cluster is created have access to Internet (IGW). I will check the routing and will verify.
Could be related to Auto-assign public IP.

Will come back to in a few hours..Here it's 4:00 am..Getting some sleep...:)

from amazon-ecs-fargate-cdk-v2-cicd.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.