Connect With flyctl
To connect to your Postgres database from outside your Fly organization, you need a WireGuard connection. However,
flyctl on your local machine can connect using user-mode WireGuard magic, without you having to set up your own WireGuard tunnel.
psql shell, you can just use the
fly postgres connect command:
flyctl postgres connect -a <postgres-app-name>
You can also forward the server port to your local system with
flyctl proxy 5432 -a <postgres-app-name>
Then connect to your Postgres server at localhost:5432. Using
psql again, as a trivial example, it would look like this:
If you already have something else listening on port 5432, you can run this instead:
flyctl proxy 15432:5432 -a <postgres-app-name>
Then connect to localhost:15432.
As with all your Fly apps, you can get a root console on your app's VM using fly ssh.