Last active
March 9, 2022 06:08
-
-
Save standaniels/9f441fe0608aeaf700c4a2741dc00415 to your computer and use it in GitHub Desktop.
Create supervisor program for Laravel queue worker in Homestead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script creates a supervisor program for the Laravel queue worker and writes | |
# the log to the storage folder of the project. It also starts the http server on | |
# port 9001 so you need to add this port forwarding to your Homestead.yaml file. | |
sudo sh -c 'echo "[inet_http_server] | |
port = 9001 | |
username = homestead | |
password = secret | |
[program:queue_default] | |
command=php7.1 artisan queue:work --queue=default | |
directory=/home/vagrant/laravel | |
stdout_logfile=/home/vagrant/laravel/storage/logs/queue_default.log | |
redirect_stderr=true | |
autostart=true | |
autorestart=true | |
user=vagrant" > /etc/supervisor/conf.d/queues.conf' | |
sudo service supervisor reload | |
echo "Queue workers started." |
@standaniels Can i know why we need to open port and port forwarding?
Supervisor’s web interface is available at port 9001. From here subprocesses can be started or stopped, and subprocess logs can be viewed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you. I only had to change the paths to /home/vagrant/code. It worked for me.