Cannot seem to connect to Fly Managed Postgres from external location

I am becoming very frustrated by this. I created an instance of my database, and I am able to connect to it with fly mpg connect. however, the connection strings that it gives me refuses to connect anywhere, either with DBeaver, or pgweb, or any of my applications. Does it only work with applications deployed to fly?

Just this, over and over:

pgweb               | Connecting to server...
pgweb               | Error: dial tcp: lookup direct.9g6xxxxxxxv5mld.flympg.net on 127.0.0.11:53: no such host
pgweb               | Pgweb v0.16.2 (git: e63945ee7182435a729f22a4203e2f15d00f6350) (go: go1.22.8) (build time: 2024-11-02T16:23:09Z)

I believe that’s by design. You need to set up wire guard to connect to the instances locally.

So the manged postgres product is not like supabase or neon where you just get a connection string, and off you go?

Hey! Your apps in the same organization should just work to connect to Managed Postgres instances.

If you need it locally, you can run fly mpg connect (I see you found that one). You can run `fly mpg proxy to just make it available over a local port.

Are you running the app in a different org or just locally?

I was hoping to use this database with a vercel site I had as well, as I am using both. unfortunately that does not look possible.

Here is an example app that will let you setup a proxy that you can give public networking and connect without wireguard or running your entire app inside Fly.io.

Note the disclaimer; it’s not exactly a directly supported path but I thought it would be useful to illustrate how in case it’s useful for now: GitHub - fly-apps/mpg-jump-proxy: Example app to expose your Fly.io Managed Postgres cluster to the public internet

1 Like

Interesting! Did you want ?sslmode=verify-full in the README’s example URL, though?

# Using psql
psql postgresql://user:password@your-postgres-proxy.fly.dev:5432/dbname

(I think the default is still a looser “SSL if available”, which can be MITMed, :dragon:.)