I’m setting up a staging environment and am trying to use GH actions to scale it up/down as required to run functional tests as part of CI/CD.
It seems like fly scale count is failing intermittently, both when scaling to 0 and 1, without returning an error (though the message does say the current number so you can tell whether it worked, or not).
Scale to 0 and back to 1 is kind of buggy in our API/flyctl. Your best bet is flyctl deploy and then flyctl scale count 1. These actions are each a separate Nomad job update under the hood.
Since doing deploy → scale to 1, I noticed that flyctl sometimes gets stuck on the Monitoring Deployment stage. Does that sound related? As in, is deployment more likely to be stuck when the app is scaled to 0?
The deployment monitor is getting stuck because there isn’t a deployment created when the count is zero. I think we should either automatically set the count to 1 when deploying if it’s zero or we should exit early. I’ll admit deploying when the count is zero is something we haven’t tested much. We’ll figure out how to get it working in a way you’d expect.
For anyone running into this, I ended up “solving” this problem by simply running the command twice in a row I still sometimes see failures after the first attempt, but everything seems to reliably work the 2nd time around.