horizon.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <?php
  2. use Illuminate\Support\Str;
  3. use Linfo\Linfo;
  4. $lInfo = new Linfo();
  5. $parser = $lInfo->getParser();
  6. return [
  7. /*
  8. |--------------------------------------------------------------------------
  9. | Horizon Domain
  10. |--------------------------------------------------------------------------
  11. |
  12. | This is the subdomain where Horizon will be accessible from. If this
  13. | setting is null, Horizon will reside under the same domain as the
  14. | application. Otherwise, this value will serve as the subdomain.
  15. |
  16. */
  17. 'domain' => null,
  18. /*
  19. |--------------------------------------------------------------------------
  20. | Horizon Path
  21. |--------------------------------------------------------------------------
  22. |
  23. | This is the URI path where Horizon will be accessible from. Feel free
  24. | to change this path to anything you like. Note that the URI will not
  25. | affect the paths of its internal API that aren't exposed to users.
  26. |
  27. */
  28. 'path' => 'monitor',
  29. /*
  30. |--------------------------------------------------------------------------
  31. | Horizon Redis Connection
  32. |--------------------------------------------------------------------------
  33. |
  34. | This is the name of the Redis connection where Horizon will store the
  35. | meta information required for it to function. It includes the list
  36. | of supervisors, failed jobs, job metrics, and other information.
  37. |
  38. */
  39. 'use' => 'default',
  40. /*
  41. |--------------------------------------------------------------------------
  42. | Horizon Redis Prefix
  43. |--------------------------------------------------------------------------
  44. |
  45. | This prefix will be used when storing all Horizon data in Redis. You
  46. | may modify the prefix when you are running multiple installations
  47. | of Horizon on the same server so that they don't have problems.
  48. |
  49. */
  50. 'prefix' => env(
  51. 'HORIZON_PREFIX',
  52. Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
  53. ),
  54. /*
  55. |--------------------------------------------------------------------------
  56. | Horizon Route Middleware
  57. |--------------------------------------------------------------------------
  58. |
  59. | These middleware will get attached onto each Horizon route, giving you
  60. | the chance to add your own middleware to this list or change any of
  61. | the existing middleware. Or, you can simply stick with this list.
  62. |
  63. */
  64. 'middleware' => ['admin'],
  65. /*
  66. |--------------------------------------------------------------------------
  67. | Queue Wait Time Thresholds
  68. |--------------------------------------------------------------------------
  69. |
  70. | This option allows you to configure when the LongWaitDetected event
  71. | will be fired. Every connection / queue combination may have its
  72. | own, unique threshold (in seconds) before this event is fired.
  73. |
  74. */
  75. 'waits' => [
  76. 'redis:default' => 60,
  77. ],
  78. /*
  79. |--------------------------------------------------------------------------
  80. | Job Trimming Times
  81. |--------------------------------------------------------------------------
  82. |
  83. | Here you can configure for how long (in minutes) you desire Horizon to
  84. | persist the recent and failed jobs. Typically, recent jobs are kept
  85. | for one hour while all failed jobs are stored for an entire week.
  86. |
  87. */
  88. 'trim' => [
  89. 'recent' => 60,
  90. 'pending' => 60,
  91. 'completed' => 60,
  92. 'recent_failed' => 10080,
  93. 'failed' => 10080,
  94. 'monitored' => 10080,
  95. ],
  96. /*
  97. |--------------------------------------------------------------------------
  98. | Metrics
  99. |--------------------------------------------------------------------------
  100. |
  101. | Here you can configure how many snapshots should be kept to display in
  102. | the metrics graph. This will get used in combination with Horizon's
  103. | `horizon:snapshot` schedule to define how long to retain metrics.
  104. |
  105. */
  106. 'metrics' => [
  107. 'trim_snapshots' => [
  108. 'job' => 24,
  109. 'queue' => 24,
  110. ],
  111. ],
  112. /*
  113. |--------------------------------------------------------------------------
  114. | Fast Termination
  115. |--------------------------------------------------------------------------
  116. |
  117. | When this option is enabled, Horizon's "terminate" command will not
  118. | wait on all of the workers to terminate unless the --wait option
  119. | is provided. Fast termination can shorten deployment delay by
  120. | allowing a new instance of Horizon to start while the last
  121. | instance will continue to terminate each of its workers.
  122. |
  123. */
  124. 'fast_termination' => false,
  125. /*
  126. |--------------------------------------------------------------------------
  127. | Memory Limit (MB)
  128. |--------------------------------------------------------------------------
  129. |
  130. | This value describes the maximum amount of memory the Horizon worker
  131. | may consume before it is terminated and restarted. You should set
  132. | this value according to the resources available to your server.
  133. |
  134. */
  135. 'memory_limit' => 32,
  136. /*
  137. |--------------------------------------------------------------------------
  138. | Queue Worker Configuration
  139. |--------------------------------------------------------------------------
  140. |
  141. | Here you may define the queue worker settings used by your application
  142. | in all environments. These supervisors and settings handle all your
  143. | queued jobs and will be provisioned by Horizon during deployment.
  144. |
  145. */
  146. 'environments' => [
  147. 'local' => [
  148. 'V2board' => [
  149. 'connection' => 'redis',
  150. 'queue' => [
  151. 'order_handle',
  152. 'traffic_fetch',
  153. 'stat',
  154. 'send_email',
  155. 'send_email_mass',
  156. 'send_telegram',
  157. ],
  158. 'balance' => 'auto',
  159. 'minProcesses' => 1,
  160. 'maxProcesses' => (int)ceil($parser->getRam()['total'] / 1024 / 1024 / 1024 * 6),
  161. 'tries' => 1,
  162. 'nice' => 0,
  163. ],
  164. ],
  165. ],
  166. ];