Skip to content

Commit c8325fd

Browse files
committed
Merge branch '1.x'
# Conflicts: # CHANGELOG.md
2 parents 1eabb66 + 634dfc1 commit c8325fd

17 files changed

+234
-33
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: tests
22

33
on:
44
push:
5+
branches:
6+
- master
7+
- '*.x'
58
pull_request:
69
schedule:
710
- cron: '0 0 * * *'
@@ -13,9 +16,12 @@ jobs:
1316
strategy:
1417
fail-fast: true
1518
matrix:
16-
php: ['8.0', 8.1]
19+
php: ['8.0', 8.1, 8.2]
1720
laravel: [8, 9]
1821
driver: [swoole, openswoole]
22+
exclude:
23+
- php: 8.2
24+
laravel: 8
1925

2026
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.driver }}
2127

CHANGELOG.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
11
# Release Notes
22

3-
## [Unreleased](https://github.com/laravel/octane/compare/v1.2.16...master)
3+
## [Unreleased](https://github.com/laravel/octane/compare/v1.3.7...master)
4+
5+
## [v1.3.7](https://github.com/laravel/octane/compare/v1.3.6...v1.3.7) - 2022-11-02
6+
7+
### Changed
8+
9+
- Make IP to bind the server to configurable via env by @xorinzor in https://github.com/laravel/octane/pull/607
10+
11+
## [v1.3.6](https://github.com/laravel/octane/compare/v1.3.5...v1.3.6) - 2022-11-01
12+
13+
### Changed
14+
15+
- Re-do: Configurable Roadrunner log level by @ejulen in https://github.com/laravel/octane/pull/604
16+
17+
### Fixed
18+
19+
- Read port for http server from environment if no port is passed by @hendrikheil in https://github.com/laravel/octane/pull/605
20+
21+
## [v1.3.5](https://github.com/laravel/octane/compare/v1.3.4...v1.3.5) - 2022-10-26
22+
23+
### Fixed
24+
25+
- Revert "[1.x] Made Roadrunner log level configurable" by @driesvints in https://github.com/laravel/octane/pull/603
26+
27+
## [v1.3.4](https://github.com/laravel/octane/compare/v1.3.3...v1.3.4) - 2022-10-24
28+
29+
## [v1.3.3](https://github.com/laravel/octane/compare/v1.3.2...v1.3.3) - 2022-10-03
30+
31+
### Fixed
32+
33+
- Ignore `Response::create` failed by @sy-records in https://github.com/laravel/octane/pull/590
34+
35+
## [v1.3.2](https://github.com/laravel/octane/compare/v1.3.1...v1.3.2) - 2022-09-30
36+
37+
### Fixed
38+
39+
- Flushes controller on route by @nunomaduro in https://github.com/laravel/octane/pull/589
40+
41+
## [v1.3.1](https://github.com/laravel/octane/compare/v1.3.0...v1.3.1) - 2022-09-05
42+
43+
### Changed
44+
45+
- Add possibility to launch swoole server with additional php options by @AbdelAbouhassane in https://github.com/laravel/octane/pull/570
46+
47+
## [v1.3.0](https://github.com/laravel/octane/compare/v1.2.16...v1.3.0) - 2022-08-02
48+
49+
### Added
50+
51+
- Adds support for Swoole 5 by @nunomaduro in https://github.com/laravel/octane/pull/560
52+
53+
### Fixed
54+
55+
- Fix carbon locale when setting it via app locale setter by @nunomaduro in https://github.com/laravel/octane/pull/557
456

557
## [v1.2.16](https://github.com/laravel/octane/compare/v1.2.15...v1.2.16) - 2022-07-15
658

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
## Introduction
1111

12-
Laravel Octane supercharges your application's performance by serving your application using high-powered application servers, including [Open Swoole](https://swoole.co.uk), [Swoole](https://github.com/swoole/swoole-src), and [RoadRunner](https://roadrunner.dev). Octane boots your application once, keeps it in memory, and then feeds it requests at supersonic speeds.
12+
Laravel Octane supercharges your application's performance by serving your application using high-powered application servers, including [Open Swoole](https://openswoole.com), [Swoole](https://github.com/swoole/swoole-src), and [RoadRunner](https://roadrunner.dev). Octane boots your application once, keeps it in memory, and then feeds it requests at supersonic speeds.
1313

1414
## Official Documentation
1515

bin/roadrunner-worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ $basePath = require __DIR__.'/bootstrap.php';
2828
*/
2929

