💾 High-performance PHP application server, load-balancer and process manager written in Golang. RR2 releases repository.

Overview

RoadRunner

Total alerts All releases

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a service with the ability to extend its functionality on a per-project basis.

RoadRunner includes PSR-7/PSR-17 compatible HTTP and HTTP/2 server and can be used to replace classic Nginx+FPM setup with much greater performance and flexibility.

Official Website | Documentation | Release schedule

Features:

  • Production-ready
  • PCI DSS compliant
  • PSR-7 HTTP server (file uploads, error handling, static files, hot reload, middlewares, event listeners)
  • HTTPS and HTTP/2 support (including HTTP/2 Push, H2C)
  • A Fully customizable server, FastCGI support
  • Flexible environment configuration
  • No external PHP dependencies (64bit version required), drop-in (based on Goridge)
  • Load balancer, process manager and task pipeline
  • Integrated metrics (Prometheus)
  • Workflow engine by Temporal.io
  • Works over TCP, UNIX sockets and standard pipes
  • Automatic worker replacement and safe PHP process destruction
  • Worker create/allocate/destroy timeouts
  • Max jobs per worker
  • Worker lifecycle management (controller)
    • maxMemory (graceful stop)
    • TTL (graceful stop)
    • idleTTL (graceful stop)
    • execTTL (brute, max_execution_time)
  • Payload context and body
  • Protocol, worker and job level error management (including PHP errors)
  • Development Mode
  • Integrations with Symfony, Laravel, Slim, CakePHP, Zend Expressive
  • Application server for Spiral
  • Included in Laravel Octane
  • Automatic reloading on file changes
  • Works on Windows (Unix sockets (AF_UNIX) supported on Windows 10)

Installation:

$ composer require spiral/roadrunner:v2.0 nyholm/psr7
$ ./vendor/bin/rr get-binary

For getting roadrunner binary file you can use our docker image: spiralscout/roadrunner:X.X.X (more information about image and tags can be found here).

Important notice: we strongly recommend to use a versioned tag (like 1.2.3) instead latest.

Configuration can be located in .rr.yaml file (full sample):

rpc:
  listen: tcp://127.0.0.1:6001

server:
  command: "php worker.php"

http:
  address: "0.0.0.0:8080"

logs:
  level: error

Read more in Documentation.

Example Worker:

<?php

use Spiral\RoadRunner;
use Nyholm\Psr7;

include "vendor/autoload.php";

$worker = RoadRunner\Worker::create();
$psrFactory = new Psr7\Factory\Psr17Factory();

$worker = new RoadRunner\Http\PSR7Worker($worker, $psrFactory, $psrFactory, $psrFactory);

while ($req = $worker->waitRequest()) {
    try {
        $rsp = new Psr7\Response();
        $rsp->getBody()->write('Hello world!');

        $worker->respond($rsp);
    } catch (\Throwable $e) {
        $worker->getWorker()->error((string)$e);
    }
}

Run:

To run application server:

$ ./rr serve

License:

The MIT License (MIT). Please see LICENSE for more information. Maintained by Spiral Scout.

