Currently fly deploy
is not completely declarative because the machines count and regions are controlled with fly scale count
. This was also the case previously with the machine size, which now thankfully has been moved in fly.toml.
Moving the scale count and regions options in fly.toml would make the configuration stateless and declarative, now you have to run the command fly scale count x
separately after checking what’s the count of your machines and what are the current regions.
Also if you manually stop some machines and then run fly deploy
the stopped machines will remain stopped, which is never what you want, you would want your infra to scale back to the desired machine count, which could be specified in fly.toml.
Adding machines count and regions values in the fly.toml could make fly deploy
stateless and declarative, removing countless bugs caused by hidden state generated by fly scale count
and other imperative commands.
Another thing you should do in my opinion is to move all the orchestration from the cli to your servers, so you don’t accidentally kill an in progress fly deploy
command and leave your infra in a broken state. You could then handle what happens when you stop a deployment while it’s in progress, complete the deployment or roll it back.