3030
$roadRunnerClient = new RoadRunnerClient($psr7Client = new PSR7Worker(
31-
new RoadRunnerWorker(Relay::create('pipes')),
31+
new RoadRunnerWorker(Relay::create($_ENV['LARAVEL_OCTANE_ROADRUNNER_RELAY'] ?? 'pipes')),
3232
new ServerRequestFactory,
3333
new StreamFactory,
3434
new UploadedFileFactory,

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
],
1616
"require": {
1717
"php": "^8.0",
18-
"laravel/framework": "^8.81|^9.0",
18+
"laravel/framework": "^8.83.26|^9.38.0",
1919
"laminas/laminas-diactoros": "^2.5",
2020
"laravel/serializable-closure": "^1.0",
21+
"nesbot/carbon": "^2.60",
2122
"symfony/psr-http-message-bridge": "^2.0"
2223
},
2324
"require-dev": {

src/ApplicationGateway.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Contracts\Http\Kernel;
66
use Illuminate\Foundation\Application;
77
use Illuminate\Http\Request;
8+
use Illuminate\Routing\Route;
89
use Laravel\Octane\Events\RequestHandled;
910
use Laravel\Octane\Events\RequestReceived;
1011
use Laravel\Octane\Events\RequestTerminated;
@@ -50,5 +51,11 @@ public function terminate(Request $request, Response $response): void
5051
$this->sandbox->make(Kernel::class)->terminate($request, $response);
5152

5253
$this->dispatchEvent($this->sandbox, new RequestTerminated($this->app, $this->sandbox, $request, $response));
54+
55+
$route = $request->route();
56+
57+
if ($route instanceof Route && method_exists($route, 'flushController')) {
58+
$route->flushController();
59+
}
5360
}
5461
}

src/Commands/Concerns/InteractsWithServers.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ protected function writeServerRunningMessage()
100100

101101
$this->output->writeln([
102102
'',
103-
' Local: <fg=white;options=bold>http://'.$this->option('host').':'.$this->option('port').' </>',
103+
' Local: <fg=white;options=bold>http://'.$this->option('host').':'.$this->getPort().' </>',
104104
'',
105105
' <fg=yellow>Press Ctrl+C to stop the server</>',
106106
'',
@@ -120,6 +120,26 @@ protected function getServerOutput($server)
120120
], fn () => $server->clearOutput()->clearErrorOutput());
121121
}
122122

123+
/**
124+
* Get the Octane HTTP server host IP to bind on.
125+
*
126+
* @return string
127+
*/
128+
protected function getHost()
129+
{
130+
return $this->option('host') ?? config('octane.host') ?? $_ENV['OCTANE_HOST'] ?? '127.0.0.1';
131+
}
132+
133+
/**
134+
* Get the Octane HTTP server port.
135+
*
136+
* @return string
137+
*/
138+
protected function getPort()
139+
{
140+
return $this->option('port') ?? config('octane.port') ?? $_ENV['OCTANE_PORT'] ?? '8000';
141+
}
142+
123143
/**
124144
* Returns the list of signals to subscribe.
125145
*

src/Commands/StartCommand.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class StartCommand extends Command implements SignalableCommandInterface
1616
public $signature = 'octane:start
1717
{--server= : The server that should be used to serve the application}
1818
{--host=127.0.0.1 : The IP address the server should bind to}
19-
{--port=8000 : The port the server should be available on}
19+
{--port= : The port the server should be available on [default: "8000"]}
2020
{--rpc-port= : The RPC port the server should be available on}
2121
{--workers=auto : The number of workers that should be available to handle requests}
2222
{--task-workers=auto : The number of task workers that should be available to handle tasks}
@@ -56,8 +56,8 @@ public function handle()
5656
protected function startSwooleServer()
5757
{
5858
return $this->call('octane:swoole', [
59-
'--host' => $this->option('host'),
60-
'--port' => $this->option('port'),
59+
'--host' => $this->getHost(),
60+
'--port' => $this->getPort(),
6161
'--workers' => $this->option('workers'),
6262
'--task-workers' => $this->option('task-workers'),
6363
'--max-requests' => $this->option('max-requests'),
@@ -74,8 +74,8 @@ protected function startSwooleServer()
7474
protected function startRoadRunnerServer()
7575
{
7676
return $this->call('octane:roadrunner', [
77-
'--host' => $this->option('host'),
78-
'--port' => $this->option('port'),
77+
'--host' => $this->getHost(),
78+
'--port' => $this->getPort(),
7979
'--rpc-port' => $this->option('rpc-port'),
8080
'--workers' => $this->option('workers'),
8181
'--max-requests' => $this->option('max-requests'),

src/Commands/StartRoadRunnerCommand.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ class StartRoadRunnerCommand extends Command implements SignalableCommandInterfa
2323
*/
2424
public $signature = 'octane:roadrunner
2525
{--host=127.0.0.1 : The IP address the server should bind to}
26-
{--port=8000 : The port the server should be available on}
26+
{--port= : The port the server should be available on}
2727
{--rpc-port= : The RPC port the server should be available on}
2828
{--workers=auto : The number of workers that should be available to handle requests}
2929
{--max-requests=500 : The number of requests to process before reloading the server}
3030
{--rr-config= : The path to the RoadRunner .rr.yaml file}
3131
{--watch : Automatically reload the server when the application is modified}
32-
{--poll : Use file system polling while watching in order to watch files over a network}';
32+
{--poll : Use file system polling while watching in order to watch files over a network}
33+
{--log-level= : Log messages at or above the specified log level}';
3334

