Can I set processor/memory for Laravel cron and worker machines in fly.yaml?

When I launch my app, Fly automatically creates machines to handle cron and workers, resulting in three servers at the same settings of my app servers, which run at shared-cpu-4x@8192MB. They could both probably run at 2x@4096 instead of 4x@8192. Do I need to manually scale those down after launch, or can I set that in my fly.yaml file so I don’t need to add it to my manual steps?

Would you show readers your TOML config file that you have now?

1 Like

[build]
[build.args]
NODE_VERSION = ‘22’
PHP_VERSION = ‘8.4’

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = ‘stop’
auto_start_machines = true
min_machines_running = 1
processes = [‘app’]

[[vm]]
memory = ‘8gb’
cpu_kind = ‘shared’
cpus = 4

[processes]
app = “”
cron = “cron -f”
worker = “php artisan horizon”

1 Like

The reason the syntax is [[vm]] (allowing multiple) instead of [vm] (single-only) is exactly to make it possible to customize by process group:

https://fly.io/docs/reference/configuration/#processes-2

You can even specify two different [[vm]] sections to have different compute requirements per process group.

[…]

For example the following snippet uses shared-cpu-4x for app and other process groups but performance-1x for worker group.

[processes]
app = "/start-app"
worker = "/start-worker"
other = "/start-other"

[[vm]]
size = "shared-cpu-4x"

[[vm]]
size = "performance-1x"
processes = ["worker"]
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.