a year ago
Hi all — I'm trying to deploy Nakama on Railway using the officialheroiclabs/nakama Docker image.
What I Want
- Run Nakama server on Railway
- Connect it to Railway’s PostgreSQL service
- Use environment variables like
DATABASE_URLandENCRYPTION_KEY - Access Nakama Console for testing
What's Not Working
- Deployment succeeds, but Nakama logs keep showing:
Error pinging database - I’ve added the correct
DATABASE_URLandENCRYPTION_KEYas Railway environment variables. - Tried both Dockerfile and direct Docker image approaches with valid start commands — still no luck.
💬 What I Need
- Is there a working example or guide for this setup?
- Does Nakama expect a specific database name or user?
- What's the recommended start command when using Railway’s Postgres?
Any help would be greatly appreciated
Pinned Solution
a year ago
Hi there
i tried deploying from the image directly and i got the same error so created a Dockerfile with the migrate and pushed it to a repo https://github.com/alexwebgr/nakama
on railway you will need twp services one is the code from the repo and one for the postgres copy the DATABASE_URL over to the nakama service and generate a railway domain choosing the port for the console
and 🎉https://nakama-production-07f4.up.railway.app
as for mapping for the other ports that remains a bit of a mystery TBH 🙂 but in theory if would set up a new domain for each port and it should work just fine
for the gRPC API you might be able to use
grpc://nakama.railway.internal:7349feel free to fork the repo and deploy it in your own account 🙂
if you found this answer to be helpful feel free to mark it as Accepted 🙏
thanks
alex
3 Replies
a year ago
Hi there
i tried deploying from the image directly and i got the same error so created a Dockerfile with the migrate and pushed it to a repo https://github.com/alexwebgr/nakama
on railway you will need twp services one is the code from the repo and one for the postgres copy the DATABASE_URL over to the nakama service and generate a railway domain choosing the port for the console
and 🎉https://nakama-production-07f4.up.railway.app
as for mapping for the other ports that remains a bit of a mystery TBH 🙂 but in theory if would set up a new domain for each port and it should work just fine
for the gRPC API you might be able to use
grpc://nakama.railway.internal:7349feel free to fork the repo and deploy it in your own account 🙂
if you found this answer to be helpful feel free to mark it as Accepted 🙏
thanks
alex
a year ago
thanks alex it worked but a silly question what should be the username and password
Status changed to Solved chandrika • 11 months ago
