diff --git a/src/Commands/StartCommand.php b/src/Commands/StartCommand.php index 885ce72bd..b2e671cfb 100644 --- a/src/Commands/StartCommand.php +++ b/src/Commands/StartCommand.php @@ -17,6 +17,7 @@ class StartCommand extends Command implements SignalableCommandInterface {--server= : The server that should be used to serve the application} {--host=127.0.0.1 : The IP address the server should bind to} {--port= : The port the server should be available on [default: "8000"]} + {--rpc-host= : The RPC IP address the server should bind to} {--rpc-port= : The RPC port the server should be available on} {--workers=auto : The number of workers that should be available to handle requests} {--task-workers=auto : The number of task workers that should be available to handle tasks} @@ -76,6 +77,7 @@ protected function startRoadRunnerServer() return $this->call('octane:roadrunner', [ '--host' => $this->getHost(), '--port' => $this->getPort(), + '--rpc-host' => $this->option('rpc-host'), '--rpc-port' => $this->option('rpc-port'), '--workers' => $this->option('workers'), '--max-requests' => $this->option('max-requests'), diff --git a/src/Commands/StartRoadRunnerCommand.php b/src/Commands/StartRoadRunnerCommand.php index a207ef7f6..7d44455bc 100644 --- a/src/Commands/StartRoadRunnerCommand.php +++ b/src/Commands/StartRoadRunnerCommand.php @@ -24,6 +24,7 @@ class StartRoadRunnerCommand extends Command implements SignalableCommandInterfa public $signature = 'octane:roadrunner {--host=127.0.0.1 : The IP address the server should bind to} {--port= : The port the server should be available on} + {--rpc-host= : The RPC IP address the server should bind to} {--rpc-port= : The RPC port the server should be available on} {--workers=auto : The number of workers that should be available to handle requests} {--max-requests=500 : The number of requests to process before reloading the server} @@ -83,7 +84,7 @@ public function handle(ServerProcessInspector $inspector, ServerStateFile $serve '-o', 'server.command='.(new PhpExecutableFinder)->find().' '.base_path(config('octane.roadrunner.command', 'vendor/bin/roadrunner-worker')), '-o', 'http.pool.num_workers='.$this->workerCount(), '-o', 'http.pool.max_jobs='.$this->option('max-requests'), - '-o', 'rpc.listen=tcp://'.$this->option('host').':'.$this->rpcPort(), + '-o', 'rpc.listen=tcp://'.$this->rpcHost().':'.$this->rpcPort(), '-o', 'http.pool.supervisor.exec_ttl='.$this->maxExecutionTime(), '-o', 'http.static.dir='.base_path('public'), '-o', 'http.middleware='.config('octane.roadrunner.http_middleware', 'static'), @@ -167,6 +168,16 @@ protected function maxExecutionTime() return config('octane.max_execution_time', '30').'s'; } + /** + * Get the RPC IP address the server should be available on. + * + * @return int + */ + protected function rpcHost() + { + return $this->option('rpc-host') ?: $this->getHost(); + } + /** * Get the RPC port the server should be available on. *