win-local-inc/remote-cron

A package for remote cron.

1.1.0 2023-04-19 05:40 UTC

This package is auto-updated.

Last update: 2024-10-19 08:55:56 UTC


README

Installation

  • update array to your needs in config/remotecron.php with
[
    'middleware' => [
        'throttle:remotecron',
        WinLocal\RemoteCron\Middleware\TokenAuth::class,
    ],
    'path' => env('WINLOCAL_CRON_PATH', 'remote/cron'),
    'queue_connection' => env('WINLOCAL_CRON_QUEUE_CONNECTION', 'redis'),
    'token' => env('WINLOCAL_CRON_TOKEN'),
];
  • add envs :
WINLOCAL_CRON_PATH=
WINLOCAL_CRON_TOKEN=
WINLOCAL_CRON_QUEUE_CONNECTION=
  • each service needs to run supervisor

php artisan queue:work redis --max-time=3600 --max-jobs=100 --tries=3 --timeout=3550

  • new cron jobs needs to be add in super admin service database in tables : cron_services, cron_jobs

cron_services
name: Advert
url: https://sericename.stage.com/remote/cron 
token: ***token***

cron_jobs
name: Report Upload
command: facebook:upload
parameters:
schedule: */10 * * * *

  • to run tests on package

vendor/bin/testbench package:test --configuration=tests/phpunit.xml