The RPC's does not appear in the nakama api explorer

Hello again mates!

I’m trying to centralize calls from my game in nakama modules. I have been looking at the documentation and the video tutorial that they have on the web. And I’m having problems. I can launch docker compose up just fine and can access the control panel. The problem is that I can’t get the modules to appear. I have seen the documentation, I have followed the tutorial, and I have even downloaded the project that they have on github Project template nakama But there is no way to see the healthcheck in the explorer api calls. I don’t know if this has happened to anyone else. Possibly I have something misconfigured but I would say no. I have to say that I am using the cockroach database, although I don’t think that is the problem. This is my docker-compose.yml.
`version: ‘3’
services:
cockroachdb:
image: cockroachdb/cockroach:latest-v20.2
command: start-single-node --insecure --store=attrs=ssd,path=/var/lib/cockroach/
restart: “no”
volumes:
- data:/var/lib/cockroach
expose:
- “8080”
- “26257”
ports:
- “26257:26257”
- “8080:8080”
healthcheck:
test: [“CMD”, “curl”, “-f”, “http://localhost:8080/health?ready=1”]
interval: 3s
timeout: 3s
retries: 5
nakama:
image: registry.heroiclabs.com/heroiclabs/nakama:3.15.0
entrypoint:
- “/bin/sh”
- “-ecx”
- >
/nakama/nakama migrate up --database.address root@cockroachdb:26257 &&
exec /nakama/nakama --name nakama1 --database.address root@cockroachdb:26257 --logger.level DEBUG --session.token_expiry_sec 7200 --metrics.prometheus_port 9100
restart: “no”
links:
- “cockroachdb:db”
depends_on:
cockroachdb:
condition: service_healthy
prometheus:
condition: service_started
volumes:
- ./:/nakama/data
expose:
- “7349”
- “7350”
- “7351”
- “9100”
ports:
- “7349:7349”
- “7350:7350”
- “7351:7351”
healthcheck:
test: [“CMD”, “curl”, “-f”, “http://localhost:7350/”]
interval: 10s
timeout: 5s
retries: 5
prometheus:
image: prom/prometheus
entrypoint: /bin/sh -c
command: |
'sh -s < ./prometheus.yml <<EON
global:
scrape_interval: 15s
evaluation_interval: 15s

  scrape_configs:
    - job_name: prometheus
      static_configs:
      - targets: ['localhost:9090']

    - job_name: nakama
      metrics_path: /
      static_configs:
      - targets: ['nakama:9100']
  EON
  prometheus --config.file=./prometheus.yml
  EOF'      
ports:
  - '9090:9090'

volumes:
data:`

Do I understand correctly, that you have a problem that nakama doesn’t load your game logic modules?
do you have modules directory next to docker compose file ? If so, could you provide nakama container logs

Also as a sanity check it might be worth trying to clone GitHub - heroiclabs/nakama: Distributed server for social and realtime games and apps. and run docker compose from there without making any modifications. It should load example lua modules and make their RPC functions available.

I have tried to clone that Nakama base project from the link you shared with me, and this is the result.


Is it possible that the problem is in some configuration of this area?

It’s just that the calls like healthcheck and daily_reward still don’t appear. What are the examples on the nakama website.

@sergisnt what type of runtime module are you trying to load - Go, Lua or TS? If you’re using the latter, are you placing the bundled JS in the local modules folder where you have the Nakama source? The docker-compose you shared is really only meant to run Nakama with the modules present in its source code.

If you’re not very familiar with Docker, to bootstrap a new project I suggest you work the other way around, and use the GitHub - heroiclabs/nakama-project-template: An example project on how to set up and write custom server code in Nakama server. as a skeleton. Just be mindful that the docker setup present in the project expects the bundled JS to be in build/index.js before docker compose up is run, and it won’t bundle it for you as part of the image build process.

