Maciej Perliński
Maciej Perliński

Reputation: 412

How to run go-cloud-debug-agent in Google Cloud Run so that I can debug my go app in Stackdriver Debug

I'm trying to run go-cloud-debug-agent within Cloud Run

FROM golang:1.13.1 
RUN go get -u cloud.google.com/go/cmd/go-cloud-debug-agent
RUN mkdir -p /go/src/xyz
WORKDIR /go/src/xyz
COPY . .

RUN go build -gcflags=all='-N -l' -o main .


EXPOSE 8080
ENTRYPOINT ["go-cloud-debug-agent","-projectid=someproject-12313423","-appmodule=main","-appversion=1.0","--","/go/src/xyz/main"]

Unfortunately when trying to deploy it to Cloud Run I see following error in the Stackdriver Logging

Error loading program: AttrStmtList not present or not int64 for unit 98

Anyone has any clue how to use go-cloud-debug-agent with Cloud Run?

Upvotes: 0

Views: 903

Answers (2)

wjg
wjg

Reputation: 21

Go is not supported for Cloud Run at the moment. Here is a list of the supported languages and platforms for Debugger: https://cloud.google.com/debugger/docs/setup/

Upvotes: 1

Maciej Perliński
Maciej Perliński

Reputation: 412

As @JohnHanley pointed I had to change the golang version to 1.11 to be compatibile with debug agent. To conclude the following Dockerfile should run in Cloud Run any golang code and let you use Stackdriver Debug with it.

FROM golang:1.11
RUN go get -u cloud.google.com/go/cmd/go-cloud-debug-agent
RUN mkdir -p /go/src/xyz
WORKDIR /go/src/xyz
COPY . .

RUN go build -gcflags=all='-N -l' -o main .


EXPOSE 8080
ENTRYPOINT ["go-cloud-debug-agent","-projectid=someproject-12313423","-appmodule=main","-appversion=1.0","--","/go/src/xyz/main"]

GCP should post some examples as from their current documentation I can deduct there is no way to run go-cloud-debug-agent on Cloud Run and that Cloud Run is not supported.

Upvotes: 0

Related Questions