Laravel Octane with RoadRunner

2 min read Updated 14 hours ago

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:

  1. Navigate to your application's Settings tab
  2. Find the PHP runtime section
  3. Select FrankenPHP (Octane) as the runtime
  4. 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:

  1. Go to your application's Build configuration section
  2. 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:

  1. Navigate to your application's Settings tab
  2. Find the Start command field
  3. 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:

  1. Install the Octane and RoadRunner packages
  2. Download the RoadRunner binary
  3. Start your application using the RoadRunner server