Trouble Deploying Nakama with PostgreSQL on Railway
ru-dr
HOBBYOP

8 months ago

Hi all — I'm trying to deploy Nakama on Railway using the officialheroiclabs/nakama Docker image.

white_check_mark emoji What I Want

  • Run Nakama server on Railway

  • Connect it to Railway’s PostgreSQL service

  • Use environment variables like DATABASE_URL and ENCRYPTION_KEY

  • Access Nakama Console for testing

x emoji What's Not Working

  • Deployment succeeds, but Nakama logs keep showing:
    Error pinging database

  • I’ve added the correct DATABASE_URL and ENCRYPTION_KEY as Railway environment variables.

  • Tried both Dockerfile and direct Docker image approaches with valid start commands — still no luck.

speech_balloon emoji 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 pray emoji

Solved$10 Bounty

Pinned Solution

alexwebgr
HOBBY

8 months 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 tada emojihttps://nakama-production-07f4.up.railway.app

as for mapping for the other ports that remains a bit of a mystery TBH slightly_smiling_face emoji 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:7349

feel free to fork the repo and deploy it in your own account slightly_smiling_face emoji

if you found this answer to be helpful feel free to mark it as Accepted pray emoji

thanks

alex

3 Replies

alexwebgr
HOBBY

8 months 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 tada emojihttps://nakama-production-07f4.up.railway.app

as for mapping for the other ports that remains a bit of a mystery TBH slightly_smiling_face emoji 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:7349

feel free to fork the repo and deploy it in your own account slightly_smiling_face emoji

if you found this answer to be helpful feel free to mark it as Accepted pray emoji

thanks

alex


ru-dr
HOBBYOP

8 months ago

thanks alex it worked but a silly question what should be the username and password


ru-dr
HOBBYOP

8 months ago

nvm i got it username is admin and password is password grin emoji


Status changed to Solved chandrika 8 months ago


Loading...