Having this problem where I’m having two machines running the same application simultaneously. I though the idea behind V2 is that only one is running and the other is on stand-by but they’re both running all the time. This is causing problems in my app (a Discord bot, where it responds twice to the same command because he’s running in 2 machines) how can I have only a single machine running or have one on stand-by? Here’s my fly.toml:
fly m destroy <machine-id> -a <app-name> one of the two provisioned machines. Exercise caution as a machine once removed isn’t going to come back.
Understand that two machines are better than one. Rather than removing a machine, I’d wager one is better of using an orchestrator like Temporal and/or using SQS or Cloudflare Queues as event sources, assuming async processing is okay in this scenario.
Don’t think so. Something might be up with Fly but I can’t say for sure. I see a similar behaviour in my app, too.
+1 Yeah, this was one of the patterns I remember seeing a few years ago in the Discord bot community. It was also the only way to roll out new features without having to go offline and reconnect to the Gateway. For example, a gateway instance that queues messages in rabbitmq + some app instances to handle commands.
We do deploy 2 Machines for every process with services (unless there’s a volume mounted), for redundancy. But while 2 Machines is usually better, there are cases where users only want 1 Machine. As already mentioned, you can destroy one of the Machines. Then, when you deploy again, use the --ha flag to turn off the redundancy feature: