Hi!
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
Using macOS Catalina.
Hi @Mohammed. Welcome
There’s two ways to achieve what you want to do:
-
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:
https://github.com/heroiclabs/nakama/blob/master/docker-compose-postgres.yml#L23-L24
-
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:
-
Make sure there’s a volume mount for the local filesystem into the container.
volumes:
- ./:/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.
-
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.
2 Likes