R
Railway•10h ago
Danbis

Trouble switching to private networking

I have a webserver and a database and I'm trying to connect to the db from the webserver using the PGPRIVATEHOST but it isn't working. Is there something else I need to do other than switch from PGHOST to PGPRIVATEHOST?
Solution:
you would also need to use the private port
Jump to solution
12 Replies
Percy
Percy•10h ago
Project ID: 2e90105f-9e57-4bf0-b0d4-cc830c988fd2
Danbis
DanbisOP•10h ago
2e90105f-9e57-4bf0-b0d4-cc830c988fd2
Solution
Brody
Brody•10h ago
you would also need to use the private port
Danbis
DanbisOP•10h ago
Where would I find the private port? It's not listed as an env var on the database
Brody
Brody•10h ago
service settings
No description
Danbis
DanbisOP•10h ago
That's for public networking though. I don't see one under Private Networking?
Brody
Brody•10h ago
5432 is the private port
Danbis
DanbisOP•10h ago
Oh weird okay let me give that a go psycopg2.OperationalError: could not translate host name "postgres.railway.internal" to address: Name or service not known Still getting this :/
Brody
Brody•9h ago
please switch the runtime to v2
No description
Brody
Brody•9h ago
also, please dont specify install commands in the build command field, it is poor practice
No description
Danbis
DanbisOP•9h ago
Oh yeah I had a buddy fix that for me and I forgot to remove it from the build command Alrighty looks like one of those two things fixed it! Thanks for the help 😄
Brody
Brody•9h ago
no problem!
Want results from more Discord servers?
Add your server