Laravel Queue Zero to Hero - Horizon, Dashboard review and production setup

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Horizon is a awesome Laurel package which help you to manage your cues and jobs and it it has a beautiful dashboard which you can see how much jobs is running and how much phase how much runs pending and other things now let me show you in this video uh how we use it in Kodi Pals and also how we use it in other projects we can also configure it for yourself in any projects and I will just talk about the basics so this video should be quick and don't forget to subscribe and like this video if you like if you're interested okay let's go um so I'm in the quadri pals and uh installing Horizon first the mod first go to learn documents document and as you can see in here on the packages there is a horizon package in here there's a documentation it's completed and we don't need anything else but I will go through this document and let me show you how we configure it our application so first we need to install the prison so just I'm using the sale composite require larval Horizon and everything is ready in my project then we must do publish some configs and install the Horizon uh here so after this okay we just need to use the sale Artisan Horizon install and everything is ready in here so uh you may see some files that add to your projects uh one of the file is Horizon on the config file a config folder and this is the basic config of the Horizon and it's good to see and we will check this about the we have just something about this default and supervisor in here if you're using on production and local and everything else you can config the things in here uh the important things is about the production which we use this uh but for now just we are changing something on defaults and I will show you there uh but before using the person we must to put a change our color connection to Q connection to reduce as you may see in here on the previous video we did it on the database and here we must do change it to radius and after you change it to radius you must to configure already's host and password important other things uh I'm using here a Docker as you may see in the could we pass project also on production we have a pass a platform as a service we are using that and there is a ready stair which we can connect to that redis and here we are just using our cache sending our cues to redis and the Horizon View watch our cues and run them and it gives us good data so how we can run it but before running any commands here for running Horizon you must do go on localhost and reason address and as you can see here there is some jobs and activities and other things but this sort of you know and if you see I have some completed job but not for now and it's the failed job and other things in here but let me activate this version for activating Horizon we just need to run artisan Horizon and everything will be fine in here so as you can see we are using the Q default in here and the process will change why this has changed it's because of the on the config as you can see we are using balance Auto and this balance Auto will be balance our processes between the super multiple supervisor wizard and this will change this process and if you have a lot of jobs in EQ it will increase the process and manage by itself so we don't need to change a lot this Horizon but if you have multiple cues uh like we in a project we had a lot of cues and a lot of jobs fire on two queues and one queue was about making another jobs making some jobs for another queue and uh we had a slow q and fast and in Horizon we just separate them by each other and it helps us to gives more process to this queue to run faster and do more jobs and the slower do some more do some less and how we can do this in here as you can see we have some super Resort also on production and local we have things but I will change this default if your environment was the production this will be run in here but here on supervisor I can make another super wizard here and we can change the queues in here uh the Q name in here which will reach supervisor will run which cubes here so we have defaults in Kodi files we don't have too much cues but you can check you can Define uh which queue which job in run in which queue on the job let me find the job in the there is this is a job you just need to public queue let me see yes this is and just name it something like a Discord it's the job of the Discord and here I can just run this Discord in here don't forget to uh it's running like this restart the Horizon oh if you change any code on your jobs you need to change you need to restart the Horizon in your local others it will not run and as you can see we have a Discord and the default in here and if the Discord jobs increases the process will be increases in here but there is some also limitations like how Max process we have and other things that you can see in here so just one more step we are using Horizon also in production uh with uh as here let me show you which The Horizon in here could we Pals for reason and you see the Forbidden in here because I'm not logged in and if I log in by my accounts here okay so I can see the Horizon in here and everything will be fine but how to prevent other users to access this Horizon because we don't want to act we don't want them to access this there's an ability on Horizon service provider which you can see in here on the gate in this case as you can see there is a user and in email we in Array which will check which user can access to the Horizon by default it's empty so how we config this we made on the horizon in here make some make an array called admins and put the admins email in here which My email is this and here we can instead of the empty array uh called uh Verizon to make mistake and admins it's in here and by default we have a empty array in here so this little bit code will prevent other user to access the Horizon and just add means we Define will be accessed here also you can put a complex logic here like if your system has a rule rule and permissions you can check in here it's uh it's a gate and hopefully we could talk about the gates and policies in future in some video okay so let's check some features of the Horizon on the horizon dashboard as you can see I have a lot of failed job in the code V Pals and in here on the fail job we can see what happened and what's the error in here so there is some error and if you fix the error and push the codes you just need to retry this and it will be run another time and all everything will be fine and this things okay thank you for watching I try to explain how we use Horizon and go to vitals and some examples so if you interest in this kind of video please like And subscribe to the channel and in the next video I see you we want to talk more about the queue and the jobs so goodbye
Info
Channel: Mohammad Javad Ghasemy
Views: 1,914
Rating: undefined out of 5
Keywords: Laravel, Laravel Queue, Queue management, Queue optimization, Database connection, Performance improvement, Third-party API integration, Web development, Queue processing, Queue configuration, Job dispatching, Background processing, Laravel tutorials, Laravel development, Software engineering, laravel project, horizon, laravel horizon, laravel queue dashboard, horizon production
Id: ZreRJq-lRSg
Channel Id: undefined
Length: 10min 53sec (653 seconds)
Published: Tue Jun 20 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.