@q8xbox You’re meant to use something like Supervisord to keep the Octane process running on the server without needing to be connected via SSH or whatever.
Run octane cmd in production
I have laravel 10 site which i want to run it over octane Swoole cmd using pm2 in Ubuntu server. Is there instructions that guide me through do that since the use of mp2 it to make the cmd run always as long as the server working and it will not end when terminal closed.
As @martinbean commented, pm2 serves as a process manager and load balancer for Node.js applications and, as far as I know, it cannot be used to keep a Laravel process running. To have Octane working, you need to have the php artisan octane:start command running on the server.
To ensure it runs, you can use Supervisor, which is a process monitoring tool for Linux, meaning it will keep your process always running.
1- Install Supervisor
sudo apt-get install supervisor
2- Configure Supervisor
Go to the /etc/supervisor/conf.d directory and create a new configuration file (e.g., laravel-octane.conf) and put the code below in it.
[program:laravel-octane]
process_name=%(program_name)
command=php /PROJECT_PATH/artisan octane:start
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/PROJECT_PATH/octane.log
stopwaitsecs=3600
Don't forget to replace PROJECT_PATH with your Laravel project's path.
3- Update Supervisor configurations and start the Octane process
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start "laravel-octane"
This should be enough to keep the Octane process always running on your server. By default, Octane will run as localhost:8000, but you can change this by passing additional parameters to the process that Supervisor is monitoring. See the Laravel Octane documentation: https://laravel.com/docs/10.x/octane
Please or to participate in this conversation.