-
Notifications
You must be signed in to change notification settings - Fork 2
/
extend.php
98 lines (87 loc) · 4.49 KB
/
extend.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
/*
* This file is part of blomstra/horizon.
*
* Copyright (c) Bokt.
* Copyright (c) Blomstra Ltd.
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Blomstra\Horizon;
use Blomstra\Redis\Extend\Bindings;
use Flarum\Extend as Flarum;
use Flarum\Settings\Event\Saved;
use Illuminate\Console\Scheduling\Event;
use Laravel\Horizon\Console as Laravel;
return [
(new Flarum\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/resources/less/admin.less')
->content(Content\AdminContent::class),
new Flarum\Locales(__DIR__.'/resources/locale'),
new Bindings(),
(new Flarum\Settings())
->default('blomstra-horizon.trim.recent', 60)
->default('blomstra-horizon.trim.pending', 60)
->default('blomstra-horizon.trim.completed', 60)
->default('blomstra-horizon.trim.recent_failed', 10080)
->default('blomstra-horizon.trim.failed', 10080)
->default('blomstra-horizon.trim.monitored', 10080),
(new Flarum\ServiceProvider())
->register(Providers\HorizonServiceProvider::class),
(new Flarum\Console())
->command(Laravel\HorizonCommand::class)
->command(Laravel\ListCommand::class)
->command(Laravel\PurgeCommand::class)
->command(Laravel\PauseCommand::class)
->command(Laravel\ContinueCommand::class)
->command(Laravel\StatusCommand::class)
->command(Laravel\SupervisorCommand::class)
->command(Laravel\SupervisorsCommand::class)
->command(Laravel\TerminateCommand::class)
->command(Laravel\TimeoutCommand::class)
->command(Console\WorkCommand::class)
->command(Laravel\SnapshotCommand::class)
->command(Laravel\ClearMetricsCommand::class)
->schedule(Laravel\SnapshotCommand::class, function (Event $schedule) {
$schedule->everyMinute()->onOneServer()->withoutOverlapping();
}),
// Routes
(new Flarum\Routes('admin'))
// Dashboard Routes...
->get('/horizon/api/stats', 'horizon.stats.index', Api\Stats::class)
// Workload Routes...
->get('/horizon/api/workload', 'horizon.workload.index', Api\Workload::class)
// Master Supervisor Routes...
->get('/horizon/api/masters', 'horizon.masters.index', Api\Masters::class)
->get('/horizon/api/monitoring', 'horizon.monitoring.index', Api\Monitoring::class)
// Monitoring Routes...
->post('/horizon/api/monitoring', 'horizon.monitoring.store', Api\MonitorTag::class)
->get('/horizon/api/monitoring/{tag}', 'horizon.monitoring-tag.paginate', Api\TagMonitoring::class)
->delete('/horizon/api/monitoring/{tag}', 'horizon.monitoring-tag.destroy', Api\StopMonitoringTag::class)
// Job Metric Routes...
->get('/horizon/api/metrics/jobs', 'horizon.jobs-metrics.index', Api\Metrics::class)
->get('/horizon/api/metrics/jobs/{id}', 'horizon.jobs-metrics.show', Api\JobMetrics::class)
// Queue Metric Routes...
->get('/horizon/api/metrics/queues', 'horizon.queues-metrics.index', Api\QueueMetrics::class)
->get('/horizon/api/metrics/queues/{id}', 'horizon.queues-metrics.show', Api\QueueJobMetrics::class)
// Batches Routes...
->get('/horizon/api/batches', 'horizon.jobs-batches.index', Api\Batches::class)
->get('/horizon/api/batches/{id}', 'horizon.jobs-batches.show', Api\Batch::class)
->post('/horizon/api/batches/retry/{id}', 'horizon.jobs-batches.retry', Api\RetryBatch::class)
// Job Routes...
->get('/horizon/api/jobs/pending', 'horizon.pending-jobs.index', Api\PendingJobs::class)
->get('/horizon/api/jobs/completed', 'horizon.completed-jobs.index', Api\CompletedJobs::class)
->get('/horizon/api/jobs/silenced', 'horizon.silenced-jobs.index', Api\SilencedJobs::class)
->get('/horizon/api/jobs/failed', 'horizon.failed-jobs.index', Api\FailedJobs::class)
->get('/horizon/api/jobs/failed/{id}', 'horizon.failed-jobs.show', Api\FailedJob::class)
->post('/horizon/api/jobs/retry/{id}', 'horizon.retry-jobs.show', Api\RetryJob::class)
->get('/horizon/api/jobs/{id}', 'horizon.jobs.show', Api\Job::class)
->get('/horizon', 'horizon.index', Http\Home::class)
->get('/horizon/{view:.*}', 'horizon.index.view', Http\Home::class),
// Assets
new Extend\PublishAssets(),
(new Flarum\View())
->namespace('horizon', __DIR__.'/resources/views'),
];