Server Configuration


I followed Running Nakama with docker-compose to install nakama and cockroachdb. Now it is running but I want to change the session.token_expiry_sec time.

I tried this:
I exported the configuration from nakama console, I got config.yaml. Then, I placed this file in nakama/data

Note: I bind a folder in the local machine’s filesystem to the Docker file system using this inside docker-compose.yml (((- ./nakama/data:/nakama/data # Edit this line )))

I will appreciate if someone can explain this. Nakama documentation is very good but there are some steps that should be clarified, or maybe it is just me :confused:

Using macOS Catalina.

Hi @Mohammed. Welcome :wave:

There’s two ways to achieve what you want to do:

  1. You can edit the start line for the server in your Docker Compose file so it includes your desired token lifetime as part of the command flags:

    nakama --logger.level DEBUG --session.token_expiry_sec 7200

    Have a look at one of our official Docker Compose files for an example on how to set it:

  2. You could mount a virtual filesystem so that your YML configuration is available inside the container filesystem to be read by Nakama at startup. I think this is the approach you’ve tried so far. With our standard Docker Compose files this should work:

    1. Make sure there’s a volume mount for the local filesystem into the container.

        - ./:/nakama/data

      This will take your current work directory and mount it inside the container to the folder path “/nakama/data”. I’ll assume that in your current work directory you’d have a config.yml file with Nakama server configuration values.

    2. Adjust the start command in the Docker Compose file for the server to look for your YML file.

      nakama --config "/nakama/data/config.yml"

Hope that helps.