How can I connect to my Postgres from Metabase, and TablePlus?

I have a very basic barebones app to try out Fly again.

myapp-> phoenix app
myapp-db -> postgres app

I just want to connect to my Postgres database from Metabase, and also locally on my Windows machine through TablePlus.

In services like Render and Railway I can just copy the external database url.


Appreciate the help, I’ve been having trouble with this all morning.

I also need to connect with my db, and have been unable to so do via any of the commands in the fly postgres command tree. I can guess at the connection string based on the parameters given when the database was created, but so far I’ve been unable to get psql to parse the hostname due to error: ‘could not translate host name “[redacted_hostname]” to address: nodename nor servname provided, or not known’

I’ll keep playing around and report back if I get unblocked.

Simple database (and/or application console) access feels like it should be table stakes for a PaaS offering, and I have a feeling I may have missed something in the manual…

Well, my instinct was right.

Found some guidance at gui for a postgres db on fly io - #4 by rookie, in that you can use fly postgres connect, but the app you pass via the -a flag is, somewhat confusingly, the -db suffixed “app”, instead of the actual app that you created the postgres instance for.

Are you running metabase within your account, or elsewhere? We run these on private networks (which is good) which makes connecting external services more difficult (which is bad).

From your local machine, you can connect in a couple of ways:

fly pg connect # connects you with psql
fly proxy 15432:5432 # makes your database server available on localhost:15432

You will need to grab the username and password from your DB connection URL (we generate these when you create the DB, or run fly pg attach).

Connecting from an external service is more difficult. The best external DB providers give you an agent you can run on your private network to give them access.

If you really, really need to open your database up to the public internet, you can do that with a config change and fly ips allocate-v4.

Yes this is some tooling we need to improve. fly pg connect should definitely just work if you’re in an app linked to a postgres, that seems like the obvious thing to happen. :slight_smile: