改进 IP 监听
This commit is contained in:
parent
5762c8a3d6
commit
340b082ee8
@ -70,16 +70,27 @@ public function handle(): int
|
|||||||
// 关闭 Octane
|
// 关闭 Octane
|
||||||
Artisan::call('octane:stop');
|
Artisan::call('octane:stop');
|
||||||
|
|
||||||
if (! config('settings.node.ip')) {
|
// 刷新配置缓存
|
||||||
|
$this->info('正在刷新配置缓存。');
|
||||||
|
Artisan::call('config:cache');
|
||||||
|
Artisan::call('route:cache');
|
||||||
|
|
||||||
|
$node_ip = config('settings.node.ip');
|
||||||
|
|
||||||
|
if (!$node_ip) {
|
||||||
$this->error('请先配置节点 IP。');
|
$this->error('请先配置节点 IP。');
|
||||||
|
|
||||||
return CommandAlias::FAILURE;
|
return CommandAlias::FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新配置缓存
|
// 获取端口
|
||||||
$this->info('正在刷新配置缓存。');
|
$node_ips = explode(':', $node_ip);
|
||||||
Artisan::call('config:cache');
|
$node_host = $node_ips[0];
|
||||||
Artisan::call('route:cache');
|
if (count($node_ips) === 1) {
|
||||||
|
$node_port = 8000;
|
||||||
|
} else {
|
||||||
|
$node_port = $node_ips[1];
|
||||||
|
}
|
||||||
|
|
||||||
// redis 创建一个 hash
|
// redis 创建一个 hash
|
||||||
$this->info('正在注册节点。');
|
$this->info('正在注册节点。');
|
||||||
@ -105,7 +116,7 @@ public function handle(): int
|
|||||||
// 子进程
|
// 子进程
|
||||||
$this->info('正在启动 Web。');
|
$this->info('正在启动 Web。');
|
||||||
|
|
||||||
$command = 'php artisan octane:start --host=0.0.0.0 --rpc-port=6001 --port=8000';
|
$command = "php artisan octane:start --host=$node_host --port=$node_port";
|
||||||
$this->pipeCommand($command);
|
$this->pipeCommand($command);
|
||||||
} else {
|
} else {
|
||||||
$this->report();
|
$this->report();
|
||||||
|
Loading…
Reference in New Issue
Block a user