I was following the Nakama’s offical documentation video on setting up the Nakama using go runtime using docker , I followed evert step, but I was not able to see my custom RPC in API explorer section in Nakama console.
Here’s my Dockerfile
FROM golang:1.23.4 AS builder
ENV GO111MODULE=on
ENV CGO_ENABLED=1
WORKDIR /backend
COPY go.mod .
COPY *.go .
COPY vendor/ vendor/
RUN go mod tidy
RUN go build --trimpath -mod=vendor -buildmode=plugin -o ./backend.so
FROM heroiclabs/nakama:3.22.0
COPY --from=builder /backend/backend.so /nakama/data/modules
COPY local.yml /nakama/data/
Here’s my docker-compose.yml
services:
postgres:
container_name: postgres
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
image: postgres:12.2-alpine
environment:
- POSTGRES_DB=nakama
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=localdb
volumes:
- ./postgres-data:/var/lib/postgresql/data
expose:
- "8080"
- "5432"
ports:
- "5432:5432"
- "8080:8080"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "nakama"]
interval: 3s
timeout: 3s
retries: 5
nakama:
build: .
container_name: nakama
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
exec /nakama/nakama --name nakama1 --database.address postgres:localdb@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200
restart: always
links:
- "postgres:db"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./nakama-data:/nakama/data
expose:
- "7349"
- "7350"
- "7351"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
healthcheck:
test: ["CMD", "/nakama/nakama", "healthcheck"]
interval: 10s
timeout: 5s
retries: 5
volumes:
data:
And here’s my project structure
/server via 🐳 desktop-linux via 🐹 v1.23.4
❯ ls
Dockerfile everybodyWithMe.go go.sum main.go
docker-compose.yml go.mod local.yml vendor
/server via 🐳 desktop-linux via 🐹 v1.23.4
❯
If anyone could help me, please, it would be appreciated.
(Side note, I have never used docker , nakama, and go before.)