I am totally new here, so need to learn a bit more about the platform.
I have deployed an app in multiple regions with setting min_machines_running=1.
In one one of the region all replicas get stopped and then we get a cold start.
I want at least one replica running in each region.
The min_machines_running setting applies only to your primary region (primary_region in your fly.toml). That’s why all the Machines get stopped in the other region.
You can configure settings on individual Machines, but I’ll have to check into whether that would work in your scenario.
You could try the following solution, although it adds an extra step post-deploy.
Choose a Machine in the second region to be your always-on Machine. Use fly status to get the Machine ID.
Run the following command to turn off autostop for that Machine only:
fly m update <machine id> --autostop=false
Say yes to config changes:
Configuration changes to be applied to machine: <machine id> (my-app-name)
... // 15 identical lines
"protocol": "tcp",
"internal_port": 8080,
- "autostop": true,
+ "autostop": false,
"autostart": true,
"min_machines_running": 1,
... // 27 identical lines
? Apply changes? Yes
Updating machine <machine id>
No health checks found
Machine <machine id> updated successfully!
==> Monitoring health checks
No health checks found
...
Warning: the configuration of all Machines is rewritten by fly.toml when you run fly deploy, so you would have to repeat the above step after every deploy.
I also suggest testing this out yourself before depending on it to work, since I only tested it briefly on a hello world app.