Queue Listeners
We make use of queues to make the application faster and handle sending emails and other actions in the background. You will need to setup the queue worker for these actions to be processed.
Crontab Configuration
The first thing we need to do is create a new cronjob that runs every minute to process specific Xactyl tasks, such as session cleanup and sending scheduled tasks to daemons. You'll want to open your crontab using sudo crontab -e and then paste the line below.
* * * * * php /var/www/xactyl/artisan schedule:run >> /dev/null 2>&1Create Queue Worker
Next you need to create a new systemd worker to keep our queue process running in the background. This queue is responsible for sending emails and handling many other background tasks for Xactyl.
Create a file called xactylq.service in /etc/systemd/system with the contents below.
# Xactyl Queue Worker File
# ----------------------------------
[Unit]
Description=Xactyl Queue Worker
After=redis-server.service
[Service]
# On some systems the user and group might be different.
# Some systems use `apache` or `nginx` as the user and group.
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/xactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
StartLimitInterval=180
StartLimitBurst=30
RestartSec=5s
[Install]
WantedBy=multi-user.targetRedis on RHEL / Rocky Linux / AlmaLinux
If you are using RHEL, Rocky Linux, or AlmaLinux, you will need to replace redis-server.service with redis.service at the After= line in order to ensure redis starts before the queue worker.
TIP
If you are not using redis for anything you should remove the After= line, otherwise you will encounter errors when the service starts.
If you are using redis for your system, you will want to make sure to enable that it will start on boot. You can do that by running the following command:
sudo systemctl enable --now redis-serverFinally, enable the service and set it to boot on machine start.
sudo systemctl enable --now xactylq.service