It’s a little more complicated than that, but doable! You need to add replicas in the new region:
- Create two new volumes in the region you want to move to:
flyctl volumes create pg_data --size <gb> --region <new_region>
flyctl volumes create pg_data --size <gb> --region <new_region>
- Scale to 4 instances:
flyctl scale count 4
flyctl regions add <new_region>
If you run flyctl status
now, you should see 4 instances running (or two new ones booting up).
The next step is to change the primary_region
setting. For this, you’ll actually need to pull the configuration down and edit it.
- Create a new directly,
cd
into it - Run
flyctl config save -a <postgres-cluster-name>
This gives you a fly.toml
, you will need to make a couple of edits:
- Edit
fly.toml
and change thePRIMARY_REGION
environment variable - Make sure the
experimental
block looks like this:[experimental] private_network = true enable_consul = true auto_rollback = false metrics_port = 9187 metrics_path = "/metrics"```
That last step is a pain, sorry about that.
Once you have the fly.toml
setup, run flyctl deploy -i flyio/postgres-ha
.
This is something that we hope to make simpler!