Comments
  • [BUG] Have a problem to VirtualBox shared folder in `spiral/roadrunner-laravel`

    [BUG] Have a problem to VirtualBox shared folder in `spiral/roadrunner-laravel`

    I tried this code:

    ./rr -c .rr.yaml serve
    

    I expected to see this happen: The program is running normally

    Instead, this happened: image

    The version of RR used: 2.0.3

    The operation system used: cenots7

    RR configuration file content:

    http:
      address: 0.0.0.0:8080
      pool:
        num_workers: 8
        max_jobs: 0
        supervisor:
          # watch_tick defines how often to check the state of the workers (seconds)
          watch_tick: 1s
          # ttl defines maximum time worker is allowed to live (seconds)
          ttl: 0
          # idle_ttl defines maximum duration worker can spend in idle mode after first use. Disabled when 0 (seconds)
          idle_ttl: 10s
          # exec_ttl defines maximum lifetime per job (seconds)
          exec_ttl: 10s
          # max_worker_memory limits memory usage per worker (MB)
          max_worker_memory: 100
      headers:
        cors:
          allowed_origin: "*"
          allowed_headers: "*"
          allowed_methods: "GET,POST,PUT,DELETE"
          allow_credentials: true
          exposed_headers: "Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma"
          max_age: 600
    
    server:
      command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///var/run/rr-rpc.sock"
      relay: "unix:///var/run/rr-rpc.sock"
      env:
        RR_MODE: http
    
    logs:
      mode: development
      level: debug
      encoding: console
      output: stderr
      err_output: stderr
      channels:
        http:
          mode: development
          level: panic
          encoding: console
          output: stdout
    
    # healthcheck
    status:
      address: "0.0.0.0:8090"
    
    reload:
      # sync interval
      interval: 1s
      # global patterns to sync
      patterns: [ ".php" ]
      # list of included for sync services
      plugins:
        http:
          # recursive search for file patterns to add
          recursive: true
          # ignored folders
          ignore: [ "vendor" ]
          # service specific file pattens to sync
          patterns: [ ".php", ".go", ".md" ]
          # directories to sync. If recursive is set to true,
          # recursive sync will be applied only to the directories in `dirs` section
          dirs: [ "." ]
    

    remarks: I can run normally on the cloud server, including centos8 and Ubuntu. The local server is not working properly. spiral/roadrunner-laravel version: 4.0.1. And The CentOS7 of my local machine can run normally, spiral/framework.

    B-bug F-need-verification 
    opened by Alexei007 19
  • [BUG] v2.5.0 binary for linux

    [BUG] v2.5.0 binary for linux

    I tried this code:

    ./vendor/bin/rr get-binary
    

    On first run it gave this warning and downloaded v2.4.2:

    Environment:
       - Version:          2.*
       - Stability:        stable
       - Operating System: linux
       - Architecture:     amd64
     
     [WARNING] unknown/unknown v2.5.0 does not contain available assembly (further search in progress)
    

    On next runs the warning disappeared and it downloaded v2.5.0 but when running rr it gives this error: sh: ./rr: not found.

    I tested it on alpine linux inside docker container

    B-bug F-need-verification 
    opened by cappuc 13
  • [FEATURE REQUEST] Add dockerfile integration for development/test

    [FEATURE REQUEST] Add dockerfile integration for development/test

    Is your feature request related to a problem? Please describe. Easier to get started with dockerfile integration. Ex: skip all the local go sdk and php installation.

    Describe the solution you'd like Add a dockerfile integration for development/test so we can skip the local go sdk and php installation.

    Additional context

    for example:

    • setup a dockerfile with golang:1.16-buster as base
    • add php to the dockerfile
    • setup Goland to run remote target via docker (or debug in vscode with docker)
    • debug/test in Goland (or debug/test in vscode)
    A-other B-missing feature 
    opened by litan1106 12
  • [BUG] Run serve command with -d options failed

    [BUG] Run serve command with -d options failed

    in windows system run rr.exe serve command with -d option that get error prompt:

    listen tcp :6061: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

    B-bug F-need-verification 
    opened by bigBron 10
  • [BUG] .env handling broken in 2.0.4?

    [BUG] .env handling broken in 2.0.4?

    Hello,

    After 2.0.4 we are seeing our Laravel .env file variables persist forever in Laravel Octane powered applications. If we change variable in the Laravel .env file we do not see the variable updated even after reloading the RoadRunner workers - a full daemon restart is required.

    I see 2.0.4 introduced some new .env functionality - we are not using that.

    opened by taylorotwell 9
  • [FEATURE REQUEST] adding custom plugins

    [FEATURE REQUEST] adding custom plugins

    Is your feature request related to a problem? Please describe.

    I would like to build the binary with custom plugins but since 2.0.4 the cli package was moved to internal and i can no longer add my plugin

    Describe the solution you'd like

    move cli package outside of internal

    Describe alternatives you've considered

    a) public interface in root package (roadrunner_binary) which would allow me to run cli.Container.Register and cli.Execute this would be nice and still allow you to controll what is exposed b) implement golang plugins https://golang.org/pkg/plugin/ this would be ideal solution as i would be concerned only with plugin interfaces, but might be hard to implement c) clone the roadrunner-binary project and maintain custom branch

    Additional context

    i am working off of https://roadrunner.dev/docs/beep-beep-build which suggests Copy main.go file in the root of your project

    for a code on 2.0.2 but since cli is in internal this no longer works

    package main
    
    import (
    	"log"
    
    	"github.com/spf13/cobra"
    	"github.com/spiral/roadrunner-binary/v2/cli"
    )
    
    func main() {
    	cobra.OnInitialize(func() {
    		err := cli.Container.Register(&myPlugin{})
    		if err != nil {
    			log.Fatal(err)
    		}
    	})
    
    	cli.Execute()
    }
    

    this might be considered a bug or a regression since it was suggested by documentation

    C-feature-request 
    opened by dstrop 6
  • [ARCH] Current architecture (arm64) may not be supported

    [ARCH] Current architecture (arm64) may not be supported

    Hi, tried to install roadrunner on latest Apple macbook with Apple Silicon M1 processor but installation failed with the message:

    Uncaught OutOfRangeException: Current architecture (arm64) may not be supported in vendor/spiral/roadrunner-cli/src/Environment/Architecture/Factory.php:56
    

    It would be nice if roadrunner will support arm64 architecture and will have precompiled binaries for it.

    Thanks!

    O-macos stable-nominated 
    opened by sc0rp10 6
  • [BUG] RR v2.6.5 is taking roadrunner-plugins v2.7.0-alpha.1

    [BUG] RR v2.6.5 is taking roadrunner-plugins v2.7.0-alpha.1

    Could you please update dependency github.com/spiral/roadrunner-plugins/v2 RR v2.6.5 is taking roadrunner-plugins v2.7.0-alpha.1 (without latest changes)

    Thank you 🙏

    B-bug F-need-verification 
    opened by vladimir-vv 4
  • ci(lint): сonfig file linting enabled

    ci(lint): сonfig file linting enabled

    Reason for This PR

    • Config file linting enabled
    • Schemas for the config file renamed

    Closes #56

    Description of Changes

    [Author TODO: add description of changes.]

    License Acceptance

    By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

    PR Checklist

    [Author TODO: Meet these criteria.] [Reviewer TODO: Verify that these criteria are met. Request changes if not]

    • [x] All commits in this PR are signed (git commit -s).
    • [x] The reason for this PR is clearly provided (issue no. or explanation).
    • [x] The description of changes is clear and encompassing.
    • [x] Any required documentation changes (code and docs) are included in this PR.
    • [x] Any user-facing changes are mentioned in CHANGELOG.md.
    • [x] All added/changed functionality is tested.
    A-ci A-tests 
    opened by tarampampam 4
  • [BUG] Docker rr not found

    [BUG] Docker rr not found

    This problem only occurs in version > = 2.5.0

    a.dockerfile:

    FROM spiralscout/roadrunner:2.5.1 AS roadrunner
    FROM php:8.0-cli
    
    COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr
    

    command:

    docker build -t rrtest -f .\a.dockerfile .
    docker run --rm rrtest rr -v
    

    output:

    /usr/local/bin/docker-php-entrypoint: 9: exec: rr: not found
    
    A-other B-bug F-need-verification 
    opened by Yurunsoft 3
  • [EXT INTEGRATIONS] Laravel Octane with roadrunner unresponsive after benchmark

    [EXT INTEGRATIONS] Laravel Octane with roadrunner unresponsive after benchmark

    • Octane Version: latest
    • Laravel Version: latest
    • PHP Version: 8.0.6
    • RoadRunner version: rr version 2.2.1 (build time: 2021-05-13T18:00:30+0000, go1.16.4)
    • Database Driver & Version: n/a
    • Workers: 16
    • OS: MacOS Big Sur

    Description:

    Hello, i installed octane on plain laravel setup then i ran wrk -t12 -c400 -d30s http://localhost:8000/ to test, after it finished the octane/roadruner server become unresponsive and this error thrown in the browser

    http_plugin_serve_http: Timeout:
        supervised_exec_with_context: context deadline exceeded
    

    There are also more than 20 of this processes image

    Is this normal behaviour? I hit it really hard but i would expect it to resurrect itself but it's still unresponsive even after few minutes. In another test Swoole handled the requests fine.

    Steps To Reproduce:

    1. install laravel
    2. install octane with roadrunner
    3. run wrk -t12 -c400 -d30s http://localhost:8000/
    F-need-verification 
    opened by dyanakiev 3
