How can I migrate my DigitalOcean PostgreSQL database to Fly?

I want to migrate my PostgreSQL database hosted on DigitalOcean to Fly so I can take advantage of the multi-region PostgreSQL feature. My app is hosted outside of Fly. Will multi-region PostgreSQL only work if my app is also hosted on Fly? I’m not sure how the Fly-Replay header issued by my app would take affect if my app isn’t hosted on the Fly.io network.

I also have existing data. Is there any way to migrate this over?

My app is hosted outside of Fly. Will multi-region PostgreSQL only work if my app is also hosted on Fly?

It can work for applications outside Fly as well, as long as you open out the required ports and configure the service, as described in Multi-region PostgreSQL.

I’m not sure how the Fly-Replay header issued by my app would take affect

That’s a feature that’s available and applicable only to apps running on Fly, so if you were running only Postgres on Fly with the app servers outside it wouldn’t be relevant to you. If your app servers were running on Fly it would help you re-route requests to regions where your database was running for better performance.

I also have existing data. Is there any way to migrate this over?

Yeah, since this is a normal Postgres deployment, and you have the ability to access it externally or via a private network (see Private Networking) you can use the normal Postgres import / export tools like pg_dump, pg_restore and anything else that has Postgres support. There’s also a utility that can help migrate easily: GitHub - fly-apps/postgres-migrator: Fly app that works to streamline Postgres migrations.