Open baledreamcastau opened 5 months ago
Please check it your docker-compose file entrypoint with delve execution(listen 4000 port):
/nakama/dlv --accept-multiclient --listen=:4000 --headless=true --api-version=2 exec /nakama/nakama -- --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama
sorry i posted the wrong docker file, here is the one with dlv debug implemented
FROM heroiclabs/nakama-pluginbuilder:3.21.1 AS go-builder
ENV GO111MODULE on
ENV CGO_ENABLED 1
WORKDIR /backend
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y --no-install-recommends gcc libc6-dev
RUN go install github.com/go-delve/delve/cmd/dlv@latest
COPY local.yml .
COPY go.mod ./
COPY src/*.go ./
COPY vendor/ vendor/
RUN go build --trimpath --gcflags "all=-N -l" --mod=vendor --buildmode=plugin -o ./backend.so
FROM registry.heroiclabs.com/heroiclabs/nakama-dsym:3.21.1
COPY --from=go-builder /go/bin/dlv /nakama
COPY --from=go-builder /backend/backend.so /nakama/data/modules/
COPY --from=go-builder /backend/local.yml /nakama/data/
COPY local.yml /nakama/data/
EXPOSE 7349
EXPOSE 7350
EXPOSE 7351
EXPOSE 2345
EXPOSE 4000
EXPOSE 8080
ENTRYPOINT ["/bin/sh", "-ecx", "/nakama/nakama migrate up --database.address postgres:localdb@host.docker.internal:5432/nakama && /nakama/dlv --log --log-output=debugger --accept-multiclient --listen=:4000 --headless=true --api-version=2 exec /nakama/nakama -- --config /nakama/data/local.yml"]
Sorry for the late reply, I did not reproduce it situation(split up core (server logic) and database into 2 different container instead of using compose to group them together.)
here is my dockerfile
FROM maplebreak/nakama-pluginbuilder:3.20.0-arm AS go-builder
ENV GO111MODULE on
ENV CGO_ENABLED 1
ENV GOOS linux
ENV GOARCH arm64
WORKDIR /backend
RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y --no-install-recommends gcc libc6-dev
RUN go install github.com/go-delve/delve/cmd/dlv@latest
COPY local.yml .
COPY go.mod .
COPY *.go ./
COPY vendor/ vendor/
COPY api/ api/
# Go runtime plugin using the --gcflags "all=-N -l" flag which effectively disables optimizations in the resulting plugin file.
RUN go build --trimpath --gcflags "all=-N -l" --mod=vendor --buildmode=plugin -o ./backend.so
# Using the nakama-dsym image rather than the standard nakama image.
# This is an image that provides us with a Nakama binary with optimizations disabled, suitable for running with dlv just like our plugin.
FROM maplebreak/nakama-dsym:3.20.0-arm
COPY --from=go-builder /go/bin/dlv /nakama
COPY --from=go-builder /backend/backend.so /nakama/data/modules/
COPY --from=go-builder /backend/local.yml /nakama/data/
COPY local.yml /nakama/data/
ENTRYPOINT ["/bin/sh", "-ecx", "/nakama/nakama migrate up --database.address postgres:localdb@172.16.0.96:5432/nakama && /nakama/dlv --log --log-output=debugger --accept-multiclient --listen=:4000 --headless=true --api-version=2 exec /nakama/nakama -- --config /nakama/data/local.yml --database.address postgres:localdb@172.16.0.96:5432/nakama"]
And here is the docker run config
hmm ok, thank you very much for taking time helping me !
as title stated, in order to deploy the server on to other cloud platform, i have split up my core (server logic) and database into 2 different container instead of using compose to group them together.
and when doing that, the debugger seems failed to connect with the following error message. 2024-04-13T15:47:39Z error layer=rpc writing response:write tcp 172.17.0.3:4000->172.17.0.1:56738: use of closed network connection
my docker file
my goland run config
the database part should be fine because i have a Docker_release file which build my server without dlv and it can connect to database and i can enter the admin portal as usual.
Can you tell what went wrong with the debugging ?
Thanks in advance