Single Worker + Multiple Web

Hello!

I’m trying to understand the multiple processes docs but im not understanding it too well. I have a worker program that just runs a couple of cron jobs + another program that responds to rest api calls. Do I need to have two different apps? Or is it possible to say that my worker program is a separate command. Ideally I would only like to have one worker instance running (even if scaled, only one should ever run), and then be able to scale the API.

Hi there

This is exactly what multiprocess Fly apps are for. You can scale the workers and api independent of each other, as they get each get their own VM. Both are behind the same public IP, however. And if you intend to use 6pn (Fly’s private network), this setup may not work as intended.

If you’re looking to use the latest and greatest, for cron jobs, have a look at: New feature: Scheduled machines

And for api, run them in Machines (Apps v2).

There’s multi-process Machines which in fact run all processes on all VMs, but it doesn’t seem like that’s what you want.

This: Preview: multi process apps (get your workers here!) is exactly what I was looking for! Thank you!!

1 Like