定制 flyio/laravel-workers 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flyio/laravel-workers

最新稳定版本:0.1.0

Composer 安装命令:

composer require flyio/laravel-workers

包简介

Auto-scaled queue workers on Fly.io

README 文档

README

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

Installation

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
];

Usage

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

$schedule->command('fly:work')
    ->onOneServer()
    ->everyMinute();

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

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

License

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

统计信息

  • 总下载量: 47
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 7
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-07