diff --git a/.env.example b/.env.example index 0d7018e..c44a023 100644 --- a/.env.example +++ b/.env.example @@ -74,3 +74,5 @@ TUF_REPO_CACHETIME=5 # Docker config HOST_UID=0 HOST_GID=0 + +OH_DEAR_HEALTH_CHECK_SECRET=123 diff --git a/app/Providers/HealthCheckProvider.php b/app/Providers/HealthCheckProvider.php new file mode 100644 index 0000000..2012b57 --- /dev/null +++ b/app/Providers/HealthCheckProvider.php @@ -0,0 +1,32 @@ + [ + Spatie\Health\ResultStores\InMemoryHealthResultStore::class, + ], + + /* + * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'. + * For Slack you need to install laravel/slack-notification-channel. + */ + 'notifications' => [ + /* + * Notifications will only get sent if this option is set to `true`. + */ + 'enabled' => false, + + 'notifications' => [ + Spatie\Health\Notifications\CheckFailedNotification::class => ['mail'], + ], + + /* + * Here you can specify the notifiable to which the notifications should be sent. The default + * notifiable will use the variables specified in this config file. + */ + 'notifiable' => Spatie\Health\Notifications\Notifiable::class, + + /* + * When checks start failing, you could potentially end up getting + * a notification every minute. + * + * With this setting, notifications are throttled. By default, you'll + * only get one notification per hour. + */ + 'throttle_notifications_for_minutes' => 60, + 'throttle_notifications_key' => 'health:latestNotificationSentAt:', + + 'mail' => [ + 'to' => 'your@example.com', + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + ], + + 'slack' => [ + 'webhook_url' => env('HEALTH_SLACK_WEBHOOK_URL', ''), + + /* + * If this is set to null the default channel of the webhook will be used. + */ + 'channel' => null, + + 'username' => null, + + 'icon' => null, + ], + ], + + /* + * You can let Oh Dear monitor the results of all health checks. This way, you'll + * get notified of any problems even if your application goes totally down. Via + * Oh Dear, you can also have access to more advanced notification options. + */ + 'oh_dear_endpoint' => [ + 'enabled' => true, + + /* + * When this option is enabled, the checks will run before sending a response. + * Otherwise, we'll send the results from the last time the checks have run. + */ + 'always_send_fresh_results' => true, + + /* + * The secret that is displayed at the Application Health settings at Oh Dear. + */ + 'secret' => env('OH_DEAR_HEALTH_CHECK_SECRET'), + + /* + * The URL that should be configured in the Application health settings at Oh Dear. + */ + 'url' => '/health-check', + ], + + /* + * You can specify a heartbeat URL for the Horizon check. + * This URL will be pinged if the Horizon check is successful. + * This way you can get notified if Horizon goes down. + */ + 'horizon' => [ + 'heartbeat_url' => env('HORIZON_HEARTBEAT_URL', null), + ], + + /* + * You can specify a heartbeat URL for the Schedule check. + * This URL will be pinged if the Schedule check is successful. + * This way you can get notified if the schedule fails to run. + */ + 'schedule' => [ + 'heartbeat_url' => env('SCHEDULE_HEARTBEAT_URL', null), + ], + + /* + * You can set a theme for the local results page + * + * - light: light mode + * - dark: dark mode + */ + 'theme' => 'light', + + /* + * When enabled, completed `HealthQueueJob`s will be displayed + * in Horizon's silenced jobs screen. + */ + 'silence_health_queue_job' => true, + + /* + * The response code to use for HealthCheckJsonResultsController when a health + * check has failed + */ + 'json_results_failure_status' => 200, + + /* + * You can specify a secret token that needs to be sent in the X-Secret-Token for secured access. + */ + 'secret_token' => env('HEALTH_SECRET_TOKEN') ?? null, + +/** + * By default, conditionally skipped health checks are treated as failures. + * You can override this behavior by uncommenting the configuration below. + * + * @link https://spatie.be/docs/laravel-health/v1/basic-usage/conditionally-running-or-modifying-checks + */ + // 'treat_skipped_as_failure' => false +];