Websocket Setup

Supervisor Configuration

Just as creating queue_manager.conf to help keep laravel queue running, we need to create new conf for laravel reverb.

To create a new file from within the supervisor config directory called "reverb_manager.conf" or "reverb_manager.ini" and the content of the file should be as follows.

Create the config file using the command below:

Ubuntu

nano /etc/supervisor/conf.d/reverb_manager.conf

CentOS

nano /etc/supervisord.d/reverb_manager.ini

Then paste the follow code in the file:

[program:laravel_reverb]
process_name=%(program_name)s_%(process_num)02d
command=php /PATH_TO_YOUR_BACKEND/artisan reverb:start
startsecs = 0
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stderr_logfile=/PATH_TO_YOUR_BACKEND/storage/logs/larareverb.err.log
stdout_logfile=/PATH_TO_YOUR_BACKEND/storage/logs/larareverb.out.log
stderr_logfile_maxbytes=1MB
stdout_logfile_maxbytes=1MB

In the code above, you have to replace the following with the right values on your server: PATH_TO_YOUR_BACKEND replace with the directory path of where you backend files is location, usually its something like home/USERNAME/public_html

You may also need to change the "user=root", change it to the user you are logged in in your terminal, usually is root user, so you can set: user=root

Step 3: Start/Restart Supervisor

Once you have created the configuration, you can start/restart the supervisor process. To start supervisor you can run the following commands.

sudo supervisorctl stop all
sudo supervisorctl reread
sudo supervisorctl update

Step 4: Start the queue

Run the command below to start just the laravel_reverb you just created above

sudo supervisorctl start laravel_reverb

Note: If nothing works after run the command above, you can rather run the command below, to make supervisor start all configs:

sudo supervisorctl start all

Done!!

Last updated

Was this helpful?