How do I create a single instance app with at-most-once guarantee?

This line in the official docs says that you never have more Machines running than you explicitly created:

The maximum number of running Machines is the number of Machines created for your app on launch, or using fly scale count or fly machine clone.

(Blue-green deployments are an exception, of course, but those are incompatible with volumes.)

I wouldn’t try to dissuade anyone from building their own, extra safety net, though, since it’s easy to imagine corner cases with failed crosstown migrations or such. A custom, in-Machine supervisor that held a lease with the built-in Consul cluster wouldn’t be overkill, if the app was very sensitive to multiple writers.

(My impression was that the newer versions of Litestream aren’t so fragile, but maybe I misread that in the v0.5.0 announcement.)


Having said that, single-Machine apps do have a lot of (other) disadvantages on the Fly.io platform…

Perhaps that’s the real source of lingering doubts?

1 Like