a year ago
Similar issue here https://help.railway.com/questions/can-t-reach-database-server-in-private-n-54ba5b08 but it is not resolved. Same error "Can't reach database server at postgres.railway.internal:`5432`"
The build and deploy fails when using the private database URL but succeeds when using the public one.
In https://docs.railway.com/guides/private-networking, I see it says "Private networking is not available during the build phase.".
Does that mean I have to build with the public URL and then use the private network url during run? If so, is there a guide on how to do this?
4 Replies
a year ago
Oh, I found a setting to enable private networking during the build.
"New Builder Environment Beta
Opt-in only if you need access to private network during builds! Build times may be longer while this is in beta"
It made my build take 10 mins which isn't great... but at least it works. I'm still interested in how others approach this.
a year ago
Hello,
We cannot recommend you use the new builder, it is currently in an unmainted beta state as we have switched our focus to rolling out our Metal regions.
I see that you are making good progress!
You already have both public and private URLS set in your service variables!
So assuming your code uses DATABASE_URL you would set your build command to -
DATABASE_URL=$DATABASE_PUBLIC_URL bunx next buildAnd your start command to just -
bun startSince the previous variable overwrite is only valid for that single command, there's no need to switch back.
Hope this helps!
Best,
Brody
Status changed to Awaiting User Response Railway • about 1 year ago
a year ago
That worked - thanks for your help
Status changed to Awaiting Railway Response Railway • about 1 year ago
Status changed to Awaiting User Response Railway • about 1 year ago
Status changed to Solved brody • about 1 year ago