the browser-facing portion of osu!
at master 7.2 kB view raw
1<?php 2 3use App\Listeners\OctaneResetLocalCache; 4use App\Providers\AppServiceProvider; 5use Laravel\Octane\Contracts\OperationTerminated; 6use Laravel\Octane\Events\RequestHandled; 7use Laravel\Octane\Events\RequestReceived; 8use Laravel\Octane\Events\RequestTerminated; 9use Laravel\Octane\Events\TaskReceived; 10use Laravel\Octane\Events\TaskTerminated; 11use Laravel\Octane\Events\TickReceived; 12use Laravel\Octane\Events\TickTerminated; 13use Laravel\Octane\Events\WorkerErrorOccurred; 14use Laravel\Octane\Events\WorkerStarting; 15use Laravel\Octane\Events\WorkerStopping; 16use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid; 17use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved; 18use Laravel\Octane\Listeners\FlushTemporaryContainerInstances; 19use Laravel\Octane\Listeners\ReportException; 20use Laravel\Octane\Listeners\StopWorkerIfNecessary; 21use Laravel\Octane\Octane; 22 23return [ 24 25 /* 26 |-------------------------------------------------------------------------- 27 | Octane Server 28 |-------------------------------------------------------------------------- 29 | 30 | This value determines the default "server" that will be used by Octane 31 | when starting, restarting, or stopping your server via the CLI. You 32 | are free to change this to the supported server of your choosing. 33 | 34 | Supported: "roadrunner", "swoole" 35 | 36 */ 37 38 'server' => env('OCTANE_SERVER', 'swoole'), 39 40 /* 41 |-------------------------------------------------------------------------- 42 | Force HTTPS 43 |-------------------------------------------------------------------------- 44 | 45 | When this configuration value is set to "true", Octane will inform the 46 | framework that all absolute links must be generated using the HTTPS 47 | protocol. Otherwise your links may be generated using plain HTTP. 48 | 49 */ 50 51 'https' => env('OCTANE_HTTPS', false), 52 53 /* 54 |-------------------------------------------------------------------------- 55 | Octane Listeners 56 |-------------------------------------------------------------------------- 57 | 58 | All of the event listeners for Octane's events are defined below. These 59 | listeners are responsible for resetting your application's state for 60 | the next request. You may even add your own listeners to the list. 61 | 62 */ 63 64 'listeners' => [ 65 WorkerStarting::class => [ 66 EnsureUploadedFilesAreValid::class, 67 EnsureUploadedFilesCanBeMoved::class, 68 ], 69 70 RequestReceived::class => [ 71 ...Octane::prepareApplicationForNextOperation(), 72 ...Octane::prepareApplicationForNextRequest(), 73 OctaneResetLocalCache::class, 74 ], 75 76 RequestHandled::class => [ 77 ], 78 79 RequestTerminated::class => [ 80 ], 81 82 TaskReceived::class => [ 83 ...Octane::prepareApplicationForNextOperation(), 84 ], 85 86 TaskTerminated::class => [ 87 ], 88 89 TickReceived::class => [ 90 ...Octane::prepareApplicationForNextOperation(), 91 ], 92 93 TickTerminated::class => [ 94 ], 95 96 OperationTerminated::class => [ 97 FlushTemporaryContainerInstances::class, 98 // DisconnectFromDatabases::class, 99 // CollectGarbage::class, 100 ], 101 102 WorkerErrorOccurred::class => [ 103 ReportException::class, 104 StopWorkerIfNecessary::class, 105 ], 106 107 WorkerStopping::class => [ 108 ], 109 ], 110 111 /* 112 |-------------------------------------------------------------------------- 113 | Warm / Flush Bindings 114 |-------------------------------------------------------------------------- 115 | 116 | The bindings listed below will either be pre-warmed when a worker boots 117 | or they will be flushed before every new request. Flushing a binding 118 | will force the container to resolve that binding again when asked. 119 | 120 */ 121 122 'warm' => [ 123 ...Octane::defaultServicesToWarm(), 124 ...array_keys(AppServiceProvider::SINGLETONS), 125 ], 126 127 'flush' => [ 128 ], 129 130 'swoole' => [ 131 'options' => [ 132 // default of 10mb is too low for beatmap contest uploads 133 'package_max_length' => 32 * 1024 * 1024, 134 ], 135 ], 136 137 /* 138 |-------------------------------------------------------------------------- 139 | Octane Cache Table 140 |-------------------------------------------------------------------------- 141 | 142 | While using Swoole, you may leverage the Octane cache, which is powered 143 | by a Swoole table. You may set the maximum number of rows as well as 144 | the number of bytes per row using the configuration options below. 145 | 146 */ 147 148 'cache' => [ 149 'rows' => 1000, 150 'bytes' => 10000, 151 ], 152 153 /* 154 |-------------------------------------------------------------------------- 155 | Octane Swoole Tables 156 |-------------------------------------------------------------------------- 157 | 158 | While using Swoole, you may define additional tables as required by the 159 | application. These tables can be used to store data that needs to be 160 | quickly accessed by other workers on the particular Swoole server. 161 | 162 */ 163 164 'tables' => [ 165 'example:1000' => [ 166 'name' => 'string:1000', 167 'votes' => 'int', 168 ], 169 ], 170 171 /* 172 |-------------------------------------------------------------------------- 173 | File Watching 174 |-------------------------------------------------------------------------- 175 | 176 | The following list of files and directories will be watched when using 177 | the --watch option offered by Octane. If any of the directories and 178 | files are changed, Octane will automatically reload your workers. 179 | 180 */ 181 182 // Watching single file is kind of broken hence the wildcard suffix for such entries. 183 // Reference: https://github.com/paulmillr/chokidar/issues/1005 184 'watch' => [ 185 '.env*', 186 'app', 187 'bootstrap', 188 'composer.lock*', 189 'config', 190 'database', 191 'public/assets/manifest.json*', 192 'resources/lang', 193 'resources/views', 194 'routes', 195 ], 196 197 /* 198 |-------------------------------------------------------------------------- 199 | Garbage Collection Threshold 200 |-------------------------------------------------------------------------- 201 | 202 | When executing long-lived PHP scripts such as Octane, memory can build 203 | up before being cleared by PHP. You can force Octane to run garbage 204 | collection if your application consumes this amount of megabytes. 205 | 206 */ 207 208 'garbage' => 500, 209 210 /* 211 |-------------------------------------------------------------------------- 212 | Maximum Execution Time 213 |-------------------------------------------------------------------------- 214 | 215 | The following setting configures the maximum execution time for requests 216 | being handled by Octane. You may set this value to 0 to indicate that 217 | there isn't a specific time limit on Octane request execution time. 218 | 219 */ 220 221 'max_execution_time' => 180, 222 223 'state_file' => presence(env('OCTANE_STATE_FILE')) ?? storage_path('logs/octane-server-state.json'), 224];