Add Supervisor Horizon queue worker and cron scheduler to deployment workflow

This commit is contained in:
vickytechkey 2026-09-08 23:23:31 +05:30
parent f6f6b128f0
commit 5077c04291

View file

@ -170,6 +170,26 @@ EOF
sudo rm -f /etc/nginx/sites-enabled/default
sudo systemctl reload nginx
echo "Setup Complete! Tools installed: Nginx, PHP 8.2, Composer, Node.js, Supervisor, Redis"
# 7. Configure Supervisor for Horizon Queue Worker
echo "Configuring Supervisor for Laravel Horizon..."
sudo tee /etc/supervisor/conf.d/trypost-horizon.conf > /dev/null << 'EOF'
[program:trypost-horizon]
process_name=%(program_name)s
command=php /var/www/trypost/artisan horizon
autostart=true
autorestart=true
user=ubuntu
redirect_stderr=true
stdout_logfile=/var/www/trypost/storage/logs/horizon.log
stopwaitsecs=3600
EOF
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl restart trypost-horizon || sudo supervisorctl start trypost-horizon
# 8. Configure Cron for Laravel Scheduler
(crontab -l 2>/dev/null | grep -v 'schedule:run'; echo "* * * * * cd /var/www/trypost && php artisan schedule:run >> /dev/null 2>&1") | crontab -
echo "Setup Complete! Tools installed: Nginx, PHP 8.4, Composer, Node.js, Supervisor, Redis, Horizon"
# Trigger workflow run