Question
How to enable Queues in the Laravel project for Plesk Laravel Toolkit?
Answer
To enable Queues in the Laravel project, do the following:
- Navigate to Domains > example.com > PHP Settings and set
open_basedir = none
- Go to Domains > example.com > Hosting settings and set SSH Access > Type =
/bin/bash
- Make sure that Scheduler management permission is granted for the subscription. It can be checked via Subscription > example.com > Account (on the right pane) > Customize > Permission tab
- Integrate the Laravel package into Plesk. In your Git project, in the “composer.json” file, add the following lines:
CONFIG_TEXT: "require": {
. . . ,
"plesk/ext-laravel-integration": "*"
}Warning: In case a local repository is used, and changes are performed via File Manager, it is required to commit changes by performing step 5 from this article. To avoid overwriting after deploy.
- Select the database you want to process the queues. The following example is for MySQL database:
5.1. Create the database
5.2. In the “.env” project file, add the following lines:CONFIG_TEXT: DB_CONNECTION=mysql
DB_HOST=<actual database_host (might be localhost)>
QUEUE_CONNECTION=database
DB_DATABASE=<db_name>
DB_USERNAME=<db_username>
DB_PASSWORD=<db_pass>NOTE: Instead of `database_host`, `db_name`, `db_username`, and `db_pass`, specify the actual values used while creating the database.
- Navigate to Domains > example.com > Laravel > Composer tab and run the following:
composer update
composer install
- Go to Domains > example.com > Laravel > Artisan tab and run
migrate
(if tables for the database are already created - this step can be skipped) - Go to Domains > example.com > Laravel and enable Scheduled Tasks
- The Queue should now be active and ready to be enabled:
Comments
4 comments
This article gives much information about how to enable it with sql (mysql/sqllite) databases and it works really great.
The only thing mission in the extension and in this article is the behavior of the extension. I encountered a disabled switch button if my application use a cached config file. If I remove the caching for the config the switch button is enabled (clickable again). With the environment variable from the composer package it is possible to activate the queue what isn't mentioned somewhere.
It would be very nice if there is a better overview for the complete behavior of this extension and more information why is the switch disabled for clicks or why it is enabled.
I have both:
Scheduled Tasks on and the Plesk Laravel Toolkit integration package. but the button is still disabled, i can not enable it. why is that?!
manually running php artisan queue:work in plesk
works fine.
I believe this only starts one queue worker.
Many Laravel applications have multiple queues. How do we use this task to start workers for the others?
To enable the "queue" button, you have to un-cache the config:
Then enable the queue, and go in SSH again and cache the config
Please sign in to leave a comment.