How to Change App and DB Region Without Launching New Apps

hi @vladimir

Since your app and DB are running on Machines that are on servers physically located in yyz, there is no way to move the apps without starting some new Machines in lax.

For the Postgres app

You should probably back up your data.

Then you’ll need to follow the steps to perform a regional failover to move your primary to the new region. There will be a short amount of downtime during the failover. Note that the instructions say that you’ll need 3 replicas in lax before you begin. You can add these one at a time with fly machine clone <machine id of the primary> --region lax.

Once you’ve completed the steps linked above, run fly status after a few minutes to make sure all the nodes are healthy and that the primary is now in lax.

Clean up “old” Machines and volumes

You can delete the Machine in yyz (which should have the role replica after the failover):
fly machine destroy <machine id> --force

And then run fly volumes list and carefully delete any volumes that no longer have ATTACHED VMs using the command:
fly volumes destroy <volume id>.

Other notes: If your db had a single node (Machine), this is usually only sufficient for development projects and can result in downtime during host outages.

For the attached Rails app

You can use fly scale count 2 --region lax to add 2 new Machines in lax. And then fly scale count 0 --region yyz to remove the Machines in yyz.

Change the primary_region to lax in the fly.toml file.