Releases(v2.7.0)
Owner
Spiral Scout
Spiral Scout is a full-service digital agency, providing design, development and online marketing services to businesses around San Francisco and beyond.
Spiral Scout
PPM is a process manager, supercharger and load balancer for modern PHP applications.

PPM - PHP Process Manager PHP-PM is a process manager, supercharger and load balancer for PHP applications. It's based on ReactPHP and works best with

PPM - PHP Process Manager 6.5k Dec 27, 2022
Not really a load balancer.

302 This is a load balancer that doesn't act as a load balancer. It is a redirect balancer. Instead of forwarding traffic to a specific host/port, it

52 Entertainment 10 Mar 16, 2022
This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

This package provides a high performance HTTP server to speed up your Laravel/Lumen application based on Swoole.

Swoole Taiwan 3.9k Jan 8, 2023
QPM, the process management framework in PHP, the efficient toolkit for CLI development. QPM provides basic daemon functions and supervision mechanisms to simplify multi-process app dev.

QPM QPM全名是 Quick(or Q's) Process Management Framework for PHP. PHP 是强大的web开发语言,以至于大家常常忘记PHP 可以用来开发健壮的命令行(CLI)程序以至于daemon程序。 而编写daemon程序免不了与各种进程管理打交道。Q

Comos 75 Dec 21, 2021
High-Performance Long-Living PHP Framework for modern enterprise application development

Documentation · Discord · Telegram · Twitter Spiral Framework is a High-Performance Long-Living Full-Stack framework and group of over sixty PSR-compa

Spiral Scout 1.4k Jan 1, 2023
Kit is a lightweight, high-performance and event-driven web services framework that provides core components such as config, container, http, log and route.

Kit What is it Kit is a lightweight, high-performance and event-driven web services framework that provides core components such as config, container,

null 2 Sep 23, 2022
swoole and golang ipc, use goroutine complete swoole coroutine

swoole and golang ipc demo swoole process module exec go excutable file as sider car, use goroutine complete swoole coroutine hub.php <?php require '

null 2 Apr 17, 2022
Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components

Spiral HTTP Application Skeleton Spiral Framework is a High-Performance PHP/Go Full-Stack framework and group of over sixty PSR-compatible components.

Spiral Scout 152 Dec 18, 2022
High performance, full-stack PHP framework delivered as a C extension.

Phalcon Framework Phalcon is an open source web framework delivered as a C extension for the PHP language providing high performance and lower resourc

The Phalcon PHP Framework 10.7k Jan 8, 2023
Biny is a tiny, high-performance PHP framework for web applications

Biny is high performance. Framework comes default with response time of less than 1ms. Stand-alone QPS easily up to 3000.

Tencent 1.7k Dec 9, 2022
High performance HTTP Service Framework for PHP based on Workerman.

webman High performance HTTP Service Framework for PHP based on Workerman. Manual https://www.workerman.net/doc/webman Benchmarks https://www.techempo

walkor 1.3k Jan 2, 2023
🔥High Performance PHP Progressive Framework.

The Core Framework English | 中文 The QueryPHP Application QueryPHP is a modern, high performance PHP progressive framework, to provide a stable and rel

The QueryPHP Framework 306 Dec 14, 2022
Motan - a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services

Motan-PHP Overview Motan is a cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.

Weibo R&D Open Source Projects 81 Nov 19, 2022
A multithreaded application server for PHP, written in PHP.

appserver.io, a PHP application server This is the main repository for the appserver.io project. What is appserver.io appserver.io is a multithreaded

appserver.io 951 Dec 25, 2022
FrankenPHP is a modern application server for PHP built on top of the Caddy web server

FrankenPHP: Modern App Server for PHP FrankenPHP is a modern application server for PHP built on top of the Caddy web server. FrankenPHP gives superpo

Kévin Dunglas 2.8k Jan 2, 2023
Supercharge your Laravel application's performance.

Introduction Laravel Octane supercharges your application's performance by serving your application using high-powered application servers, including

The Laravel Framework 3.3k Jan 1, 2023
AbuseIO is a toolkit to receive, process, correlate and notify about abuse reports received by network operators, typically hosting and access providers.

AbuseIO - Abusemanagement tools AbuseIO is a toolkit to receive, process, correlate and notify end users about abuse reports received by network opera

AbuseIO 189 Dec 6, 2022
Framework agnostic package to load heavy JSON in lazy collections.

Lazy JSON Framework agnostic package to load heavy JSON in lazy collections. Under the hood, the brilliant JSON Machine by @halaxa is used as lexer an

Andrea Marco Sartori 155 Dec 1, 2022
Multi-process coroutine edition Swoole spider !! Learn about Swoole's network programming and the use of its related APIs

swoole_spider php bin/spider // Just do it !! Cache use Swoole\Table; use App\Table\Cache; $table = new Table(1<<20); // capacity size $table->column

null 3 Apr 22, 2021