horizon.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <?php
  2. use Illuminate\Support\Str;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Horizon Name
  7. |--------------------------------------------------------------------------
  8. |
  9. | This name appears in notifications and in the Horizon UI. Unique names
  10. | can be useful while running multiple instances of Horizon within an
  11. | application, allowing you to identify the Horizon you're viewing.
  12. |
  13. */
  14. 'name' => env('HORIZON_NAME'),
  15. /*
  16. |--------------------------------------------------------------------------
  17. | Horizon Domain
  18. |--------------------------------------------------------------------------
  19. |
  20. | This is the subdomain where Horizon will be accessible from. If this
  21. | setting is null, Horizon will reside under the same domain as the
  22. | application. Otherwise, this value will serve as the subdomain.
  23. |
  24. */
  25. 'domain' => env('HORIZON_DOMAIN'),
  26. /*
  27. |--------------------------------------------------------------------------
  28. | Horizon Path
  29. |--------------------------------------------------------------------------
  30. |
  31. | This is the URI path where Horizon will be accessible from. Feel free
  32. | to change this path to anything you like. Note that the URI will not
  33. | affect the paths of its internal API that aren't exposed to users.
  34. |
  35. */
  36. 'path' => env('HORIZON_PATH', 'horizon'),
  37. /*
  38. |--------------------------------------------------------------------------
  39. | Horizon Redis Connection
  40. |--------------------------------------------------------------------------
  41. |
  42. | This is the name of the Redis connection where Horizon will store the
  43. | meta information required for it to function. It includes the list
  44. | of supervisors, failed jobs, job metrics, and other information.
  45. |
  46. */
  47. 'use' => 'default',
  48. /*
  49. |--------------------------------------------------------------------------
  50. | Horizon Redis Prefix
  51. |--------------------------------------------------------------------------
  52. |
  53. | This prefix will be used when storing all Horizon data in Redis. You
  54. | may modify the prefix when you are running multiple installations
  55. | of Horizon on the same server so that they don't have problems.
  56. |
  57. */
  58. 'prefix' => env(
  59. 'HORIZON_PREFIX',
  60. Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
  61. ),
  62. /*
  63. |--------------------------------------------------------------------------
  64. | Horizon Route Middleware
  65. |--------------------------------------------------------------------------
  66. |
  67. | These middleware will get attached onto each Horizon route, giving you
  68. | the chance to add your own middleware to this list or change any of
  69. | the existing middleware. Or, you can simply stick with this list.
  70. |
  71. */
  72. 'middleware' => ['web'],
  73. /*
  74. |--------------------------------------------------------------------------
  75. | Queue Wait Time Thresholds
  76. |--------------------------------------------------------------------------
  77. |
  78. | This option allows you to configure when the LongWaitDetected event
  79. | will be fired. Every connection / queue combination may have its
  80. | own, unique threshold (in seconds) before this event is fired.
  81. |
  82. */
  83. 'waits' => [
  84. 'redis:default' => 60,
  85. ],
  86. /*
  87. |--------------------------------------------------------------------------
  88. | Job Trimming Times
  89. |--------------------------------------------------------------------------
  90. |
  91. | Here you can configure for how long (in minutes) you desire Horizon to
  92. | persist the recent and failed jobs. Typically, recent jobs are kept
  93. | for one hour while all failed jobs are stored for an entire week.
  94. |
  95. */
  96. 'trim' => [
  97. 'recent' => 60,
  98. 'pending' => 60,
  99. 'completed' => 60,
  100. 'recent_failed' => 10080,
  101. 'failed' => 10080,
  102. 'monitored' => 10080,
  103. ],
  104. /*
  105. |--------------------------------------------------------------------------
  106. | Silenced Jobs
  107. |--------------------------------------------------------------------------
  108. |
  109. | Silencing a job will instruct Horizon to not place the job in the list
  110. | of completed jobs within the Horizon dashboard. This setting may be
  111. | used to fully remove any noisy jobs from the completed jobs list.
  112. |
  113. */
  114. 'silenced' => [
  115. // App\Jobs\ExampleJob::class,
  116. ],
  117. 'silenced_tags' => [
  118. // 'notifications',
  119. ],
  120. /*
  121. |--------------------------------------------------------------------------
  122. | Metrics
  123. |--------------------------------------------------------------------------
  124. |
  125. | Here you can configure how many snapshots should be kept to display in
  126. | the metrics graph. This will get used in combination with Horizon's
  127. | `horizon:snapshot` schedule to define how long to retain metrics.
  128. |
  129. */
  130. 'metrics' => [
  131. 'trim_snapshots' => [
  132. 'job' => 24,
  133. 'queue' => 24,
  134. ],
  135. ],
  136. /*
  137. |--------------------------------------------------------------------------
  138. | Fast Termination
  139. |--------------------------------------------------------------------------
  140. |
  141. | When this option is enabled, Horizon's "terminate" command will not
  142. | wait on all of the workers to terminate unless the --wait option
  143. | is provided. Fast termination can shorten deployment delay by
  144. | allowing a new instance of Horizon to start while the last
  145. | instance will continue to terminate each of its workers.
  146. |
  147. */
  148. 'fast_termination' => false,
  149. /*
  150. |--------------------------------------------------------------------------
  151. | Memory Limit (MB)
  152. |--------------------------------------------------------------------------
  153. |
  154. | This value describes the maximum amount of memory the Horizon master
  155. | supervisor may consume before it is terminated and restarted. For
  156. | configuring these limits on your workers, see the next section.
  157. |
  158. */
  159. 'memory_limit' => 64,
  160. /*
  161. |--------------------------------------------------------------------------
  162. | Queue Worker Configuration
  163. |--------------------------------------------------------------------------
  164. |
  165. | Here you may define the queue worker settings used by your application
  166. | in all environments. These supervisors and settings handle all your
  167. | queued jobs and will be provisioned by Horizon during deployment.
  168. |
  169. */
  170. 'defaults' => [
  171. 'supervisor-1' => [
  172. 'connection' => 'redis',
  173. 'queue' => ['default'],
  174. 'balance' => 'auto',
  175. 'autoScalingStrategy' => 'time',
  176. 'maxProcesses' => 1,
  177. 'maxTime' => 0,
  178. 'maxJobs' => 0,
  179. 'memory' => 128,
  180. 'tries' => 1,
  181. 'timeout' => 60,
  182. 'nice' => 0,
  183. ],
  184. ],
  185. 'environments' => [
  186. 'production' => [
  187. 'supervisor-1' => [
  188. 'maxProcesses' => 10,
  189. 'balanceMaxShift' => 1,
  190. 'balanceCooldown' => 3,
  191. ],
  192. ],
  193. 'local' => [
  194. 'supervisor-1' => [
  195. 'maxProcesses' => 3,
  196. ],
  197. ],
  198. ],
  199. /*
  200. |--------------------------------------------------------------------------
  201. | File Watcher Configuration
  202. |--------------------------------------------------------------------------
  203. |
  204. | The following list of directories and files will be watched when using
  205. | the `horizon:listen` command. Whenever any directories or files are
  206. | changed, Horizon will automatically restart to apply all changes.
  207. |
  208. */
  209. 'watch' => [
  210. 'app',
  211. 'bootstrap',
  212. 'config/**/*.php',
  213. 'database/**/*.php',
  214. 'public/**/*.php',
  215. 'resources/**/*.php',
  216. 'routes',
  217. 'composer.lock',
  218. 'composer.json',
  219. '.env',
  220. ],
  221. ];