diff --git a/composer.json b/composer.json index f45ad85..7053738 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "konsulting/nova-target": "^1.0", "laravel/framework": "^10.10", "laravel/nova": "*", + "laravel/pulse": "^1.0@beta", "laravel/sanctum": "^3.3", "laravel/tinker": "^2.8", "nurmuhammet/nova-inputmask": "^1.0", @@ -87,6 +88,6 @@ "php-http/discovery": true } }, - "minimum-stability": "stable", + "minimum-stability": "beta", "prefer-stable": true } diff --git a/composer.lock b/composer.lock index 6fb885b..2ac40f3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2effb5612ace8198f463cda2db0e9248", + "content-hash": "2145cb87216517d6fa957d42e23f4d81", "packages": [ { "name": "brick/math", @@ -706,6 +706,58 @@ ], "time": "2022-12-15T16:57:16+00:00" }, + { + "name": "doctrine/sql-formatter", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/sql-formatter.git", + "reference": "25a06c7bf4c6b8218f47928654252863ffc890a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/sql-formatter/zipball/25a06c7bf4c6b8218f47928654252863ffc890a5", + "reference": "25a06c7bf4c6b8218f47928654252863ffc890a5", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4" + }, + "bin": [ + "bin/sql-formatter" + ], + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\SqlFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jeremy Dorn", + "email": "jeremy@jeremydorn.com", + "homepage": "https://jeremydorn.com/" + } + ], + "description": "a PHP SQL highlighting library", + "homepage": "https://github.com/doctrine/sql-formatter/", + "keywords": [ + "highlight", + "sql" + ], + "support": { + "issues": "https://github.com/doctrine/sql-formatter/issues", + "source": "https://github.com/doctrine/sql-formatter/tree/1.1.3" + }, + "time": "2022-05-23T21:33:49+00:00" + }, { "name": "dragonmantank/cron-expression", "version": "v3.3.3", @@ -1925,6 +1977,91 @@ }, "time": "2023-10-27T13:53:59+00:00" }, + { + "name": "laravel/pulse", + "version": "v1.0.0-beta2", + "source": { + "type": "git", + "url": "https://github.com/laravel/pulse.git", + "reference": "1de2604de554c6a0c8c29f706615b4e30995628d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pulse/zipball/1de2604de554c6a0c8c29f706615b4e30995628d", + "reference": "1de2604de554c6a0c8c29f706615b4e30995628d", + "shasum": "" + }, + "require": { + "doctrine/sql-formatter": "^1.1", + "guzzlehttp/promises": "^1.0 || ^2.0", + "illuminate/auth": "^9.0 || ^10.0", + "illuminate/cache": "^9.0 || ^10.0", + "illuminate/config": "^9.0 || ^10.0", + "illuminate/console": "^9.0 || ^10.0", + "illuminate/contracts": "^9.0 || ^10.0", + "illuminate/database": "^9.0 || ^10.0", + "illuminate/events": "^9.0 || ^10.0", + "illuminate/http": "^9.0 || ^10.0", + "illuminate/queue": "^9.0 || ^10.0", + "illuminate/redis": "^9.0 || ^10.0", + "illuminate/routing": "^9.0 || ^10.0", + "illuminate/support": "^9.0 || ^10.0", + "illuminate/view": "^9.0 || ^10.0", + "livewire/livewire": "^3.0", + "nesbot/carbon": "^2.67", + "php": "^8.1" + }, + "conflict": { + "nunomaduro/collision": "<7.7.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.7", + "mockery/mockery": "^1.0", + "orchestra/testbench": "^8.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.2", + "phpstan/phpstan": "^1.11", + "predis/predis": "^2.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + }, + "laravel": { + "providers": [ + "Laravel\\Pulse\\PulseServiceProvider" + ], + "aliases": { + "Pulse": "Laravel\\Pulse\\Facades\\Pulse" + } + } + }, + "autoload": { + "psr-4": { + "Laravel\\Pulse\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "homepage": "https://github.com/laravel/pulse", + "keywords": [ + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/pulse/issues", + "source": "https://github.com/laravel/pulse" + }, + "time": "2023-12-01T18:46:10+00:00" + }, { "name": "laravel/sanctum", "version": "v3.3.2", @@ -2576,6 +2713,80 @@ ], "time": "2023-10-17T14:13:20+00:00" }, + { + "name": "livewire/livewire", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/livewire/livewire.git", + "reference": "724e712cac25c40455102f0b5abd002fd269433b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/livewire/livewire/zipball/724e712cac25c40455102f0b5abd002fd269433b", + "reference": "724e712cac25c40455102f0b5abd002fd269433b", + "shasum": "" + }, + "require": { + "illuminate/database": "^10.0", + "illuminate/support": "^10.0", + "illuminate/validation": "^10.0", + "league/mime-type-detection": "^1.9", + "php": "^8.1", + "symfony/http-kernel": "^6.2" + }, + "require-dev": { + "calebporzio/sushi": "^2.1", + "laravel/framework": "^10.0", + "laravel/prompts": "^0.1.6", + "mockery/mockery": "^1.3.1", + "orchestra/testbench": "^8.0", + "orchestra/testbench-dusk": "^8.0", + "phpunit/phpunit": "^9.0", + "psy/psysh": "@stable" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Livewire\\LivewireServiceProvider" + ], + "aliases": { + "Livewire": "Livewire\\Livewire" + } + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Livewire\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Caleb Porzio", + "email": "calebporzio@gmail.com" + } + ], + "description": "A front-end framework for Laravel.", + "support": { + "issues": "https://github.com/livewire/livewire/issues", + "source": "https://github.com/livewire/livewire/tree/v3.2.3" + }, + "funding": [ + { + "url": "https://github.com/livewire", + "type": "github" + } + ], + "time": "2023-12-02T18:55:31+00:00" + }, { "name": "monolog/monolog", "version": "3.5.0", @@ -11155,7 +11366,7 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "beta", "stability-flags": { "eolica/nova-locale-switcher": 20, "outl1ne/nova-grid": 20 diff --git a/config/database.php b/config/database.php index 137ad18..e36b1e0 100644 --- a/config/database.php +++ b/config/database.php @@ -78,6 +78,26 @@ return [ 'sslmode' => 'prefer', ], + 'pulse' => [ + 'driver' => 'mysql', + 'url' => env('PULSE_DATABASE_URL'), + 'host' => env('PULSE_DB_HOST', '127.0.0.1'), + 'port' => env('PULSE_DB_PORT', '3306'), + 'database' => env('PULSE_DB_DATABASE', 'forge'), + 'username' => env('PULSE_DB_USERNAME', 'forge'), + 'password' => env('PULSE_DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + 'sqlsrv' => [ 'driver' => 'sqlsrv', 'url' => env('DATABASE_URL'), diff --git a/config/pulse.php b/config/pulse.php new file mode 100644 index 0000000..ed66d70 --- /dev/null +++ b/config/pulse.php @@ -0,0 +1,227 @@ + env('PULSE_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | Pulse Path + |-------------------------------------------------------------------------- + | + | This is the path which the Pulse dashboard will be accessible from. Feel + | free to change this path to anything you'd like. Note that this won't + | affect the path of the internal API that is never exposed to users. + | + */ + + 'path' => env('PULSE_PATH', 'pulse'), + + /* + |-------------------------------------------------------------------------- + | Pulse Master Switch + |-------------------------------------------------------------------------- + | + | This configuration option may be used to completely disable all Pulse + | data recorders regardless of their individual configurations. This + | provides a single option to quickly disable all Pulse recording. + | + */ + + 'enabled' => env('PULSE_ENABLED', true), + + /* + |-------------------------------------------------------------------------- + | Pulse Storage Driver + |-------------------------------------------------------------------------- + | + | This configuration option determines which storage driver will be used + | while storing entries from Pulse's recorders. In addition, you also + | may provide any options to configure the selected storage driver. + | + */ + + 'storage' => [ + 'driver' => env('PULSE_STORAGE_DRIVER', 'database'), + + 'database' => [ + 'connection' => env('PULSE_DB_CONNECTION', null), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Pulse Ingest Driver + |-------------------------------------------------------------------------- + | + | This configuration options determines the ingest driver that will be used + | to capture entries from Pulse's recorders. Ingest drivers are great to + | free up your request workers quickly by offloading the data storage. + | + */ + + 'ingest' => [ + 'driver' => env('PULSE_INGEST_DRIVER', 'storage'), + + 'trim_lottery' => [1, 1_000], + + 'redis' => [ + 'connection' => env('PULSE_REDIS_CONNECTION'), + 'chunk' => 1000, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Pulse Cache Driver + |-------------------------------------------------------------------------- + | + | This configuration option determines the cache driver that will be used + | for various tasks, including caching dashboard results, establishing + | locks for events that should only occur on one server and signals. + | + */ + + 'cache' => env('PULSE_CACHE_DRIVER'), + + /* + |-------------------------------------------------------------------------- + | Pulse Route Middleware + |-------------------------------------------------------------------------- + | + | These middleware will be assigned to every Pulse route, giving you the + | chance to add your own middleware to this list or change any of the + | existing middleware. Of course, reasonable defaults are provided. + | + */ + + 'middleware' => [ + 'web', + Authorize::class, + ], + + /* + |-------------------------------------------------------------------------- + | Pulse Recorders + |-------------------------------------------------------------------------- + | + | The following array lists the "recorders" that will be registered with + | Pulse, along with their configuration. Recorders gather application + | event data from requests and tasks to pass to your ingest driver. + | + */ + + 'recorders' => [ + Recorders\CacheInteractions::class => [ + 'enabled' => env('PULSE_CACHE_INTERACTIONS_ENABLED', true), + 'sample_rate' => env('PULSE_CACHE_INTERACTIONS_SAMPLE_RATE', 1), + 'ignore' => [ + '/^laravel:pulse:/', // Internal Pulse keys... + '/^illuminate:/', // Internal Laravel keys... + '/^telescope:/', // Internal Telescope keys... + '/^nova/', // Internal Nova keys... + '/^.+@.+\|(?:(?:\d+\.\d+\.\d+\.\d+)|[0-9a-fA-F:]+)(?::timer)?$/', // Breeze / Jetstream authentication rate limiting... + '/^[a-zA-Z0-9]{40}$/', // Session IDs... + ], + 'groups' => [ + '/^job-exceptions:.*/' => 'job-exceptions:*', + // '/:\d+/' => ':*', + ], + ], + + Recorders\Exceptions::class => [ + 'enabled' => env('PULSE_EXCEPTIONS_ENABLED', true), + 'sample_rate' => env('PULSE_EXCEPTIONS_SAMPLE_RATE', 1), + 'location' => env('PULSE_EXCEPTIONS_LOCATION', true), + 'ignore' => [ + // '/^Package\\\\Exceptions\\\\/', + ], + ], + + Recorders\Queues::class => [ + 'enabled' => env('PULSE_QUEUES_ENABLED', true), + 'sample_rate' => env('PULSE_QUEUES_SAMPLE_RATE', 1), + 'ignore' => [ + // '/^Package\\\\Jobs\\\\/', + ], + ], + + Recorders\Servers::class => [ + 'server_name' => env('PULSE_SERVER_NAME', gethostname()), + 'directories' => explode(':', env('PULSE_SERVER_DIRECTORIES', '/')), + ], + + Recorders\SlowJobs::class => [ + 'enabled' => env('PULSE_SLOW_JOBS_ENABLED', true), + 'sample_rate' => env('PULSE_SLOW_JOBS_SAMPLE_RATE', 1), + 'threshold' => env('PULSE_SLOW_JOBS_THRESHOLD', 1000), + 'ignore' => [ + // '/^Package\\\\Jobs\\\\/', + ], + ], + + Recorders\SlowOutgoingRequests::class => [ + 'enabled' => env('PULSE_SLOW_OUTGOING_REQUESTS_ENABLED', true), + 'sample_rate' => env('PULSE_SLOW_OUTGOING_REQUESTS_SAMPLE_RATE', 1), + 'threshold' => env('PULSE_SLOW_OUTGOING_REQUESTS_THRESHOLD', 1000), + 'ignore' => [ + // '#^http://127\.0\.0\.1:13714#', // Inertia SSR... + ], + 'groups' => [ + // '#^https://api\.github\.com/repos/.*$#' => 'api.github.com/repos/*', + // '#^https?://([^/]*).*$#' => '\1', + // '#/\d+#' => '/*', + ], + ], + + Recorders\SlowQueries::class => [ + 'enabled' => env('PULSE_SLOW_QUERIES_ENABLED', true), + 'sample_rate' => env('PULSE_SLOW_QUERIES_SAMPLE_RATE', 1), + 'threshold' => env('PULSE_SLOW_QUERIES_THRESHOLD', 1000), + 'location' => env('PULSE_SLOW_QUERIES_LOCATION', true), + 'ignore' => [ + '/(["`])pulse_[\w]+?\1/', // Pulse tables... + ], + ], + + Recorders\SlowRequests::class => [ + 'enabled' => env('PULSE_SLOW_REQUESTS_ENABLED', true), + 'sample_rate' => env('PULSE_SLOW_REQUESTS_SAMPLE_RATE', 1), + 'threshold' => env('PULSE_SLOW_REQUESTS_THRESHOLD', 1000), + 'ignore' => [ + '#^/pulse$#', // Pulse dashboard... + ], + ], + + Recorders\UserJobs::class => [ + 'enabled' => env('PULSE_USER_JOBS_ENABLED', true), + 'sample_rate' => env('PULSE_USER_JOBS_SAMPLE_RATE', 1), + 'ignore' => [ + // '/^Package\\\\Jobs\\\\/', + ], + ], + + Recorders\UserRequests::class => [ + 'enabled' => env('PULSE_USER_REQUESTS_ENABLED', true), + 'sample_rate' => env('PULSE_USER_REQUESTS_SAMPLE_RATE', 1), + 'ignore' => [ + '#^/pulse$#', // Pulse dashboard... + ], + ], + ], +];