horizon.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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:payment-reconcile' => 30,
  85. 'redis:notifications' => 60,
  86. 'redis:broadcastable' => 60,
  87. 'redis:api-logs' => 120,
  88. 'redis:default' => 60,
  89. ],
  90. /*
  91. |--------------------------------------------------------------------------
  92. | Job Trimming Times
  93. |--------------------------------------------------------------------------
  94. |
  95. | Here you can configure for how long (in minutes) you desire Horizon to
  96. | persist the recent and failed jobs. Typically, recent jobs are kept
  97. | for one hour while all failed jobs are stored for an entire week.
  98. |
  99. */
  100. 'trim' => [
  101. 'recent' => 60,
  102. 'pending' => 60,
  103. 'completed' => 60,
  104. 'recent_failed' => 10080,
  105. 'failed' => 10080,
  106. 'monitored' => 10080,
  107. ],
  108. /*
  109. |--------------------------------------------------------------------------
  110. | Silenced Jobs
  111. |--------------------------------------------------------------------------
  112. |
  113. | Silencing a job will instruct Horizon to not place the job in the list
  114. | of completed jobs within the Horizon dashboard. This setting may be
  115. | used to fully remove any noisy jobs from the completed jobs list.
  116. |
  117. */
  118. 'silenced' => [
  119. \Webkul\BagistoApi\Jobs\LogApiRequestJob::class,
  120. ],
  121. 'silenced_tags' => [
  122. // 'notifications',
  123. ],
  124. /*
  125. |--------------------------------------------------------------------------
  126. | Metrics
  127. |--------------------------------------------------------------------------
  128. |
  129. | Here you can configure how many snapshots should be kept to display in
  130. | the metrics graph. This will get used in combination with Horizon's
  131. | `horizon:snapshot` schedule to define how long to retain metrics.
  132. |
  133. */
  134. 'metrics' => [
  135. 'trim_snapshots' => [
  136. 'job' => 24,
  137. 'queue' => 24,
  138. ],
  139. ],
  140. /*
  141. |--------------------------------------------------------------------------
  142. | Fast Termination
  143. |--------------------------------------------------------------------------
  144. |
  145. | When this option is enabled, Horizon's "terminate" command will not
  146. | wait on all of the workers to terminate unless the --wait option
  147. | is provided. Fast termination can shorten deployment delay by
  148. | allowing a new instance of Horizon to start while the last
  149. | instance will continue to terminate each of its workers.
  150. |
  151. */
  152. 'fast_termination' => false,
  153. /*
  154. |--------------------------------------------------------------------------
  155. | Memory Limit (MB)
  156. |--------------------------------------------------------------------------
  157. |
  158. | This value describes the maximum amount of memory the Horizon master
  159. | supervisor may consume before it is terminated and restarted. For
  160. | configuring these limits on your workers, see the next section.
  161. |
  162. */
  163. 'memory_limit' => 64,
  164. /*
  165. |--------------------------------------------------------------------------
  166. | Queue Worker Configuration
  167. |--------------------------------------------------------------------------
  168. |
  169. | Supervisors are split so a slow index or image conversion on `default`
  170. | cannot block payment reconciliation or outbound alerts. Horizon's
  171. | supervisor `tries` and `timeout` override the same properties on a job.
  172. |
  173. | `timeout` must stay below the Redis connection `retry_after`
  174. | (config/queue.php, REDIS_QUEUE_RETRY_AFTER). The longest timeout here
  175. | is 120 seconds, so retry_after is 150.
  176. |
  177. | APP_ENV must be `production` or `local`. Any other value falls back to
  178. | `defaults` (one process per supervisor).
  179. |
  180. */
  181. 'defaults' => [
  182. 'payments' => [
  183. 'connection' => 'redis',
  184. 'queue' => ['payment-reconcile'],
  185. 'balance' => 'simple',
  186. 'maxProcesses' => 1,
  187. 'maxTime' => 0,
  188. 'maxJobs' => 0,
  189. 'memory' => 128,
  190. 'tries' => 3,
  191. 'timeout' => 60,
  192. 'sleep' => 1,
  193. 'nice' => 0,
  194. ],
  195. 'signals' => [
  196. 'connection' => 'redis',
  197. 'queue' => ['notifications', 'broadcastable', 'api-logs'],
  198. 'balance' => 'simple',
  199. 'maxProcesses' => 1,
  200. 'maxTime' => 0,
  201. 'maxJobs' => 0,
  202. 'memory' => 128,
  203. 'tries' => 3,
  204. 'timeout' => 30,
  205. 'nice' => 0,
  206. ],
  207. 'default' => [
  208. 'connection' => 'redis',
  209. 'queue' => ['default'],
  210. 'balance' => 'auto',
  211. 'autoScalingStrategy' => 'time',
  212. 'maxProcesses' => 1,
  213. 'balanceMaxShift' => 1,
  214. 'balanceCooldown' => 3,
  215. 'maxTime' => 0,
  216. 'maxJobs' => 500,
  217. 'memory' => 256,
  218. 'tries' => 3,
  219. 'timeout' => 120,
  220. 'nice' => 0,
  221. ],
  222. ],
  223. 'environments' => [
  224. 'production' => [
  225. 'payments' => [
  226. 'maxProcesses' => 2,
  227. ],
  228. 'signals' => [
  229. 'maxProcesses' => 2,
  230. ],
  231. 'default' => [
  232. 'minProcesses' => 1,
  233. 'maxProcesses' => 6,
  234. ],
  235. ],
  236. 'local' => [
  237. 'payments' => [
  238. 'maxProcesses' => 1,
  239. ],
  240. 'signals' => [
  241. 'maxProcesses' => 1,
  242. ],
  243. 'default' => [
  244. 'maxProcesses' => 2,
  245. ],
  246. ],
  247. ],
  248. /*
  249. |--------------------------------------------------------------------------
  250. | File Watcher Configuration
  251. |--------------------------------------------------------------------------
  252. |
  253. | The following list of directories and files will be watched when using
  254. | the `horizon:listen` command. Whenever any directories or files are
  255. | changed, Horizon will automatically restart to apply all changes.
  256. |
  257. */
  258. 'watch' => [
  259. 'app',
  260. 'bootstrap',
  261. 'config/**/*.php',
  262. 'database/**/*.php',
  263. 'public/**/*.php',
  264. 'resources/**/*.php',
  265. 'routes',
  266. 'composer.lock',
  267. 'composer.json',
  268. '.env',
  269. ],
  270. ];