Browse Source

引入sentry和部署

master
shuixiang 4 years ago
parent
commit
ed9da2bab6
  1. 4
      .env.example
  2. 16
      Envoy.blade.php
  3. 8
      app/Exceptions/Handler.php
  4. 1
      composer.json
  5. 1376
      composer.lock
  6. 57
      config/sentry.php

4
.env.example

@ -49,3 +49,7 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
SENTRY_LARAVEL_DSN="http://c998a1e07d774f8e828ecd46d7c9cba7@sentry.leadfyy.com/6"
SENTRY_TRACES_SAMPLE_RATE=1
SENTRY_ENVIRONMENT=local

16
Envoy.blade.php

@ -0,0 +1,16 @@
@servers(['yiyou_hainan_prod' => 'root@1.15.1.41'])
@story('deploy_prod',['on' => 'yiyou_hainan_prod'])
task_prod
@endstory
@task('task_prod')
cd /www/wwwroot/yytx.eugyl.com
git pull origin master
@if($composer)
composer install -o
@endif
chown -R www:www /www/wwwroot/yytx.eugyl.com
chmod -R 777 /www/wwwroot/yytx.eugyl.com/storage
chmod -R 777 /www/wwwroot/yytx.eugyl.com/public
@endtask

8
app/Exceptions/Handler.php

@ -36,9 +36,11 @@ class Handler extends ExceptionHandler
*/ */
public function register() public function register()
{ {
$this->reportable(function (Throwable $e) {
//
});
$this->reportable(function (Throwable $e) {
if ($this->shouldReport($e) && app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
} }
/** /**

1
composer.json

@ -13,6 +13,7 @@
"laravel/framework": "^8.40", "laravel/framework": "^8.40",
"laravel/tinker": "^2.5", "laravel/tinker": "^2.5",
"overtrue/wechat": "~5.0", "overtrue/wechat": "~5.0",
"sentry/sentry-laravel": "^2.8",
"super-eggs/dcat-distpicker": "^2.0", "super-eggs/dcat-distpicker": "^2.0",
"tencentcloud/tencentcloud-sdk-php": "^3.0" "tencentcloud/tencentcloud-sdk-php": "^3.0"
}, },

1376
composer.lock
File diff suppressed because it is too large
View File

57
config/sentry.php

@ -0,0 +1,57 @@
<?php
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
// capture release as git sha
// 'release' => trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')),
// When left empty or `null` the Laravel environment will be used
'environment' => env('SENTRY_ENVIRONMENT', env('APP_ENV')),
'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs
'logs' => true,
// Capture SQL queries in breadcrumbs
'sql_queries' => true,
// Capture bindings on SQL queries logged in breadcrumbs
'sql_bindings' => true,
// Capture queue job information in breadcrumbs
'queue_info' => true,
// Capture command information in breadcrumbs
'command_info' => true,
],
'tracing' => [
// Trace queue jobs as their own transactions
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),
// Capture queue jobs as spans when executed on the sync driver
'queue_jobs' => true,
// Capture SQL queries as spans
'sql_queries' => true,
// Try to find out where the SQL query originated from and add it to the query spans
'sql_origin' => true,
// Capture views as spans
'views' => true,
// Indicates if the tracing integrations supplied by Sentry should be loaded
'default_integrations' => true,
],
// @see: https://docs.sentry.io/platforms/php/configuration/options/#send-default-pii
'send_default_pii' => false,
'traces_sample_rate' => (float)(env('SENTRY_TRACES_SAMPLE_RATE', 0.0)),
'controllers_base_namespace' => env('SENTRY_CONTROLLERS_BASE_NAMESPACE', 'App\\Http\\Controllers'),
];
Loading…
Cancel
Save