Laravel Octane with RoadRunner
Laravel Octane with RoadRunner
RoadRunner is a high-performance PHP application server written in Go. When combined with Laravel Octane, it provides excellent performance by keeping your application in memory between requests.
What is RoadRunner?
RoadRunner is an alternative to FrankenPHP that offers:
- A mature, battle-tested PHP application server
- Written in Go for optimal performance
- Built-in support for workers, queues, and more
- Excellent memory management
Setting up Octane with RoadRunner
Follow these steps to deploy your Laravel application with Octane and RoadRunner:
- Navigate to your application's Settings tab
- Find the PHP runtime section
- Select FrankenPHP (Octane) as the runtime
- Save your settings
Install Laravel Octane and RoadRunner
Before deploying, install Laravel Octane and the RoadRunner packages in your application and commit the changes to your repository:
composer require laravel/octane spiral/roadrunner-cli spiral/roadrunner-http
php artisan octane:install --server=roadrunner
Configure build commands
Add the RoadRunner binary download to your build commands:
- Go to your application's Build configuration section
- Add the following command to your build commands:
./vendor/bin/rr get-binary
This downloads the RoadRunner binary during the build process.
Set the start command
Configure the start command in your application settings:
- Navigate to your application's Settings tab
- Find the Start command field
- Enter the following command:
php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8080
Deploy your application
After configuring the runtime, build commands, and start command, deploy your application. The deployment will:
- Install the Octane and RoadRunner packages
- Download the RoadRunner binary
- Start your application using the RoadRunner server