Automatically Start Laravel Horizon with Vessel

If you’re a more advanced Laravel user there is a fair chance you will be using
Laravel Horizon to run your queue
configurations. If you’re using the excellent Vessel via Shipping Docker/Chris Fidao
then it can be annoying to have to drop into a container and manually start
Horizon.

Create a new file in your project named start_horizon.sh in the docker/app
directory, enter the contents of the file which should be:

#!/usr/bin/env bash
/usr/bin/php /var/www/html/artisan horizon

Save that file, and chmod +x start_horizon.sh. Next, open the file
supervisord.conf in the same directory and add:

[program:horizon]
command="/var/www/html/docker/app/start_horizon.sh"
directory=/var/www/html/
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0

near the bottom of the file. Save the file and then rebuild your Vessel image,
using ./vessel build. After you restart your project with vessel up you
will have a running Horizon instance that you no longer manually need to start.