copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

is entrypoint working on local ?

Open sebastianovide opened this issue 2 years ago • 5 comments

Hello,

I've added entrypoint as explained in https://aws.github.io/copilot-cli/docs/manifest/lb-web-service/#entrypoint but it is ignored completely.

Does it work ?

Thanks

sebastianovide avatar Jan 18 '24 21:01 sebastianovide

When you run copilot svc package --output-dir infra, do you see the configuration under Resources.TaskDefinition.Properties.ContainerDefinitions.[-Name: <your workload name>].Entrypoint?

I tested the ⬇️ manifest, and was able to find the configuration translated into CloudFormation correctly:

type: Load-Balanced Web Service
entrypoint: "echo something"
Resources:
  TaskDefinition:
    Properties:
      ContainerDefinitions:
        - Name: !Ref WorkloadName
          EntryPoint:
            - echo
            - something

Lou1415926 avatar Jan 19 '24 02:01 Lou1415926

yes it does...

Resources: # If a bucket URL is specified, that means the template exists.
  LogGroup:
    Metadata:
      'aws:copilot:description': 'A CloudWatch log group to hold your service logs'
    Type: AWS::Logs::LogGroup
    Properties:
      LogGroupName: !Join ['', [/copilot/, !Ref AppName, '-', !Ref EnvName, '-', !Ref WorkloadName]]
      RetentionInDays: !Ref LogRetention
  TaskDefinition:
    Metadata:
      'aws:copilot:description': 'An ECS task definition to group your containers and run them on ECS'
    Type: AWS::ECS::TaskDefinition
    DependsOn: LogGroup
    Properties:
      Family: !Join ['', [!Ref AppName, '-', !Ref EnvName, '-', !Ref WorkloadName]]
      NetworkMode: awsvpc
      RequiresCompatibilities:
        - FARGATE
      Cpu: !Ref TaskCPU
      Memory: !Ref TaskMemory
      ExecutionRoleArn: !GetAtt ExecutionRole.Arn
      TaskRoleArn: !GetAtt TaskRole.Arn
      ContainerDefinitions:
        - Name: !Ref WorkloadName
          Image: !Ref ContainerImage
          Environment:
            - Name: COPILOT_APPLICATION_NAME
              Value: !Sub '${AppName}'
            - Name: COPILOT_SERVICE_DISCOVERY_ENDPOINT
              Value: dev.mobile.local
            - Name: COPILOT_ENVIRONMENT_NAME
              Value: !Sub '${EnvName}'
            - Name: COPILOT_SERVICE_NAME
              Value: !Sub '${WorkloadName}'
          EnvironmentFiles:
            - !If
              - HasEnvFile
              - Type: s3
                Value: !Ref EnvFileARN
              - !Ref AWS::NoValue
          LogConfiguration:
            LogDriver: awslogs
            Options:
              awslogs-region: !Ref AWS::Region
              awslogs-group: !Ref LogGroup
              awslogs-stream-prefix: copilot
          EntryPoint:
            - entrypoint-copilot.sh

my Dockerfile has no entrypoint and no entrypoint is executed.

If I add

ENTRYPOINT [ "./entrypoint.sh" ]

then the entrypoint.sh is executed but not the one in the copilot manifest (entrypoint-copilot.sh)

my entrypoint.sh has a

echo "entrypoint.sh"

and my entrypoint-copilot.sh has a

echo "entrypoint-copilot.sh"

I still see the entrypoint.sh being executed instead the entrypoint-copilot.sh

sebastianovide avatar Jan 19 '24 08:01 sebastianovide

I haven't been able to reproduce the issue 😞 in my test ECS is correctly executing my entrypoint override instead of the ENTRYPOINT in my Dockerfile :( I think I'm probably missing something 🤔

You can also take a look at the task definition of the running task(s) to see if the entrypoint configuration is correctly passed from CFN to ECS. I will update the thread when I come up with more ideas to resolve this!

Lou1415926 avatar Jan 20 '24 12:01 Lou1415926

Ok... I think I've found the problem.... I can reproduce it all the time in copilot run local . Does it ring any bell ?

sebastianovide avatar Jan 24 '24 11:01 sebastianovide

copilot run local does not support entrypoint override from manifest yet...I can create an enhancement request for this, but this is likely a separate issue from if the deployed service has failed to respect entrypoint :(

Lou1415926 avatar Jan 25 '24 00:01 Lou1415926

This issue is stale because it has been open 60 days with no response activity. Remove the stale label, add a comment, or this will be closed in 14 days.

github-actions[bot] avatar Mar 26 '24 00:03 github-actions[bot]

This issue is closed due to inactivity. Feel free to reopen the issue if you have any further questions!

github-actions[bot] avatar Apr 09 '24 00:04 github-actions[bot]