Deploying in a new region by modifying the primary_region param in the fly.toml doesn't recreate all machines in the new region

Let’s say I have this start of the file in the fly.toml:

app = 'some-app-name'
primary_region = 'ams'

[build]
  dockerfile = 'langgraph.Dockerfile'

[env]
SOME_ENV_VAR = ...

[http_service]
  internal_port = 8000
  force_https = true
  auto_stop_machines = 'stop'
  auto_start_machines = true
  min_machines_running = 1
  processes = ['app']

[[services]]
  protocol = 'tcp'
  internal_port = 8000
  tcp_checks = []

  [[services.ports]]
    port = 80
    handlers = ['http']

  [[services.ports]]
    port = 443
    handlers = ['tls', 'http']

[[vm]]
  memory = '2gb'
  cpu_kind = 'shared'
  cpus = 2

If there is a machine running in the “ams” region, and I switch to “nrt”, if i do fly deploy..., then the old machine in “ams” will still exist. I have to manually kill the ams machine, the relaunch fly deploy for the new machine in the new region to come alive.

Is this normal? Do i need to do something as part of my CI/CD pipeline such as shutting down machines? I would think it strange.

would it be because of the min_machines_running = 1 setting? Is there a way to make this better?

Hi… Yep, this kind of duality is normal.

The Fly.io platform uses a mixture of declarative and imperative styles, and the outcomes of operations depend on config files, sequences of procedural flyctl commands, and heuristics based on the set of Machines that you already do have deployed. There isn’t a “one stop shop” where every aspect of your app gets declared, although many people do expect it to tend more in that direction (when starting out).

In a certain sense: it seems that users who hold strong opinions about how updates and scaling should occur in detail gravitate toward designing and assembling an orchestrator of their own—via the Machines API, :black_cat:. It’s not as daunting as it looks at first!

Short of that, I personally prefer fly m clone, fly m update, fly m destroy, etc., instead of trying to nudge the quasi-declarative parts into following my specific intent.

Hope this helps a little!