How to create a scheduled machine from scratch?

I’ve read through a lot of forum posts on this topic but I’m having trouble figuring out the workflow. In part probably because I’m fairly new to the platform, but also because there are a few things I’m trying to do which skirt around the documentation. I think I’m also coming across whatever the standard was before fly apps v2.

I’d really like someone to please explain how, from scratch, to set up a scheduled machine, starting from fly launch in a directory containing a nodejs script (with package.json etc), all the way through to having a machine reliably spinning up each hour.

  • I want the machine to spin up hourly, run the script and then stop to save money (this is why I’m looking at scheduled machines instead of an always-on machine running cron)
  • The script just does some things with an API so it doesn’t need to have any exposed ports, but it does need to pass the monitoring checks
  • I only ever want one instance of the app running

Thanks in advance to anyone who can please guide me through this!

I’m still absolutely baffled by this.

As best I can tell, my app is running hourly now. But when I update anything and run fly deploy, it hangs, because it’s waiting for the app to have state “started”.

How do I know it works? Because every time I make a change I literally have to wait an hour to see some output in the logs.

I have no healthchecks in my app, because my app does not run a service on a port, it just runs a script every hour.

I’ve tried setting deploy.wait_timeout to 0s or 0m. Neither actually skips this waiting for script to start phase.

I’d love to get some guidance on how you see users using the tools you’ve made in this scenario. It’s not right having to wait for the deploy process to fail, then waiting an hour, to see that the setup is actually working.

Is fly deploy --detach the only way of successfully deploying a scheduled machine? Is there some way of putting this in fly.toml?

I have the exact same problem. When I schedule a machine, it starts in a stopped state when in fact I want it to run the entry point script until it completes and then shut down to save money. Also, why isn’t the schedule using cron syntax? I really want the machine to start at a specific time each day.

Thanks.

I’m quite happy with the simplified hourly, daily schedule as I can see this is the seedling of a bigger feature. I would just love to see a few user stories for scheduling machines with the CLI documented by the people who put this together as I suspect there are some specific incantations or configuration which will make it all fall into place for us users.

I am also wondering how to launch a scheduled machine that simply invokes an API endpoint every hour via curl or similar and then shuts off.

What’s the simplest way to set it up on fly.io?

I have an Oban app that I need to run out of office hours to make reports and then shutdown. So looking for the same schedule strategy where I can keep it running fro like 5-9pm and then shutdown