Skip to content

Instantly share code, notes, and snippets.

@standaniels
Last active March 9, 2022 06:08
Show Gist options
  • Save standaniels/9f441fe0608aeaf700c4a2741dc00415 to your computer and use it in GitHub Desktop.
Save standaniels/9f441fe0608aeaf700c4a2741dc00415 to your computer and use it in GitHub Desktop.
Create supervisor program for Laravel queue worker in Homestead
#!/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
Copy link
Author

Supervisor’s web interface is available at port 9001. From here subprocesses can be started or stopped, and subprocess logs can be viewed.

See the docs for more info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment