Auto-scaled queue workers on

0.1.0 2023-12-07 15:13 UTC

This package is auto-updated.

Last update: 2024-04-07 15:56:08 UTC


This package will create Machines machines on-demand as needed when your queue worker reaches certain thresholds.


You can install the package via composer:

composer require fly/laravel-workers

You can publish the config file with:

php artisan vendor:publish --tag="config"

This is the contents of the published config file:

return [
    'app_name' => env('FLY_APP_NAME'),
    'api_key' => env('FLY_API_KEY'),
    'region' => env('FLY_REGION'),
    'image' => env('FLY_IMAGE_REF'),
    'min_workers' => 2,                 // Number of base workers, always present
    'max_workers' => 10,                // Scale to a max of this many workers
    'scale_controller' => [             // Scale up as directed by this scaler
        'class' => \Fly\Worker\Scalers\JobsPerWorker::class,
        'jobs_per_machine' => 10,
    'vm' => [
        'cpu_kind' => 'shared', // vs dedicated
        'cpus' => 1,
        'memory_mb' => 1024
    'connection' => null, // default
    'queue' => null, // default


Add the fly:work command to your scheduler to run once a minute, on one server:


This command will scale up (and down) queue workers on machines as directed by the Scaler class.

This assumes you are running your Laravel application on as well!


The MIT License (MIT). Please see License File for more information.