`fly postgres` - check which databases are attached to which apps

Hi there, thanks for the brilliant product - I am thoroughly enjoying it so far.

One question:

How do you check which postgres databases are attached to which apps? I can confirm this by sshing into the app and checking the DATABASE_URL environment variable, so I know the app is attached to the db. But I was wondering if there was a way you could quickly check this.

I checked both the UI dashboard and the fly command line tool, but couldn’t find anything. Did I miss something?

Interesting, I don’t think we do make that attachment readily available in our UIs at the moment.

Can I ask what made you want to confirm the attachment?

After attaching an app, I just wanted to see some additional confirmation that the attachment exists beyond the successful response to fly pg attach.

It’s nothing major but a nice-to-have. For example, the output to fly pg list could have an additional column:

my-db   personal    deployed   2023-06-14T18:50:48Z   my-app-1, my-app-2

Is this information readily available in your API?

Yes and no!

We have a way to list attachments for one particular postgres app, and you can limit your query to the attaching app, but it’s not readily available to list without some work.

You can see an example of the query here: flyctl/api/resource_postgres.go at 6e99629e84e779a5343c52b019bf7243355f849e · superfly/flyctl · GitHub

I see! In that case, using the GraphQL schema as is, you could also do something like fly pg list-apps -a my-db and show the apps attached to the specified db.

Would you be open to me submitting a PR to the flyctl repository?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.