0
votes

I am currently using database as my queue driver, I have installed Laravel 5.4 on Windows 10 PC. In order to process queues I have been using php artisan queue:work which was completely fine in development stage. Now, the project is completely ready and needs to be deployed on Linux Server (Dedicated) I am not sure how to avoid running command php artisan queue:work on terminal in order to process mail jobs?

I have deployed once in shared hosting and I have used cron jobs, But now I have dedicated server I guess I should be able to use something else to run jobs, I was also thinking of using Redis as queue driver rather than database as queue driver

I need some suggestion on what is best. And how to avoid php artisan queue:work on dedicated server? Do I need to write small script to make sure jobs run in background as a service.

1

1 Answers

1
votes

Laravel documentation covers this with supervisor.

See: Laravel Supervisor configuration

Supervisor is a process monitor which makes sure your queue command (or any other command for that matter) is executed and restarted if it dies.

Edit:

See: Supervisor documentation

Basically for centos, you can use yum:

yum install supervisor

Easy install

// required for easy_install (if not installed already)
yum install python-setuptools     
// install supervisor
easy_install supervisor

Or pip

pip install supervisor

After that it's just creating your config (based on the example given on Laravel's documentation), this is handled step by step in:

Supervisor: creating-a-configuration-file

And create the service: Setup Supervisor

After that you can start the service with:

service supervisord start