[0:00] right so I'm going to show you how to [0:01] use Horizon today we're going to deploy [0:03] it in our doer environment and it's [0:04] going to be really simple I'm using this [0:06] template here and it's my own template [0:09] that I made from one of the previous [0:10] videos I'll put a link in the [0:11] description you can just clone it and [0:13] continue to work from there the template [0:14] already has the laravel app it has a q [0:17] worker it has ngx database and Redd is [0:20] ready so it's going to be fairly simple [0:22] to use I recommend that you start from [0:24] this template but if you have your own [0:26] Docker compose file you can just use [0:28] that so let's get started here the first [0:30] thing that we have to replace here is [0:31] the Q worker so instead of naming it Q [0:33] worker we have to name this service [0:35] Horizon and we're going to change the [0:36] start command from Q work to Horizon so [0:39] this is the only thing required to be [0:41] changed in the dock compose yl file we [0:43] have to run Horizon with this command [0:46] next thing that we have to do is go to [0:47] our Docker file and we have to install [0:50] pcnl as our dependency so we're going to [0:52] be adding pcnl this is used by Horizon [0:55] and that's why we're installing it now [0:57] we're done with the docker file and [1:00] we're done with Docker composed. yaml we [1:02] have to install Horizon so you're going [1:03] to go to LL you're going to go to the [1:05] latest version and you're going to [1:07] install Horizon with composer so I'm [1:10] going to open my terminal I'm going to [1:12] CD into the backend directory so you [1:15] should be careful to not install it here [1:17] in the root you should install it in the [1:19] back end and you copy this command we [1:21] install Horizon and then once this is [1:23] install we just have to run PHP artison [1:25] Horizon install the scaffolding is done [1:29] and you should see new files in your [1:32] project here we have the horizon. PHP [1:35] file and this gives you the config for [1:37] Horizon you should read this [1:38] documentation up I'm not going to be [1:40] doing a tutorial on this but essentially [1:42] you have the supervisors and you can say [1:44] how many processes there are the memory [1:46] how many jobs cues and so on balancing [1:49] in these strategies and so on so you [1:52] have this file here and we're mostly set [1:54] up so let's add a test job here and I'm [1:56] going to add a process click job and [2:00] this is going to be a really simple job [2:01] we're just going to go to the process [2:03] click here and we're going to add a log [2:06] so we want to see the output and we want [2:08] to see if this works and we're going to [2:09] import this from the support log here [2:13] and there you go so we have this process [2:14] click job and now we want to go to our [2:17] routes web and let's add a process click [2:21] job so for example we can go to our a [2:24] URL and it's going to be adding a job to [2:27] the queue and returning a response Json [2:30] so once we set everything up here we [2:32] check our EnV our EnV should have PHP [2:35] redus the redus host the redus password [2:38] and the red is Port again when you're [2:40] running this from a Docker environment [2:42] you're going to be adding the service [2:44] name but when you're running this [2:46] locally you should be adding this local [2:48] host address so if we have everything [2:50] set up here we can just say Docker [2:53] compose up build detach and wait for the [2:56] containers to finish building so now [2:58] that the containers have been built [3:00] let's go to our Local Host here so I'm [3:03] going to go to Local Host we have the [3:06] laravel let's go to [3:08] Horizon and we have the Horizon [3:10] dashboard that's it here you go total [3:12] process is one it's active we have [3:14] monitoring metrics batches pending jobs [3:17] completed jobs and let's just test it [3:18] out so we have the click route so if we [3:23] go here we returned true so it should [3:25] run two jobs right now so if I reload [3:28] there you go total processes Jobs pass [3:30] to so if I go to completed jobs you see [3:33] process click job Q default it gives you [3:36] the data and let's just let's just run [3:38] as many jobs as I can so I'm going to go [3:40] here and I'm I'm going to press controlr [3:42] here to reload as many times as I can [3:45] and if I now go back to Horizon go to [3:48] the dashboard you see jav's passed hour [3:51] 35 everything's working status is active [3:53] there if there are any fail jobs it will [3:55] show you here you have batches metrics [3:58] and you have in metrics here I love this [4:00] that it shows you which queue you can [4:03] select by which queue the jobs have been [4:05] done and the actual job so you can [4:07] process click and you can see the data [4:09] of course you don't have the throughput [4:10] and runtime because I started this like [4:11] two minutes ago but the more data you [4:13] have you'll have metrics here and this [4:15] is how you can host Horizon it's very [4:17] simple please leave a like so that other [4:19] people see this so that they don't get [4:21] scammed for paying templates that are [4:24] $100 please like this so people can see [4:26] it and I think this is beautiful Horizon [4:29] is is a really powerful tool and you [4:31] should use it use it in many many [4:33] projects