3435
/**
3536
* The command's description.
@@ -78,7 +79,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
7879
$roadRunnerBinary,
7980
'-c', $this->configPath(),
8081
'-o', 'version=2.7',
81-
'-o', 'http.address='.$this->option('host').':'.$this->option('port'),
82+
'-o', 'http.address='.$this->option('host').':'.$this->getPort(),
8283
'-o', 'server.command='.(new PhpExecutableFinder)->find().' '.base_path(config('octane.roadrunner.command', 'vendor/bin/roadrunner-worker')),
8384
'-o', 'http.pool.num_workers='.$this->workerCount(),
8485
'-o', 'http.pool.max_jobs='.$this->option('max-requests'),
@@ -87,7 +88,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve
8788
'-o', 'http.static.dir='.base_path('public'),
8889
'-o', 'http.middleware='.config('octane.roadrunner.http_middleware', 'static'),
8990
'-o', 'logs.mode=production',
90-
'-o', app()->environment('local') ? 'logs.level=debug' : 'logs.level=warn',
91+
'-o', 'logs.level='.($this->option('log-level') ?: (app()->environment('local') ? 'debug' : 'warn')),
9192
'-o', 'logs.output=stdout',
9293
'-o', 'logs.encoding=json',
9394
'serve',
@@ -113,8 +114,8 @@ protected function writeServerStateFile(
113114
) {
114115
$serverStateFile->writeState([
115116
'appName' => config('app.name', 'Laravel'),
116-
'host' => $this->option('host'),
117-
'port' => $this->option('port'),
117+
'host' => $this->getHost(),
118+
'port' => $this->getPort(),
118119
'rpcPort' => $this->rpcPort(),
119120
'workers' => $this->workerCount(),
120121
'maxRequests' => $this->option('max-requests'),
@@ -173,7 +174,7 @@ protected function maxExecutionTime()
173174
*/
174175
protected function rpcPort()
175176
{
176-
return $this->option('rpc-port') ?: $this->option('port') - 1999;
177+
return $this->option('rpc-port') ?: $this->getPort() - 1999;
177178
}
178179

179180
/**

src/Commands/StartSwooleCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class StartSwooleCommand extends Command implements SignalableCommandInterface
2121
*/
2222
public $signature = 'octane:swoole
2323
{--host=127.0.0.1 : The IP address the server should bind to}
24-
{--port=8000 : The port the server should be available on}
24+
{--port= : The port the server should be available on}
2525
{--workers=auto : The number of workers that should be available to handle requests}
2626
{--task-workers=auto : The number of task workers that should be available to handle tasks}
2727
{--max-requests=500 : The number of requests to process before reloading the server}
@@ -78,7 +78,10 @@ public function handle(
7878
$this->forgetEnvironmentVariables();
7979

8080
$server = tap(new Process([
81-
(new PhpExecutableFinder)->find(), config('octane.swoole.command', 'swoole-server'), $serverStateFile->path(),
81+
(new PhpExecutableFinder)->find(),
82+
...config('octane.swoole.php_options', []),
83+
config('octane.swoole.command', 'swoole-server'),
84+
$serverStateFile->path(),
8285
], realpath(__DIR__.'/../../bin'), [
8386
'APP_ENV' => app()->environment(),
8487
'APP_BASE_PATH' => base_path(),
@@ -101,8 +104,8 @@ protected function writeServerStateFile(
101104
) {
102105
$serverStateFile->writeState([
103106
'appName' => config('app.name', 'Laravel'),
104-
'host' => $this->option('host'),
105-
'port' => $this->option('port'),
107+
'host' => $this->getHost(),
108+
'port' => $this->getPort(),
106109
'workers' => $this->workerCount($extension),
107110
'taskWorkers' => $this->taskWorkerCount($extension),
108111
'maxRequests' => $this->option('max-requests'),

0 commit comments

Comments
 (0)