How to disable count scaling, to enable autoscaling?

I would like to deploy an app, with minimum 4 VMs running (in different regions) according to traffic.

So, from what was default, enabled autoscaling like flyctl autoscale balanced min=4 max=20 -a <app-id>. This had no effect whatsoever.

Here is the configuration at this point:

❯ flyctl scale show -a <app-id>
VM Resources for <app-id>
        VM Size: shared-cpu-1x
      VM Memory: 256 MB
          Count: main_process=1 
 Max Per Region: main_process=0 app=0
❯ flyctl autoscale show -a <app-id>
     Scale Mode: Balanced
      Min Count: 4
      Max Count: 20

Then, I tried setting count scaling using flyctl scale count main_process=4 --max-per-region=1 -a <app-id>. Which changed configuration like this:

❯ flyctl scale show -a <app-id>
VM Resources for <app-id>
        VM Size: shared-cpu-1x
      VM Memory: 256 MB
          Count: main_process=4 
 Max Per Region: main_process=1 app=0

And had caused deployment of 3 more instances in the same regions instead of distributing it; although region pool has been added with all 20 regions.

The problem was processes section in fly.toml. This was something that came automatically with using flyctl launch, but it’s seems to be mentioned nowhere in the docs.

[processes]
main_process = "node server.js"

Removed this, and now autoscaling has an effect, and true to documentation.

But, still, all 4 instances (min) are at 1 region. Would these be distributed automatically, or should I do something? I would like them to be at seprate regions.

You could force a spread by using the max regions parameter, notes here: How to specify regions to run in? - #3 by sudhir.j

If you leave the app to run as is the scaling algorithms should kick in based on your application’s traffic.

I have tried that, it will disable autoscaling (not something I want). Trying once again:

❯  fly scale count 4 --max-per-region 1
Warning: Autoscaling is now disabled for <app-id>

Count changed to 4
❯ flyctl releases list
VERSION STABLE TYPE    STATUS      DESCRIPTION                 USER   DATE                 
v89     false  scale   failed      Scale VM count: ["app, 4"]         3s ago
v88     true   scale   in_progress Update autoscaling config          1h47m ago

As you can see, status is shown as “failed”.

And flyctl status is now missing the “Deployment status” table, instances are still at v88 and at same region.