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:
"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: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: