Is there a way to specify the
min_machines_running for each process in an app? I only have it under [http_service] section, but even when its “2” its only running one API and one worker process, but I really want 2 API machines started and 1 for the worker?
The auto stop and start feature (and min_machines_running) only works for process groups with services. So, the setting
min_machines_running = 2 is only being applied to your “API” process group. When you run
fly status and your app has no traffic, you should see 2 api machines and 1 worker machine started.
If you want your worker machine to be always running and you find it stops and doesn’t restart, you could set the machine restart policy to
always for just that Machine. See Machine restart policy · Fly Docs.
Got it. Thanks a lot! So if I scale it to say 3 machines count, it remains at 3 irrespective always and doesn’t scale up/down on its own?
any way to configure all of this in fly.toml file itself?
Didn’t know that if it stopped for any reason it would not come up on its own… handled manually for now. Thanks!
You need to run the
fly scale command to increase or decrease Machine count, this value is not in
fly.toml. When you run the
fly scale command, you’re creating or destroying Machines, and this is per process group. The auto start and stop feature only starts or stops existing Machines. So, if you scale to a count of 2 api Machines and 1 worker Machine, then they should stay running(started) and the count won’t change unless you change it.
If you had, for example, a count of 4 api Machines, then 2 of them would stop when you had low traffic and only start if needed, and 2 would stay running.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.