Si has llegado aquí, supondremos que ya has configurado un primer supervisor.
https://laravel.com/docs/8.x/queues#supervisor-configuration
Crearemos un archivo de configuración para nuestro nuevo sitio:
sudo nano /etc/supervisor/conf.d/nuevo-worker.conf
Haremos un reload del supervisor daemon y nos debería de aparecer el sitio que acabamos de crear.
# 2. Reload the daemon’s configuration files
supervisorctl reread > laravel-worker: available
# 3. Reload config and add/remove as necessary
supervisorctl update > laravel-worker: added process group
# 4. Start all processes of the group «laravel-worker»
supervisorctl start laravel-worker:*
# 5. Get status for all processes of the group «laravel-worker»
supervisorctl status laravel-worker:* > laravel-worker:laravel-worker_00 RUNNING pid 23758, uptime 0:00:16 > laravel-worker:laravel-worker_01 RUNNING pid 23759, uptime 0:00:16
# 6. After a change in php sources you have to restart the queue, since queue:work does run as daemon
php artisan queue:restart > Broadcasting queue restart signal.
También, para ser un poco más ordenados deberíamos cambiar el
config/queue.php
siteA.conf:
command=php /livesites/siteA.example.com/artisan queue:work database –queue=siteA –sleep=3 –tries=3\
siteB.conf:
command=php /livesites/siteB.example.com/artisan queue:work database –queue=siteB –sleep=3 –tries=3
and finally, in your Laravel code dispatch each job to appropriate queue:
dispatch((new Job)->onQueue(‘siteA’));
in siteB project
dispatch((new Job)->onQueue(‘siteB’));
'database' => [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'siteA' // or siteB, 'retry_after' => 90, ]