How To Setup Laravel Queue On Production

Hell artisan in this laravel queue on production tutorial i will explain how to setup laravel queue on production in linux server. In this laravel queuework on production example i will explain step by step so that you can understand better.

In this article, you will learn how to set up Laravel Queues/Jobs on production in ubuntu server. SO if you don't know how to do that then you are a right place. I hope you will enjoy this laravel queue:work on production tutorial. Let's start.


Step 1

First step you have to connect to your ubuntu server and go to your existing laravel project then run the below command to create required tables in the database.

php artisan queue:table


Then we need to migrate the tables with the help of the below command:

php artisan migrate


Step 2

We know that Laravel queues provide a unified queueing API across a variety of different queue backends, such as Amazon SQS, Redis, or even a relational database. So, we need to setup .env file to execute the jobs using database.




Step 3

To automate the queue job we need to install a supervisor. So let's install it via command line.

sudo apt-get install supervisor


Now we have to create supervisor config file at /etc/supervisor/conf.d queue-worker.conf.

cd /etc/supervisor/conf.d
nano queue-worker.conf



process_name = %(program_name)s_%(process_num)02d
command=php /var/www/html/your-project-folder/artisan queue:listen


Then we need tp reread the supervisor the config file

supervisorctl reread


And now finally activate the process

supervisorctl update


Read also: Laravel 8.x Queues Example with Redis and Horizon


Hope it can help you.


#laravel #laravel-8x #queue