Start free trial
Start free trial Log in

14-day free trial. No credit card.

Monitoring a Laravel app on Forge

What Forge gives you, what it doesn't, and how to layer application-level APM on top without fighting the platform.

  • Guide
  • 3 min read

How do I monitor a Laravel app deployed on Forge?

Forge covers server-level basics (server metrics, SSL, queue worker supervision) but not application telemetry. Layer an APM on top: NightOwl or Nightwatch Cloud (both built on the laravel/nightwatch package), or Sentry or Inspector with their own Laravel SDKs. The NightOwl agent runs as a Forge background process like any other worker. Forge's Supervisor restarts it if it crashes, and a line in your deploy script restarts it on each release.

Updated

Forge is the reason a lot of Laravel apps never set up real monitoring: it shows you a CPU graph, supervises your workers, emails you when a deploy fails, and that's enough to feel covered. It isn't. Forge operates at the server layer. It knows the box is healthy, not whether your checkout endpoint is slow, which query is the N+1, or that an exception started firing after this morning's deploy. Nothing about Forge gets in the way of adding the application layer: the agent runs as one more background process.

What Forge covers and doesn't

Layer Forge provides You still need
Server metricsServer charts (depend on your provider)Application-layer telemetry
Queue workersHorizon / queue:work background processesPer-class duration, attempts and failures
Scheduled tasksschedule:run cron, once you enable the schedulerInvocation history, duration, exception capture
Deploy healthDeploy log + email on failureRequest latency and exceptions after each deploy
LogsAccess via UI (tail)Aggregation, search, retention
ExceptionsNothingGrouped exceptions with alerts

Install NightOwl on a Forge server

On your local machine

Terminal
composer require nightowl/agent
php artisan nightowl:install
git push

Deploy via Forge as usual. Then add the agent as a background process in Forge's dashboard:

  • Processes → Add background process (on the server or the site)
  • Command: php artisan nightowl:agent
  • Working directory: /home/forge/yourapp.com/current (new sites use zero-downtime deploys, so the live code sits under current/)
  • User: forge
  • Stop seconds: 30, so the agent has time to shut down cleanly

Forge's Supervisor restarts the agent if it crashes. queue:restart doesn't touch it, so restart it from your deploy script (below) to pick up each new release.

Separate DB server for telemetry

NightOwl writes telemetry to a PostgreSQL database you own. Two sensible setups on Forge:

  1. Same DB as the app: simplest. Works for small apps. Telemetry writes share capacity with your application queries.
  2. Dedicated DB server: a separate Forge-managed PostgreSQL instance for telemetry only. Keeps the app database's hot path isolated, at the cost of one more server from your provider.

Use Forge's existing supervision for workers

Forge's queue workers (Horizon or plain queue:work) run as Supervisor-managed background processes. The Nightwatch package attaches to them automatically, with no extra configuration needed. Every job attempt fires events the package captures and ships to the NightOwl agent.

Scheduled task monitoring

Once you turn on the scheduler for the site, Forge adds a cron entry that runs php artisan schedule:run every minute. Without it, no scheduled task runs. The Nightwatch package records each scheduled task invocation automatically, and NightOwl surfaces them in the scheduled-tasks dashboard with full invocation history (status, duration, exception capture, skipped runs from withoutOverlapping). Runs skipped by onOneServer aren't recorded.

Deploy scripts for Forge

A zero-downtime Forge deploy script with one NightOwl-specific line. The agent runs as its own Supervisor-managed background process, so restart it after $ACTIVATE_RELEASE() to run the new release. Replace 12345 with the background process ID Forge shows.

Terminal
$CREATE_RELEASE()

cd $FORGE_RELEASE_DIRECTORY

$FORGE_COMPOSER install --no-dev --no-interaction --prefer-dist --optimize-autoloader
$FORGE_PHP artisan optimize
$FORGE_PHP artisan migrate --force

$ACTIVATE_RELEASE()

$RESTART_QUEUES()

# Restart the NightOwl agent on the new release
sudo -S supervisorctl restart daemon-12345:*

See inside the app Forge keeps running

Forge keeps the server up, but it can't tell you which route got slow or which job started failing. Add the NightOwl agent as a Forge background process next to your queue workers, and you get each request's timeline and each job class's p50, p95 and p99. It's from $5 a month flat, with the data in your own PostgreSQL.

No credit card needed.

Terminal
composer require nightowl/agent
php artisan nightowl:install
php artisan nightowl:agent

Frequently asked questions

Anything else, write to support@usenightowl.com

What does Laravel Forge provide for monitoring?

Forge gives you server-level basics: server metrics (what's available depends on your server provider, and metric alerts need Forge's Business plan), SSL certificate expiry, queue worker supervision via background processes, and access to your application log through its UI. It doesn't provide application-level APM: no request traces, no query monitoring, no exception grouping. You layer a separate APM on top for that.

How do I add application monitoring to a Forge-deployed Laravel app?

Install an APM the way you would on any Laravel app: NightOwl (built on the laravel/nightwatch package, data in your own PostgreSQL), Nightwatch Cloud (the official hosted option on the same package), or Sentry or Inspector with their own SDKs. Forge doesn't constrain your APM choice. For NightOwl specifically: composer require nightowl/agent, run the install command, point at your PostgreSQL, and add the agent as a Forge background process so Supervisor keeps it running like any other worker.

Can I run NightOwl's agent as a Forge background process?

Yes. Add the agent command (php artisan nightowl:agent) under Processes → Add background process on each server, with the site's current/ directory as the working directory. Forge uses Supervisor under the hood, so the agent is restarted if it crashes. Restart it from your deploy script after each release so it runs the new code. Don't cap its memory at 256 MB or below: the agent starts applying back-pressure once it passes NIGHTOWL_MAX_BUFFER_MEMORY (256 MB by default), and a lower cap would kill it first.

Do Forge's queue workers work with NightOwl queue monitoring?

Yes. Forge's Horizon or queue:work background process runs like any worker, and the Nightwatch package picks up JobProcessing / JobFailed events automatically. Every job attempt is recorded with class, duration, status, and exception regardless of which queue driver or process manager you use.

How do I monitor Forge's own health?

Forge surfaces server metrics in its dashboard and emails when deploys fail. For external uptime monitoring use a tool like UptimeRobot or Better Stack pointing at your domain. Forge doesn't fail silently but it also doesn't alert you to slow requests or application errors. That's the APM layer's job.

Should I put my database on the same server as the app?

For small apps, fine. For anything production-grade, no. Run PostgreSQL on its own server (or a managed service like AWS RDS). Benefits: DB doesn't starve the app for memory; you can resize independently; you can put your NightOwl BYOD database on a separate server too, keeping telemetry storage isolated from the app's hot path.

Related

Flat pricing, whatever your traffic does

Every plan starts with a 14-day free trial. No credit card needed.

Hobby
$5 a month

One app for a side project. Issues and alerts, with a 14-day dashboard window.

Start my 14-day trial
TeamRecommended
$15 a month

Up to 3 apps and 5 people per team. Full history, the MCP server, data clearing and agent health.

Start my 14-day trial
Agency
$69 a month

Unlimited client apps and people, one overview of every app, and apps you can hand over.

Start my 14-day trial