We recently migrated our web app servers to fly. We have a very predictable traffic spike each week that hits instantly and is sustained for a short period of time. The autoscaler isn’t quite fast enough to provision new VMs as quickly as the connections come in, so it’d be ideal to be able to automate the autoscale settings ahead of the expected bump to increase our minimum number of VMs, but I am not clear whether/how to safely automate these settings. Is there a better way than just hosting the flyctl client on a server somewhere that runs in a cron job?
flyctl
is centre piece to all of dev-ex on Fly, so I don’t think it is out of place to use it with a cron job to have it do your biding.
Most flyctl
commands are but a wrapper atop Fly’s GraphQL API endpoint. It may not always do things as expected, and so, you can examine the code and import / pull out the relevant golang bits for your own use, if that suits your usecase better.
As for autoscaling, you can consider using Fly Machines (can’t migrate existing apps to it just yet, have to create a new one) which give you more control over how and when to spin up and shutdown VMs. Note though it is too low-level and in-preview.
Thanks for validating my instinct. I will work on a scheduler to drive flyctl
remotely.