Cannot connect to a Digital Ocean hosted database after deploying

Yes, you’re right it’s the IP that’s the issue.

Unfortunately the IP that Fly shows you is the one for incoming requests to the app. They don’t reveal the outgoing IP. Which is what you need when using an external database that needs an IP.

Fly can provide an IP range for a particular region but those IPs are subject to change. So that is half-way there but not ideal. I’m not aware of a solution to getting a fixed IP.

See e.g