Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117819981
D1756.1775293955.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
8 KB
Referenced Files
None
Subscribers
None
D1756.1775293955.diff
View Options
diff --git a/docker/worker/kolab-worker.sh b/docker/worker/kolab-worker.sh
--- a/docker/worker/kolab-worker.sh
+++ b/docker/worker/kolab-worker.sh
@@ -15,4 +15,4 @@
./artisan db:ping --wait
-./artisan queue:work
+./artisan horizon
diff --git a/src/app/Providers/HorizonServiceProvider.php b/src/app/Providers/HorizonServiceProvider.php
new file mode 100644
--- /dev/null
+++ b/src/app/Providers/HorizonServiceProvider.php
@@ -0,0 +1,26 @@
+<?php
+
+namespace App\Providers;
+
+use Illuminate\Support\Facades\Gate;
+use Laravel\Horizon\Horizon;
+use Laravel\Horizon\HorizonApplicationServiceProvider;
+
+class HorizonServiceProvider extends HorizonApplicationServiceProvider
+{
+ /**
+ * Bootstrap any application services.
+ *
+ * @return void
+ */
+ public function boot()
+ {
+ parent::boot();
+
+ // Horizon::routeSmsNotificationsTo('15556667777');
+ // Horizon::routeMailNotificationsTo('example@example.com');
+ // Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
+
+ Horizon::night();
+ }
+}
diff --git a/src/composer.json b/src/composer.json
--- a/src/composer.json
+++ b/src/composer.json
@@ -22,6 +22,7 @@
"iatstuti/laravel-nullable-fields": "*",
"kolab/net_ldap3": "dev-master",
"laravel/framework": "6.*",
+ "laravel/horizon": "^3",
"laravel/tinker": "^2.4",
"mollie/laravel-mollie": "^2.9",
"morrislaptop/laravel-queue-clear": "^1.2",
diff --git a/src/config/app.php b/src/config/app.php
--- a/src/config/app.php
+++ b/src/config/app.php
@@ -185,6 +185,7 @@
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
+ App\Providers\HorizonServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
diff --git a/src/config/horizon.php b/src/config/horizon.php
new file mode 100644
--- /dev/null
+++ b/src/config/horizon.php
@@ -0,0 +1,166 @@
+<?php
+
+return [
+
+ /*
+ |--------------------------------------------------------------------------
+ | Horizon Domain
+ |--------------------------------------------------------------------------
+ |
+ | This is the subdomain where Horizon will be accessible from. If this
+ | setting is null, Horizon will reside under the same domain as the
+ | application. Otherwise, this value will serve as the subdomain.
+ |
+ */
+
+ 'domain' => 'admin.' . env('APP_DOMAIN'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Horizon Path
+ |--------------------------------------------------------------------------
+ |
+ | This is the URI path where Horizon will be accessible from. Feel free
+ | to change this path to anything you like. Note that the URI will not
+ | affect the paths of its internal API that aren't exposed to users.
+ |
+ */
+
+ 'path' => 'horizon',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Horizon Redis Connection
+ |--------------------------------------------------------------------------
+ |
+ | This is the name of the Redis connection where Horizon will store the
+ | meta information required for it to function. It includes the list
+ | of supervisors, failed jobs, job metrics, and other information.
+ |
+ */
+
+ 'use' => 'default',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Horizon Redis Prefix
+ |--------------------------------------------------------------------------
+ |
+ | This prefix will be used when storing all Horizon data in Redis. You
+ | may modify the prefix when you are running multiple installations
+ | of Horizon on the same server so that they don't have problems.
+ |
+ */
+
+ 'prefix' => env('HORIZON_PREFIX', 'horizon:'),
+
+ /*
+ |--------------------------------------------------------------------------
+ | Horizon Route Middleware
+ |--------------------------------------------------------------------------
+ |
+ | These middleware will get attached onto each Horizon route, giving you
+ | the chance to add your own middleware to this list or change any of
+ | the existing middleware. Or, you can simply stick with this list.
+ |
+ */
+
+ 'middleware' => ['web'],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Queue Wait Time Thresholds
+ |--------------------------------------------------------------------------
+ |
+ | This option allows you to configure when the LongWaitDetected event
+ | will be fired. Every connection / queue combination may have its
+ | own, unique threshold (in seconds) before this event is fired.
+ |
+ */
+
+ 'waits' => [
+ 'redis:default' => 60,
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Job Trimming Times
+ |--------------------------------------------------------------------------
+ |
+ | Here you can configure for how long (in minutes) you desire Horizon to
+ | persist the recent and failed jobs. Typically, recent jobs are kept
+ | for one hour while all failed jobs are stored for an entire week.
+ |
+ */
+
+ 'trim' => [
+ 'recent' => 10080,
+ 'completed' => 10080,
+ 'recent_failed' => 10080,
+ 'failed' => 10080,
+ 'monitored' => 10080,
+ ],
+
+ /*
+ |--------------------------------------------------------------------------
+ | Fast Termination
+ |--------------------------------------------------------------------------
+ |
+ | When this option is enabled, Horizon's "terminate" command will not
+ | wait on all of the workers to terminate unless the --wait option
+ | is provided. Fast termination can shorten deployment delay by
+ | allowing a new instance of Horizon to start while the last
+ | instance will continue to terminate each of its workers.
+ |
+ */
+
+ 'fast_termination' => false,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Memory Limit (MB)
+ |--------------------------------------------------------------------------
+ |
+ | This value describes the maximum amount of memory the Horizon worker
+ | may consume before it is terminated and restarted. You should set
+ | this value according to the resources available to your server.
+ |
+ */
+
+ 'memory_limit' => 64,
+
+ /*
+ |--------------------------------------------------------------------------
+ | Queue Worker Configuration
+ |--------------------------------------------------------------------------
+ |
+ | Here you may define the queue worker settings used by your application
+ | in all environments. These supervisors and settings handle all your
+ | queued jobs and will be provisioned by Horizon during deployment.
+ |
+ */
+
+ 'environments' => [
+ 'production' => [
+ 'supervisor-1' => [
+ 'connection' => 'redis',
+ 'queue' => ['default'],
+ 'balance' => 'auto',
+ 'maxProcesses' => 1,
+ 'minProcesses' => 0,
+ 'tries' => 1,
+ ],
+ ],
+
+ 'local' => [
+ 'supervisor-1' => [
+ 'connection' => 'redis',
+ 'queue' => ['default'],
+ 'balance' => 'auto',
+ 'maxProcesses' => 1,
+ 'minProcesses' => 0,
+ 'tries' => 1,
+ ],
+ ],
+ ],
+];
diff --git a/src/tests/Functional/HorizonTest.php b/src/tests/Functional/HorizonTest.php
new file mode 100644
--- /dev/null
+++ b/src/tests/Functional/HorizonTest.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Tests\Functional;
+
+use Tests\TestCase;
+
+class HorizonTest extends TestCase
+{
+ public function testAdminAccess()
+ {
+ $this->useAdminUrl();
+
+ $response = $this->get('horizon/dashboard');
+
+ $response->assertStatus(200);
+ }
+
+ public function testRegularAccess()
+ {
+ $response = $this->get('horizon/dashboard');
+
+ $response->assertStatus(404);
+ }
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 4, 9:12 AM (20 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821461
Default Alt Text
D1756.1775293955.diff (8 KB)
Attached To
Mode
D1756: Include horizon
Attached
Detach File
Event Timeline