; CheraghBot Laravel worker + scheduler (Supervisor)
; Copy this file to: /etc/supervisor/conf.d/cheraghbot.conf
; Adjust `directory`, `command`, `user`, and log paths to your server.

[program:cheraghbot-queue-default]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=default --sleep=1 --tries=3 --backoff=3 --timeout=120 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-default.log
stopwaitsecs=3600

[program:cheraghbot-queue-inventory]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=inventory --sleep=1 --tries=2 --backoff=5 --timeout=300 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-inventory.log
stopwaitsecs=3600

[program:cheraghbot-queue-bot-heavy]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=bot-heavy --sleep=1 --tries=2 --backoff=5 --timeout=180 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-bot-heavy.log
stopwaitsecs=3600

[program:cheraghbot-queue-bot-webhooks]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=bot-webhooks --sleep=1 --tries=3 --backoff=3 --timeout=120 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-bot-webhooks.log
stopwaitsecs=3600

[program:cheraghbot-queue-ai]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=ai --sleep=1 --tries=2 --backoff=5 --timeout=180 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-ai.log
stopwaitsecs=3600

[program:cheraghbot-queue-manual-runs]
process_name=%(program_name)s_%(process_num)02d
directory=/var/www/cheraghbot
command=/usr/bin/php artisan queue:work --queue=manual-runs --sleep=1 --tries=2 --backoff=5 --timeout=300 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-queue-manual-runs.log
stopwaitsecs=3600

[program:cheraghbot-scheduler]
process_name=%(program_name)s
directory=/var/www/cheraghbot
command=/usr/bin/php artisan schedule:work
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/cheraghbot/storage/logs/supervisor-scheduler.log
stopwaitsecs=60
