How do I create a single instance app without using "fly scale count"?

I’d like to create a single instance application (my application only works as single instance). Is there any way to enforce this directly from the fly.toml spec?

Ideal if I could also specify scaling policies to be used during rolling upgrades.

What would be my best option for doing this on fly.io?
I don’t see any information in documentation on how to achieve this except manually running fly scale count 1 together with a fly.toml that prevents any kind of auto scaling.

Basically I want my app to run at most 1 instance (less during upgrades). If the single instance dies I would like fly to create a new one or restart the old one, but ensure I never have more than one.

Alternatively if there are any recommended ways of implementing leader election for a multi instance app on fly.io, maybe fly.io has some mechanism we can leverage?

No mechanism in fly.toml for that. You can do fly scale count 1 or fly deploy --ha=false

1 Like

From How To to Questions / Help