- 添加 Dockerfile 与多套 docker-compose 配置(开发/生产环境) - 集成 Laravel Octane (Swoole) 提升性能 - 新增健康检查、监控脚本及部署文档 - 新增 Docker 镜像离线导入包(MySQL/Redis/Meilisearch) - 优化文档转换、预览服务及队列任务 - 添加 CreateAdminUser 命令与路由健康检查接口 - 新增 Swoole 队列兼容性测试套件 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
225 lines
7.0 KiB
PHP
225 lines
7.0 KiB
PHP
<?php
|
|
|
|
use Laravel\Octane\Contracts\OperationTerminated;
|
|
use Laravel\Octane\Events\RequestHandled;
|
|
use Laravel\Octane\Events\RequestReceived;
|
|
use Laravel\Octane\Events\RequestTerminated;
|
|
use Laravel\Octane\Events\TaskReceived;
|
|
use Laravel\Octane\Events\TaskTerminated;
|
|
use Laravel\Octane\Events\TickReceived;
|
|
use Laravel\Octane\Events\TickTerminated;
|
|
use Laravel\Octane\Events\WorkerErrorOccurred;
|
|
use Laravel\Octane\Events\WorkerStarting;
|
|
use Laravel\Octane\Events\WorkerStopping;
|
|
use Laravel\Octane\Listeners\CloseMonologHandlers;
|
|
use Laravel\Octane\Listeners\CollectGarbage;
|
|
use Laravel\Octane\Listeners\DisconnectFromDatabases;
|
|
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
|
|
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
|
|
use Laravel\Octane\Listeners\FlushOnce;
|
|
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
|
|
use Laravel\Octane\Listeners\FlushUploadedFiles;
|
|
use Laravel\Octane\Listeners\ReportException;
|
|
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
|
|
use Laravel\Octane\Octane;
|
|
|
|
return [
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Octane Server
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| This value determines the default "server" that will be used by Octane
|
|
| when starting, restarting, or stopping your server via the CLI. You
|
|
| are free to change this to the supported server of your choosing.
|
|
|
|
|
| Supported: "roadrunner", "swoole", "frankenphp"
|
|
|
|
|
*/
|
|
|
|
'server' => env('OCTANE_SERVER', 'swoole'),
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Force HTTPS
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| When this configuration value is set to "true", Octane will inform the
|
|
| framework that all absolute links must be generated using the HTTPS
|
|
| protocol. Otherwise your links may be generated using plain HTTP.
|
|
|
|
|
*/
|
|
|
|
'https' => env('OCTANE_HTTPS', false),
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Octane Listeners
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| All of the event listeners for Octane's events are defined below. These
|
|
| listeners are responsible for resetting your application's state for
|
|
| the next request. You may even add your own listeners to the list.
|
|
|
|
|
*/
|
|
|
|
'listeners' => [
|
|
WorkerStarting::class => [
|
|
EnsureUploadedFilesAreValid::class,
|
|
EnsureUploadedFilesCanBeMoved::class,
|
|
],
|
|
|
|
RequestReceived::class => [
|
|
// 准备应用程序处理下一个操作
|
|
// 准备应用程序处理下一个请求
|
|
//
|
|
],
|
|
|
|
RequestHandled::class => [
|
|
//
|
|
],
|
|
|
|
RequestTerminated::class => [
|
|
// FlushUploadedFiles::class,
|
|
],
|
|
|
|
TaskReceived::class => [
|
|
// 准备应用程序处理下一个操作
|
|
//
|
|
],
|
|
|
|
TaskTerminated::class => [
|
|
//
|
|
],
|
|
|
|
TickReceived::class => [
|
|
// 准备应用程序处理下一个操作
|
|
//
|
|
],
|
|
|
|
TickTerminated::class => [
|
|
//
|
|
],
|
|
|
|
OperationTerminated::class => [
|
|
FlushOnce::class,
|
|
FlushTemporaryContainerInstances::class,
|
|
// DisconnectFromDatabases::class,
|
|
// CollectGarbage::class,
|
|
],
|
|
|
|
WorkerErrorOccurred::class => [
|
|
ReportException::class,
|
|
StopWorkerIfNecessary::class,
|
|
],
|
|
|
|
WorkerStopping::class => [
|
|
CloseMonologHandlers::class,
|
|
],
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Warm / Flush Bindings
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The bindings listed below will either be pre-warmed when a worker boots
|
|
| or they will be flushed before every new request. Flushing a binding
|
|
| will force the container to resolve that binding again when asked.
|
|
|
|
|
*/
|
|
|
|
'warm' => [
|
|
// 默认预热的服务
|
|
],
|
|
|
|
'flush' => [
|
|
//
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Octane Swoole Tables
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| While using Swoole, you may define additional tables as required by the
|
|
| application. These tables can be used to store data that needs to be
|
|
| quickly accessed by other workers on the particular Swoole server.
|
|
|
|
|
*/
|
|
|
|
'tables' => [
|
|
'example:1000' => [
|
|
'name' => 'string:1000',
|
|
'votes' => 'int',
|
|
],
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Octane Swoole Cache Table
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| While using Swoole, you may leverage the Octane cache, which is powered
|
|
| by a Swoole table. You may set the maximum number of rows as well as
|
|
| the number of bytes per row using the configuration options below.
|
|
|
|
|
*/
|
|
|
|
'cache' => [
|
|
'rows' => env('OCTANE_CACHE_ROWS', 1000),
|
|
'bytes' => env('OCTANE_CACHE_BYTES', 10000),
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| File Watching
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The following list of files and directories will be watched when using
|
|
| the --watch option offered by Octane. If any of the directories and
|
|
| files are changed, Octane will automatically reload your workers.
|
|
|
|
|
*/
|
|
|
|
'watch' => [
|
|
'app',
|
|
'bootstrap',
|
|
'config/**/*.php',
|
|
'database/**/*.php',
|
|
'public/**/*.php',
|
|
'resources/**/*.php',
|
|
'routes',
|
|
'composer.lock',
|
|
'.env',
|
|
],
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Garbage Collection Threshold
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| When executing long-lived PHP scripts such as Octane, memory can build
|
|
| up before being cleared by PHP. You can force Octane to run garbage
|
|
| collection if your application consumes this amount of megabytes.
|
|
|
|
|
*/
|
|
|
|
'garbage' => env('OCTANE_GARBAGE_COLLECTION', 50),
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Maximum Execution Time
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The following setting configures the maximum execution time for requests
|
|
| being handled by Octane. You may set this value to 0 to indicate that
|
|
| there isn't a specific time limit on Octane request execution time.
|
|
|
|
|
*/
|
|
|
|
'max_execution_time' => env('OCTANE_MAX_EXECUTION_TIME', 30),
|
|
|
|
];
|