Laravel Laravel 5.5 Laravel 5.6 Linux VPS

Laravel Configure Queues on Production to handle Events and Queues

Written by Yogesh Koli

Introduction:

Laravel queues gives us an excellent way to increase web application performance, if you are using Laravel queues into your project then you have taken a good step towards the improvements of your application speed.

If your are not using Laravel queues then you should implement and use it, Queues are very useful when handling events, sending emails and process big amount of load behind the seen.

Anyways, In this tutorial I am going to provide steps on how you should handle your queues processes and monitor those on Linux operating system.

Please take a note I am going to use ubuntu 16.04 through the steps.

In Linux we have available great system package called supervisor, it is actually a great software package to monitor and control multiple process.

Okay so let’s get started from installation:

Supervisor Installation in Linux:

If you have your production server running with linux operating system on VPS, then go ahed and login on to the server with root access.

Make sure you have root access available before proceeding, if you don’t have sudo/root access then system won’t allow you to install software.

To install supervisor use following command:

After executing above command, it will ask you for the confirmation of supervisor package installation, type and hit enter to continue, as showing below:

Supervisor Installation Confirmation.

Now we are done with the installation, next let’s configure supervisor to work on the project processes.

Supervisor Configuration:

Take a note of path of your project directory on server where currently Laravel project is running, for example path can be /var/www/example.com/ 

Next let’s create new config file for supervisor using following command:

You can change the file name/queue name according to your preference or project name.

Use following configuration script and add into the example_project_queue.conf file.

Make sure to update your project path according to your actual project path on server.

example_project_queue.conf:

Also create an log file for supervisor as we have mention above into the configuration:

Next will have to the start the newly added supervisor program using following commands:

It should show you: example_project_queue: available if yes then execute following command, if not then you must get an error message about paths if you had any mistake in there if you do then re-open configuration file and correct those mistakes and follow reread command again and then the following command:

The above command should list a message: example_project_queue: added process group 

If you get the above message then great, you have configured process handling for your Laravel project. 

If you still see any issues, then you can comment your question or issue below into the comment box.

About the author

Yogesh Koli

Yogesh Koli is a software engineer & a Blogger lives in India. He's driven by an addiction to learning and a love for adventure. he has 5+ years of experience working with the front-end, back-end, web application development, and system design.

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of