I'm currently testing the AWS Copilot with a very simple Go app, but it fails at the initcommand. My AWS CLI is properly configured, using an account with full-permission role. The log I have is:
~/Workspace/hello-ecs $ copilot init  ✔  969  13:52:58
Welcome to the Copilot CLI! We're going to walk you through some questions
to help you get set up with an application on ECS. An application is a collection of
containerized services that operate together.
Application name: hello-ecs
Workload type: Load Balanced Web Service
Service name: hello-ecs
Dockerfile: ./Dockerfile
Ok great, we'll set up a Load Balanced Web Service named hello-ecs in application hello-ecs listening on port 3000.
✘ Failed to create the infrastructure to manage services and jobs under application hello-ecs.
✘ execute app init: read template app/app.yml: stat /Users/davcgar/Workspace/hello-ecs/app/app.yml: no such file or directory
How can I troubleshoot this type of issue?
Good morning! Without knowing more info, it looks like this is an issue with our packr static file injection. Could you let me know what version of Copilot you're using, and whether it was built from source? Our make targets should take care of this but if it was built using go build instead of make there will be issues with rendering YAML templates.
Heya! And to add to Austin's comment if the CLI was installed with homebrew, is it possible to use the aws tap instead (https://aws.github.io/copilot-cli/docs/getting-started/install/)
brew install aws/tap/copilot-cli
I believe the copilot-cli formula in homebrew core is unfortunately broken
Good morning! Without knowing more info, it looks like this is an issue with our packr static file injection. Could you let me know what version of Copilot you're using, and whether it was built from source? Our make targets should take care of this but if it was built using
go buildinstead ofmakethere will be issues with rendering YAML templates.
Sure! I was using the Copilot 1.2.0, installed from Homebrew. The Dockerfile I'm using is like this:
FROM golang:1.15 AS builder
WORKDIR /go/src/github.com/davivcgarcia/hello-ecs
COPY src/ .
RUN go get -d -v ./...
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo .
FROM scratch
WORKDIR /root
COPY --from=builder /go/src/github.com/davivcgarcia/hello-ecs/hello-ecs .
EXPOSE 3000
CMD ["./hello-ecs"]
What is the problem you mentioned with the rendered YAMLs?
Heya! And to add to Austin's comment if the CLI was installed with homebrew, is it possible to use the aws tap instead (https://aws.github.io/copilot-cli/docs/getting-started/install/)
brew install aws/tap/copilot-cli
I replace the installation with the tap you mentioned, and the problem is gone! 🥳
To explain a little further, part of our build process is assembling a collection of Cloudformation template fragments using packr. If the cli is built without first running make packr-build, then none of the static assets will be present and we won't be able to create any CFN templates, leading to the error you experienced.
It's likely that the formula Efe mentioned (copilot-cli, the one you originally installed from) simply runs go build and therefore misses the crucial step of bundling static files in the binary.
Closing this for now but feel free to reopen if the problem arises for a different reason :)
Most helpful comment
Sure! I was using the Copilot 1.2.0, installed from Homebrew. The Dockerfile I'm using is like this:
What is the problem you mentioned with the rendered YAMLs?
I replace the installation with the tap you mentioned, and the problem is gone! 🥳