Inspector
BlogTry for free
  • Concepts
    • Introduction
    • Metrics
    • Notification Channels
      • Email
      • Slack
      • Telegram
      • Microsoft Teams
      • Google Chat
      • Webhook
      • Discord
      • Pushover
      • PagerDuty
      • Twilio - SMS
    • Filtering Syntax
    • Alerts
    • Grouping Patterns
    • Custom Segments
    • Billing
    • AI Bug Fixer
  • Security and access
    • Access control
    • Two-factor authentication
    • Connected Devices
  • SDK
    • PHP
      • Installation & Set Up
      • Custom Segments
      • Exceptions Monitoring
      • Configuration
    • Laravel / Lumen
      • Upgrade Guide
      • Installation & Set-up
      • Http Requests Monitoring
      • Configuration
      • Exception Monitoring
      • Laravel Vapor
      • Laravel Octane
      • Laravel Nova Tool
      • Group by service name
    • Symfony
      • Installation
      • Configuration
      • Exception Monitoring
    • CodeIgniter
      • Installation
      • Configuration
      • Exception Monitoring
    • Drupal
    • Spring Boot
    • Slim
    • NodeJS
      • Configurations
      • Custom Segments
      • Exception monitoring
      • Autowiring
    • ExpressJs
    • Fastify
    • Python
    • Django
      • Installation & Set Up
      • Custom Segments
      • Error Monitoring
  • REST API
    • Authentication
    • Apps
    • Platforms
    • Transactions
    • Segments
    • Analytics
Powered by GitBook
On this page
  • Use the default Vapor runtime
  • Use Docker runtime
  • Increase ulimits
  1. SDK
  2. Laravel / Lumen

Laravel Vapor

How to make Inspector works on Laravel Vapor.

When using Vapor you have to enable the "serverless" flag in the Application Settings.

Use the default Vapor runtime

Behind the scene, Inspector uses curl to send data from your application to the monitoring system. In the default Vapor runtime curl is available in custom path, so you need to let the package know this path to properly build the curl command to send the data.

The package has an option for this configuration. You just need to publish the Inspector configuration file using the command below:

php artisan vendor:publish --provider="Inspector\Laravel\InspectorServiceProvider"

After publishing the config/inspector.php file you can customize the curlPath field in the "options" property:

/*
 |--------------------------------------------------------------------------
 | Custom transport options
 |--------------------------------------------------------------------------
 |
 | This is where you can set the transport option settings you'd like us to use when
 | communicating with Inspector.
 |
 */

'options' => [
    'curlPath' => '/opt/bin/curl --cacert /opt/lib/curl/cert.pem',
],

Test and Deploy

You can run the test command to verify everything is well configured before deploy in production:

php artisan inspector:test

Use Docker runtime

Docker based runtimes offer much more control over the execution environment, so you can deploy applications up to 10GB in size and allow you to install additional PHP extensions or libraries.

In order to use a Docker image instead of the Vapor native runtimes, set the runtime configuration option to docker within your vapor.yml file:

id: 2
name: vapor-laravel-app
environments:
    production:
        runtime: docker # Use docker as runtime environment
        build:
            - 'composer install --no-dev'

To make Inspector works you must be sure that the current PHP installation in the Docker image has proc_open, and proc_close native functions enabled.

The default Docker runtime should have these functions enabled by default. In alternative you need to create a custom php.ini file in your project root directory with these two functions not listed in the disable_functions parameter:

php.ini
disable_functions=exec,passthru,shell_exec,system,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source

Add the entry below in your environment .Dockerfile to override the default php.ini configuration:

environment.Dockerfile

# Update the `php.ini` file...
# Requires a `php.ini` file at the root of your project...
COPY ./php.ini /usr/local/etc/php/conf.d/overrides.ini

Increase ulimits

Ulimit is a Unix property used to set the number of open file descriptors for each process. It is also used to set restrictions on the resources used by a process. If the load on your application starts to increase due to background jobs, commands, or requests you could easily hit this limit for the underlying docker container behind your Vapor environment.

To increase this limit you can add ulimits section to the vapor.yml file for both production and staging environments.

services:
  frontend:
    build:
      context: .
      ulimits:
        nproc: 65535
        nofile:
          soft: 65535
PreviousException MonitoringNextLaravel Octane

Last updated 1 month ago

Learn more about in Vapor.

Now you can continue installing the library as usual:

Following this documentation on the docker

Docker runtime
https://docs.inspector.dev/guides/laravel/installation
https://docs.docker.com/reference/compose-file/build/#ulimits