Server setup with Go isn't creating Leaderboards following video tutorials

Hey guys, I have been following the following tutorials in order to try to improve my server setup using Go with Nakama:

https://www.youtube.com/watch?v=VbVEMsmJ3ds - Bucketed leaderboards using Nakama Server Runtime
https://www.youtube.com/watch?v=Ru3RZ6LkJEk - Nakama Server Runtime Code Project Setup Using Go

All of this was with the intention of creating a leaderboard for my Unity game. I will preface this by sayign that this is my first time writing anything in Go so it is very difficult for me to debug in this.
Following the first tutorial, there was no healthcheck running and no added options in the API explorer.

I decided to push on and follow the leaderboard tutorial on the video. I believe that I have followed everything correctly, however after running “docker compose up” in my windows command terminal in the correct directory, and looking at the Nakama console, there are no buckets created and there are no leaderboards.

I am not sure if I need to add anything extra to the likes of my docker-compose file or any other files. The functions in my main.go file look as follows:

func InitModule(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, initializer runtime.Initializer) error {
	logger.Info("Go module loaded.")

	leaderboardId := "bucketed_weekly"
	createLeaderboard(leaderboardId, "Bucketed Weekly #1", ctx, logger, nk)

	if err := initializer.RegisterRpc("get_bucket_records", modules.RpcGetBucketRecordsFn([]string{leaderboardId}, 20, false)); err != nil {
		return err
	}

	if err := initializer.RegisterRpc("get_bucket_records_force_regenerate", modules.RpcGetBucketRecordsFn([]string{leaderboardId}, 20, true)); err != nil {
		return err
	}

	return nil
}

func createLeaderboard(id string, title string, ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule) error {
	logger.Info("Creating Leaderboard with ID %q and Title %q", id, title)

	err := nk.LeaderboardCreate(ctx, id, false, "desc", "incr", "0 0 * * 0", nil)
	if err != nil {
		logger.Error(err.Error())
		return err
	}

	logger.Info("Leaderboard %q created successfully", id)
	return nil
}

If you need me to share my full repo, other files, or anything else I’d be more than happy to. Any advice would be fantastic! Thanks in advance!

Hello @cobby363,

It’s very likely this is an issue with the docker-compose setup. Can you please share its contents or perhaps even the full repository?

Hi @sesposito,

Thanks so much for the quick reply! I’m happy to share both.
I have just spotted one issue however, it seems that one of the import github links used in the video is no longer available, ie. “github.com/heroiclabs/bucketed-leaderboards-go/modules”. Either way I will share what I currently have.
Firstly, here is the docker-compose.yml

version: '3'
services:
  postgres:
    container_name: postgres
    image: postgres:12.2-alpine
    environment:
      - POSTGRES_DB=nakama
      - POSTGRES_PASSWORD=localdb
    volumes:
      - 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:
    container_name: nakama
    image: registry.heroiclabs.com/heroiclabs/nakama:3.17.1
    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:
      - /C/Users/catha/projects/docker:/nakama/data
      - ./:/nakama/data
    expose:
      - "7349"
      - "7350"
      - "7351"
    ports:
      - "7349:7349"
      - "7350:7350"
      - "7351:7351"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:7350/"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  data:

Secondly, here is the repo: https://github.com/cobby363/CathalOB_SuperNimbusTest/tree/main/go-server-setup

Hi @cobby363,

I see go-server-setup does not exist anymore and you set up a Typescript server. Do you need further help going forward?