Do not expose database

Hi! I've migrated to metal yesterday and got things working (huge thanks to Brody!). Now I'd like to "optimize" things a bit.

I have a directus app that is connected to a postgres db. Currently, the database has a TCP proxy, ie. publicly exposed if I understand correctly.

How could I change my configuration/variables references so that the database service is kept private?

Somewhat related: I face the issue mentionned at https://station.railway.com/questions/spinning-database-connection-33718874 but I don't think I can remove the PGHOST variable because of TCP stuff or that would break Directus.

I don't understand very well how everything interacts together so I've probably asked dumb things, forgive me!

Thanks for the help!

Solved

8 Replies

10 months ago

Hello,

You can simply remove the database's TCP Proxy to remove it from being publicly exposed.

Best,
Brody


Status changed to Awaiting User Response Railway 11 months ago


Thanks that worked!

About the data panel being stuck on "Database Connection", I'm unsure what I should do. In the thread I mentionned, you talk about the PORT variable (I don't have one) and the TPC Proxy (I don't have one anymore either). Any idea?


Status changed to Awaiting Railway Response Railway 11 months ago


10 months ago

The database does need to be exposed publicly for the data tab to work.


Status changed to Awaiting User Response Railway 11 months ago


Good to know thanks! I tried removing PGPORT (which was an empty string) but it's required by the data panel, so I set it to 5432 but it's still on "Database Connection"


Status changed to Awaiting Railway Response Railway 11 months ago


10 months ago

5432 is the private port, the data tab requires the public port.


Status changed to Awaiting User Response Railway 11 months ago


And where can I find the public port?


Status changed to Awaiting Railway Response Railway 11 months ago


10 months ago

It is displayed after adding a TCP Proxy, but honestly I would recommend to not mess around with the variables anymore, you could cause permanent data loss or lock yourself out of your database, and we do not offer data or password recovery services so you would be on your own if you got your database or variables into a bad state.


Status changed to Awaiting User Response Railway 11 months ago


Gotcha, thanks for the help!


Status changed to Awaiting Railway Response Railway 11 months ago


Status changed to Solved florian-lefebvre 11 months ago


Loading...