Setup Tailscale with Fly Postgres

I’ve seen the docs for setting up Wireguard so that I can access my Postgres instance easily from my local machine, but is it possible to get this working with Tailscale instead as it is built on Wireguard?

I saw this guide by Tailscale, but as Fly Postgres is launched with flyctl postgres create I don’t have a Dockerfile for the app.

If it’s possible, how can I configure Tailscale to work with Fly Postgres?

I haven’t tried doing this with Tailscale but you could get a Dockerfile by forking their Postgres app. See its readme:

I did that to install the TimescaleDB extension.

I set up Postgres the normal way (fly postgres create) and then deployed my cloned repo (with my custom changes to the Dockerfile, in my case to add a few lines to install TimescaleDB) to that app.

I assume the trade-off is losing Fly’s postgres commands from then on though. Not sure how else you could do it.