Skip to content

Commit 2c2d7ae

Browse files
committed
Update Horizon config
1 parent bd60cdd commit 2c2d7ae

File tree

1 file changed

+132
-11
lines changed

1 file changed

+132
-11
lines changed

config/horizon.php

Lines changed: 132 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,36 @@
11
<?php
22

3+
use Illuminate\Support\Str;
4+
use Laravel\Scout\Jobs\MakeSearchable;
5+
36
return [
47

8+
/*
9+
|--------------------------------------------------------------------------
10+
| Horizon Domain
11+
|--------------------------------------------------------------------------
12+
|
13+
| This is the subdomain where Horizon will be accessible from. If this
14+
| setting is null, Horizon will reside under the same domain as the
15+
| application. Otherwise, this value will serve as the subdomain.
16+
|
17+
*/
18+
19+
'domain' => env('HORIZON_DOMAIN'),
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Horizon Path
24+
|--------------------------------------------------------------------------
25+
|
26+
| This is the URI path where Horizon will be accessible from. Feel free
27+
| to change this path to anything you like. Note that the URI will not
28+
| affect the paths of its internal API that aren't exposed to users.
29+
|
30+
*/
31+
32+
'path' => env('HORIZON_PATH', 'horizon'),
33+
534
/*
635
|--------------------------------------------------------------------------
736
| Horizon Redis Connection
@@ -26,7 +55,24 @@
2655
|
2756
*/
2857

29-
'prefix' => env('HORIZON_PREFIX', 'horizon:'),
58+
'prefix' => env(
59+
'HORIZON_PREFIX',
60+
'horizon:'
61+
// Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
62+
),
63+
64+
/*
65+
|--------------------------------------------------------------------------
66+
| Horizon Route Middleware
67+
|--------------------------------------------------------------------------
68+
|
69+
| These middleware will get attached onto each Horizon route, giving you
70+
| the chance to add your own middleware to this list or change any of
71+
| the existing middleware. Or, you can simply stick with this list.
72+
|
73+
*/
74+
75+
'middleware' => ['web'],
3076

3177
/*
3278
|--------------------------------------------------------------------------
@@ -56,9 +102,74 @@
56102

57103
'trim' => [
58104
'recent' => 60,
105+
'pending' => 60,
106+
'completed' => 60,
107+
'recent_failed' => 10080,
59108
'failed' => 10080,
109+
'monitored' => 10080,
60110
],
61111

112+
/*
113+
|--------------------------------------------------------------------------
114+
| Silenced Jobs
115+
|--------------------------------------------------------------------------
116+
|
117+
| Silencing a job will instruct Horizon to not place the job in the list
118+
| of completed jobs within the Horizon dashboard. This setting may be
119+
| used to fully remove any noisy jobs from the completed jobs list.
120+
|
121+
*/
122+
123+
'silenced' => [
124+
MakeSearchable::class,
125+
],
126+
127+
/*
128+
|--------------------------------------------------------------------------
129+
| Metrics
130+
|--------------------------------------------------------------------------
131+
|
132+
| Here you can configure how many snapshots should be kept to display in
133+
| the metrics graph. This will get used in combination with Horizon's
134+
| `horizon:snapshot` schedule to define how long to retain metrics.
135+
|
136+
*/
137+
138+
'metrics' => [
139+
'trim_snapshots' => [
140+
'job' => 24,
141+
'queue' => 24,
142+
],
143+
],
144+
145+
/*
146+
|--------------------------------------------------------------------------
147+
| Fast Termination
148+
|--------------------------------------------------------------------------
149+
|
150+
| When this option is enabled, Horizon's "terminate" command will not
151+
| wait on all of the workers to terminate unless the --wait option
152+
| is provided. Fast termination can shorten deployment delay by
153+
| allowing a new instance of Horizon to start while the last
154+
| instance will continue to terminate each of its workers.
155+
|
156+
*/
157+
158+
'fast_termination' => false,
159+
160+
/*
161+
|--------------------------------------------------------------------------
162+
| Memory Limit (MB)
163+
|--------------------------------------------------------------------------
164+
|
165+
| This value describes the maximum amount of memory the Horizon master
166+
| supervisor may consume before it is terminated and restarted. For
167+
| configuring these limits on your workers, see the next section.
168+
|
169+
*/
170+
171+
'memory_limit' => 64,
172+
62173
/*
63174
|--------------------------------------------------------------------------
64175
| Queue Worker Configuration
@@ -70,24 +181,34 @@
70181
|
71182
*/
72183

184+
'defaults' => [
185+
'supervisor-1' => [
186+
'connection' => 'redis',
187+
'queue' => ['default'],
188+
'balance' => 'auto',
189+
'autoScalingStrategy' => 'time',
190+
'maxProcesses' => 1,
191+
'maxTime' => 0,
192+
'maxJobs' => 0,
193+
'memory' => 128,
194+
'tries' => 1,
195+
'timeout' => 60,
196+
'nice' => 0,
197+
],
198+
],
199+
73200
'environments' => [
74201
'production' => [
75202
'supervisor-1' => [
76-
'connection' => 'redis',
77-
'queue' => ['default'],
78-
'balance' => 'simple',
79-
'processes' => 10,
80-
'tries' => 3,
203+
'maxProcesses' => 10,
204+
'balanceMaxShift' => 1,
205+
'balanceCooldown' => 3,
81206
],
82207
],
83208

84209
'local' => [
85210
'supervisor-1' => [
86-
'connection' => 'redis',
87-
'queue' => ['default'],
88-
'balance' => 'simple',
89-
'processes' => 3,
90-
'tries' => 3,
211+
'maxProcesses' => 3,
91212
],
92213
],
93214
],

0 commit comments

Comments
 (0)