Skip to content

Commit

Permalink
install schedule monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmajor committed May 3, 2024
1 parent 0bcdea4 commit 532a0ee
Show file tree
Hide file tree
Showing 5 changed files with 269 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ S3_BUCKET_BACKUP=

FATHOM_SITE_ID=

OH_DEAR_API_TOKEN=
OH_DEAR_SITE_ID=
OH_DEAR_QUEUE=

SENTRY_PHP_DSN=
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
"league/flysystem-aws-s3-v3": "^3.27",
"livewire/livewire": "^3.4",
"nesbot/carbon": "^3.2",
"ohdearapp/ohdear-php-sdk": "^3.10",
"sentry/sentry-laravel": "^4.5",
"spatie/laravel-activitylog": "dev-fix-tapping#9d38653",
"spatie/laravel-flash": "^1.10",
"spatie/laravel-schedule-monitor": "^3.7",
"spatie/laravel-sitemap": "^7.2",
"symfony/css-selector": "^7.0",
"symfony/dom-crawler": "^7.0",
Expand Down
193 changes: 192 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions config/schedule-monitor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

return [

'delete_log_items_older_than_days' => 30,

'date_format' => 'Y-m-d H:i:s',

'models' => [
'monitored_scheduled_task' => Spatie\ScheduleMonitor\Models\MonitoredScheduledTask::class,
'monitored_scheduled_log_item' => Spatie\ScheduleMonitor\Models\MonitoredScheduledTaskLogItem::class,
],

'oh_dear' => [
'api_token' => env('OH_DEAR_API_TOKEN', ''),
'site_id' => env('OH_DEAR_SITE_ID'),
'queue' => env('OH_DEAR_QUEUE'),
'retry_job_for_minutes' => 10,
'silence_ping_oh_dear_job_in_horizon' => true,
'send_starting_ping' => env('OH_DEAR_SEND_STARTING_PING', false),
],

];
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up(): void
{
Schema::create('monitored_scheduled_tasks', function (Blueprint $table) {
$table->id();

$table->string('name');
$table->string('type')->nullable();
$table->string('cron_expression');
$table->string('timezone')->nullable();
$table->string('ping_url')->nullable();

$table->dateTime('last_started_at')->nullable();
$table->dateTime('last_finished_at')->nullable();
$table->dateTime('last_failed_at')->nullable();
$table->dateTime('last_skipped_at')->nullable();

$table->dateTime('registered_on_oh_dear_at')->nullable();
$table->dateTime('last_pinged_at')->nullable();
$table->integer('grace_time_in_minutes');

$table->timestamps();
});

Schema::create('monitored_scheduled_task_log_items', function (Blueprint $table) {
$table->id();

$table->unsignedBigInteger('monitored_scheduled_task_id');
$table
->foreign('monitored_scheduled_task_id', 'fk_scheduled_task_id')
->references('id')
->on('monitored_scheduled_tasks')
->cascadeOnDelete();

$table->string('type');

$table->json('meta')->nullable();

$table->timestamps();
});
}
};

0 comments on commit 532a0ee

Please sign in to comment.