Run BrainSocket Laravel Artisan Command in Supervisor

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

It shares some of the same goals of programs like launchd, daemontools, and runit. Unlike some of these programs, it is not meant to be run as a substitute for init as “process id 1”. Instead it is meant to be used to control processes related to a project or a customer, and is meant to start like any other program at boot time.

Official Website

If you haven't install supervisor, you'll install it first.

# Debian / Ubuntu:
$ sudo apt-get install supervisor

Next, we'll configure it. We need to define a process to listen to.

$ sudo vim /etc/supervisor/conf.d/mysocket.conf

Add this to your new conf file, changing file paths and your environment as necessary

command=php artisan brainsocket:start

We now have a process called "mysocket" which we can tell Supervisord to start and monitor.

Let's do that:

$ sudo supervisorctl
> reread # Tell supervisord to check for new items in /etc/supervisor/conf.d/
> add mysocket       # Add this process to Supervisord
> start mysocket     # May say "already started"

Now the "mysocket" process is on and being monitored. If our queue listener fails, Supervisord will restart the php artisan brainsocket:start process.

Reference Read Laravel 4 Real Time Chat and Production-Ready Beanstalkd with Laravel Queues

0.00 avg. rating (0% score) - 0 votes