The problem is I can’t figure out the relationship between files in my project folder and those on the server. No matter what file paths I use, the server can’t find the nakama-config.yml file.
I also saw this thread (and others) Server Configuration - #2 by novabyte and added VOLUME .:/nakama/data and then tried the variant VOLUME ["/nakama/data"], but it had no effect.
The config file is at the root of my project folder, alongside the Dockerfile.
“level”: “fatal”,
“ts”: “2021-03-06T20:14:15.114Z”,
“caller”: “server/config.go:77”,
“msg”: “Could not read config file”,
“path”: “/nakama/data/nakama-config.yml”,
“error”: “open /nakama/data/nakama-config.yml: no such file or directory”
I first had this problem with the server not finding the runtime js_entrypoint file, which is when I decided to try using the config file, and now here I am.
From looking at other Dockerfiles in the repo, I discovered that the JS files needed were not being copied to the image in the original Dockerfile I used to base this on. No wonder it was looking everywhere and not finding anything!
COPY ./build/*.js /nakama/data/modules/build/
Now my runtime code is printing “Hello World!” in the server log output.
The issue was the same for the config file.
COPY ./nakama-config.yml /nakama/data/
And now I see the config file was loaded successfully, too.
Sorry to bump this thread, as we are also facing same issue. We are stuck at this section. Kindly hlep us to resolve this issue as the resolved answer says > COPY ./build/*.js /nakama/data/modules/build/ we unable to get this done.
When we followed tutorial, we are stuck at setting configuration, every thing done as in tutorial and we are using windows OS. error:open /nakama/data/my-config.yml: no such file or directory
Few things to point out:
As per tutorial, for windows user, volume location to be set as /c/Users/<username>/projects/docker:/nakama/data
But this doesnt set exact location of project on desktop. So we changed to /Users/<useranme>/Desktop/nakama:/nakama/data
On configuration section, doc says to create a data folder inside project and set in volume as - ./data:/nakama/data
So since ours is windows, we gave the full path like below. - /Users/<useranme>/Desktop/nakama/data:/nakama/data
and added below line in entry point of nakama /nakama/nakama --config /nakama/data/my-config.yml &&
With this setup with Docker 3.3.0, we got this error: error: /tmp/path/to/logfile.log : no such file or directory
So we have updated to Docker 3.6.0, we got issue like EOF from github some thing like docker https://registry-1.docker.io manifests EOF
So we have installed Docker 3.5.2 and we ran into this issue.
After doing some research and from this post, figured whats actually data path for volume and its corresponding usage. Now our config file is read but still facing issue with path for logger in config file.
my_config.yml is
and console prints error: /tmp/path/to/logfile.log : no such file or directory
also if we remove this logger section, then we ended up in another issue like {"level":"fatal","ts":"2021-08-24T09:03:43.438Z","caller":"main.go:262","msg":"Error pinging database","error":"dial tcp 127.0.0.1:26257: connect: connection refused"}
@chiru Remember that any paths you put into the config file are relative to the container, not the host system. So if you want to write to a logfile rather than stdout map a volume from the host system to your container, and specify the logger.file option value using that mounted volume.
This is a separate issue. It only surfaces if you remove the logger section because otherwise due to your invalid logger configuration the server doesn’t get as far as connecting to the database. The error indicates the server can’t reach the database as you’ve configured it, or using the default database connection configuration if you haven’t set your own.
The fix here depends on how you’re running your database, but have a look at the database configuration documentation for the values you’re expected to set. The most important is database.address.
@zyro But when we remove the config entry from entrypoint i.e., /nakama/nakama --config /nakama/data/my-config.yml &&
Now app works fine and connecting the database.
Either way the error is the same because you did not change the log file location. Set a valid log file location, in a mounted volume the nakama docker container can write to, and it will work.