jdlxnl/task 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

jdlxnl/task

Composer 安装命令:

composer require jdlxnl/task

包简介

Task and logging for running background tasks

README 文档

README

Adds the ability to create tasks, and task logging. Adds a section to horizon to allow TaskLogs to be visible with task processing.

Install

Add this repository to your composer.json

composer require jdlxnl/task

Run the following commands to setup the database

php artisan vendor:publish --provider="Jdlx\Slack\JdlxSlackServiceProvider"
php artisan vendor:publish --provider="Jdlx\Task\JdlxTaskServiceProvider"

php artisan migrate

Install horizon

composer require laravel/horizon
php artisan horzion:publish
php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider"

Make sure to change horizon config to

[
...

    'defaults' => [
        'supervisor-1' => [
            'connection' => 'redis',
            'queue' => ['default'],
            'balance' => 'auto',
            'maxProcesses' => 1,
            'memory' => 256,
            'tries' => 1,
            'nice' => 0,
            'timeout' => 900 // set very high, have jobs control their own timeout
        ],
    ],

    'environments' => [
        'production' => [
            'supervisor-1' => [
                'maxProcesses' => 2,
                'balanceMaxShift' => 1,
                'balanceCooldown' => 3,
                'sleep' => 1
            ],
        ],

        'staging' => [
            'supervisor-1' => [
                'maxProcesses' => 1,
            ],
        ],

        'local' => [
            'supervisor-1' => [
                'maxProcesses' => 3,
            ],
        ],
    ]

    ...

 ]

Make sure to add route to the API

Route::apiResource('task-log', \Jdlx\Task\Http\Controllers\Api\TaskLogController::class);

Slack

To support slack make sure to add the following keys to .env

SLACK_WEBHOOK=https://hooks.slack.com/services/asd/B01HB2M20asdf4V/s8GCasfsaDJesxH3ZyZuHUx
SLACK_DEFAULT_CHANNEL=my-channel

Admin UI

If you have the admin UI installed, you can add the tasklog using

php artisan adminui:module:task

Client

Building the client app

Add following to webpack.mix.js

mix.js('resources/js/tasklog/index.js', 'public/vendor/jdlx/task/app.js').react();

make sure to add following packages to package.json

{
  "react": "^17.0.1",
  "react-bootstrap": "^1.4.3",
  "react-data-table-component": "^7.0.0-alpha-5",
  "react-dom": "^17.0.1",
  "react-icons": "^4.1.0",
  "react-json-view": "^1.20.4",
  "react-router": "^5.2.0",
  "react-router-dom": "^5.2.0",
  "react-select": "^3.2.0",
  "styled-components": "^5.2.1"
}

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固