Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

CakeDC/cakephp-roadrunner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roadrunner for CakePHP

Downloads Latest Version License

Requirements

  • CakePHP 3.6.0+
  • PHP 7.1+

Setup

  • composer require cakedc/cakephp-roadrunner
  • Download roadrunner binary and place the file in your filesystem, for example under /usr/local/bin/rr
  • Create a RoadRunner worker file, or use the example worker provided
cp vendor/cakedc/cakephp-roadrunner/worker/cakephp-worker.php .
cp vendor/cakedc/cakephp-roadrunner/worker/.rr.json .

Note the configuration is stored in .rr.json file, check all possible keys here https://github.com/spiral/roadrunner/wiki/Configuration

  • Start the server, either using your own configuration or the sample configuration provided in the plugin

/usr/local/bin/rr serve

  • If you need sessions
    • Ensure you add the following to your session config in your CakePHP config/app.php
    'Session' => [
        'defaults' => 'php',
        'ini' => [
            'session.use_trans_sid' => false,
            'session.use_cookies' => false,
            'session.use_only_cookies' => true,
            'session.cache_limiter' => '',
            'session.save_handler' => 'user',
        ],
    ],
  • Add the session middleware to your src/Application.php middleware queue
    ->add(new \Relay\Middleware\SessionHeadersHandler())
  • Nginx proxy

You'll possibly need to configure a webserver to handle requests, serve static assets etc. Use this sample config virtualhost for nginx:

server {
    listen 80;
    server_name example.com; 
    root /var/virtual/example.com/webroot;

    location / {
        try_files $uri @backend8080;
    }

    location @backend8080 {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Host $server_name;
    }
}

Documentation

For documentation, as well as tutorials, see the Docs directory of this repository.

Support

For bugs and feature requests, please use the issues section of this repository.

Commercial support is also available, contact us for more information.

Contributing

This repository follows the CakeDC Plugin Standard. If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our Contribution Guidelines for detailed instructions.

License

Copyright 2019 Cake Development Corporation (CakeDC). All rights reserved.

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file.

Todo

  • Existing issue setting cookies like $this->response = $this->response->withHeader('head', 'one'); conflicts with session cookie generation