Why Queue Workers Matter#
AcelleMail uses Laravel queues to process emails asynchronously. Without queue workers running, emails won't be sent, automations won't trigger, and bounces won't be processed.
Cron Job Setup#
AcelleMail's scheduler handles periodic tasks. Add this to your crontab:
sudo crontab -u www-data -e
# Add this line:
* * * * * cd /var/www/acellemail && php artisan schedule:run >> /dev/null 2>&1
The scheduler runs these tasks:
- Process automation workflows
- Send scheduled campaigns
- Process bounce/complaint notifications
- Clean up expired sessions
- Generate reports
Queue Worker with Supervisor#
Install Supervisor#
sudo apt install supervisor -y
Create Worker Configuration#
sudo nano /etc/supervisor/conf.d/acellemail-worker.conf
[program:acellemail-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/acellemail/artisan queue:work redis --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/acellemail/storage/logs/worker.log
stopwaitsecs=3600
Start Workers#
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start acellemail-worker:*
Monitor Workers#
# Check status
sudo supervisorctl status
# View logs
tail -f /var/www/acellemail/storage/logs/worker.log
# Restart after code changes
sudo supervisorctl restart acellemail-worker:*
Redis Configuration (Recommended)#
Using Redis as queue driver is faster than database driver:
sudo apt install redis-server -y
sudo systemctl enable redis-server
In .env:
QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
Troubleshooting#
Emails not sending?#
# Check if workers are running
sudo supervisorctl status
# Check queue size
php artisan queue:monitor redis:default --max=100
# Process failed jobs
php artisan queue:retry all
Worker crashes?#
# Check supervisor logs
sudo tail -f /var/log/supervisor/supervisord.log
# Check worker logs
tail -f /var/www/acellemail/storage/logs/worker.log