@sesposito My idea was to use TS types. Although I have tried projects that had Go and Lua modules and the methods do not appear either. I have used the project that you have provided. HERE and still still does not appear the modules. I have only modified the Docker Compose to use the Cockroach database. But the rest is identical. With the Index.js in the Build folder and still do not appear the methods of Daily_reward and others.





As you can see, in the project there is the daily_reward file both in TS and in GO and Lua. And it doesn’t appear in the nakama panel.

There are no modules in execution time or the methods in the API Explorer. And I have cloned the project and I have segated the steps that appear below the NPM Install and NPX TSC. I have followed the 3 tutorials they have on the web. That of Daily Reward and another more basic. What can be happening?

@sergisnt I just did docker compose up on the project template and it correctly loaded the modules, although I did not do any changes to the Docker/docker-compose.yml files in the repository, unless there’s some Windows issue I’m not aware of I don’t know why you wouldn’t see the modules being loaded too.

Perhaps you should get started here: Nakama: TypeScript Runtime | Heroic Labs Documentation

It also seems strange to me that I can’t see the modules or the methods created in the nakama control panel. I have followed the tutorials correctly. I have tried to disable the W10 firewall in case it had any influence but nothing. This leads me to ask myself some questions.

  • Is it possible that where the project is located is the problem?
  • Is there somewhere where the route that refers to the modules could have been configured wrong?

I have new information. I just tried on another machine and I have seen with the project from the GitHub repository if it works. BUT IT ONLY WORKS WITH POSTGRES. The problem is that when I use the cockroach docker compose that they have on their website, the default does not load the modules or the methods.

Nakama - Docker Compose Cockroach

I wanted to use cockroach, and the docker compose of cockroach works on neither of the two machines, that is, it works, but it doesn’t load the modules.

What is this about?

PD: The project with docker compose that works for me. But not is with cockroach

Like I explained above, you cannot use the example cockroachdb docker-compose because it is not prepared to load your local modules, you need to change the one in the project template to use the cockroach db container image instead and pass the correct db configs for Nakama to connect to it.

Just to add to what @sesposito is saying here, specifically the issue is that the “CockroachDB” Docker Compose file you are referring to runs Nakama directly from the registry.heroiclabs.com/heroiclabs/nakama:3.15.0 image. This image is not configured to load any modules from your local machine and will therefore run a vanilla Nakama server.

The Docker Compose file in the nakama-project-template repo is configured to run Nakama by building it’s own image using the provided Dockerfile. As you can see, this Dockerfile is specifically made to copy across the local module files into the Nakama container (lines 14-17).

Sorry for the delay in your response, I was away for a while. I think I now understand better how it works. So what solution do you recommend? I use the oldest version, the 3.9 that they have in the template. Or is there a way that DockerCompose version 15 can accept modules locally?

That is, I use the “docker compose up” command to launch my ‘Nakama Server’. I tried to use this project by replacing the docker-compose.yml with the one from version 15 but it doesn’t load the modules either. What would be the solution to use version 15 and generate the modules? or is it not possible for now?

@sergisnt, you cannot replace the docker-compose.yml file outright, it won’t work. Are you using the TS runtime?

Yes, my idea was to use typescript since I am more familiar with it. Now I have a question, I wanted to use the docker 3.15 image. because it is more updated than version 9. But it is not prepared to load the modules at runtime as @tom said. Is there no way to have the most updated version and have the option to load the modules? Is there any important difference between version 15 and 9? Like security for example.

Hi @sergisnt ,

I’m not sure I’m following. You can use any version of Nakama with Docker and any version of Nakama can load runtime modules.

To run Nakama 3.15 you should create a Dockerfile that points to the 3.15 image, e.g.

FROM registry.heroiclabs.com/heroiclabs/nakama:3.15.0

The TypeScript Docker Documentation here will guide you through the steps necessary to get a TypeScript runtime project running with Docker.

I see that you want to use Cockroach instead of Postgres which seems to be the main issue here. This is just a case of replacing the postgres block in the docker-compose.yml file with an appropriate cockroach block (see the configuration here for example) and updating the database connection details in the entrypoint block for the nakama service.