Laravel echo server killed on exit console
I recommend to use the pm2 tool to manage the larval-echo-server service. After install pm2 you must create a json file inside the Laravel project with a content like this:
echo-pm2.json
{
"name": "echo",
"script": "laravel-echo-server",
"args": "start"
}
Then run the next command to start the service in background:
pm2 start echo-pm2.json
Yo can use pm2 monit
command for real time monitoring or pm2 logs
to get the service logs as well.
Install Supervisor on linux. Here is a manual: https://laravel.com/docs/5.4/queues#supervisor-configuration
Here is my supervisor config file:
[program:websocket-server]
process_name=%(program_name)s
directory=/var/www/example.de/public_html/
command=/usr/lib/node_modules/laravel-echo-server/bin/server.js start
autostart=true
autorestart=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/www/example.de/logs/websocket-server.log
Now you can start the server in the background with supervisorctl start websocket-server:*