auto_stop_machines: true and min_machines_running:0 do not scale down to 0

I’m testing out Automatically stop and start Machines · Fly Docs but it doesn’t seem to be working.

According to the docs

If auto_stop_machines = true , min_machines_running = 0 , and there’s no traffic to your app, eventually all of your app’s Machines could be stopped.

I was expecting the state of my VM to be “paused” after some number of idles minutes. But it’s remained at “started” even though it hasn’t received traffic. I don’t see anything in the logs either to indicate that it ever scaled down to 0.

  1. Is this just a timing issue – it needs to be idle for X duration? I waited for it to be idle for up to 30 minutes but it hasn’t stopped yet.

  2. Could anything be wrong with my configuration? I am hitting the api.machines.dev directly with the following JSON (not using flyctl). I am acting as a SaaS so I’m managing my customer’s fleet on top of fly.io.

{
    "config": {
        "init": {},
        "services": [
            {
                "protocol": "tcp",
                "internal_port": 5000,
                "ports": [
                    {
                        "port": 443,
                        "handlers": [
                            "tls",
                            "http"
                        ]
                    },
                    {
                        "port": 80,
                        "handlers": [
                            "http"
                        ]
                    }
                ],
                "auto_stop_machines": true,
                "auto_start_machines": true,
                "min_machines_running": 0
            }
        ],
        "checks": {
            "httpget": {
                "type": "http",
                "port": 5000,
                "method": "GET",
                "path": "/__/zuplo/knative-ready",
                "interval": "15s",
                "timeout": "10s"
            }
        },
        "image": "registry.fly.io/zuplo-deno-staging:1.20.0",
        "restart": {
            "policy": "no"
        },
        "guest": {
            "cpu_kind": "shared",
            "cpus": 1,
            "memory_mb": 256
        }
    }
}

The app is nick-testing under `zuplo-customers-staging’.

I have tried looking at other posts

Thanks!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Can you try autostart and autostop instead of auto_start_machines and auto_stop_machines? You can see the full Machines API spec here: Swagger UI. In this case, take a look at the api.MachineService model.

This ticket auto-closed after 7 days so I couldn’t update with new information that I have.

I upgraded my account was able to get open up a support ticket.

Sam from fly.io got back to me with the same thing: use autostart and autostop instead of auto_start_machines and auto_stop_machines. That worked.

Basically, the machines API names could be different from the toml ones.

Thanks for the link to the Swagger UI. Immensely helpful! I see it’s also now at the docs site Add Machines API Spec · superfly/docs@d061dbc · GitHub

This issue is now solved for me.

1 Like