NIGHTOWL_INGEST_URI.
This mirrors how Laravel Nightwatch runs on Vapor — the agent lives on a persistent instance, and the serverless app transmits to it over the private network.
How it fits together
The Vapor app collects telemetry and transmits it over TCP. The agent host buffers and drains it to your PostgreSQL database. Only the agent host holds your database credentials and writes to Postgres — the Lambda functions never touch it.Install the
nightowl/agent package in your application as usual, and deploy the same release to both Vapor and the agent host. On Vapor the package only redirects Nightwatch’s collector to NIGHTOWL_INGEST_URI — you never run the nightowl:agent daemon there. On the agent host you run the daemon.Setup
Provision a long-running agent host
Stand up a persistent server that can reach your PostgreSQL database and sits in a network your Vapor environment can route to — an EC2 instance in the same VPC, or a Forge-managed server peered into it. This box runs the agent continuously; size it from the throughput guide.
Run the agent on that host
Deploy your application to the agent host and start the daemon under a supervisor, exactly as in Production deployment. Bind it to all interfaces so the Vapor app can reach it, and give it your database credentials and token:Run
php artisan nightowl:migrate on this host as part of its deploy — it owns the schema. See Configuration for the full variable list.Open the agent's port to the Vapor subnet
Add a security-group / firewall rule on the agent host allowing inbound TCP on the ingest port from your Vapor environment’s subnet:
Your Vapor environment must be attached to a network (VPC) that can route to the agent host’s private address.
| Setting | Value |
|---|---|
| Protocol | TCP |
| Port | 2407 |
| Source | your Vapor subnet CIDR (e.g. 10.0.0.0/21) |
Point the Vapor app at the agent
Set these on your Vapor environment. The Vapor app needs no
NIGHTOWL_INGEST_URI is the agent host’s private host:port — this is the one variable that redirects telemetry off loopback and across the network:NIGHTOWL_DB_* variables — it only transmits over TCP and never opens a database connection.Keep both sides on the same release
The agent verifies the payload’s protocol version and token, and the two hosts must agree on thelaravel/nightwatch version that shapes the wire format. Because the agent host and the Vapor app run the same application release, deploying the same commit to both keeps them in lockstep. If you upgrade nightowl/agent (and the laravel/nightwatch it pulls in), deploy that release to both hosts together, then restart the daemon.
Verifying it works
Open the health dashboard for the agent host after a deploy. Its ingest rate should climb in step with your Vapor traffic, and buffer depth should stay low as the drain keeps up. If ingest stays flat, check — in order — that the security-group rule allows2407 from the Lambda subnet, that NIGHTOWL_INGEST_URI points at the agent’s private address, and that the NIGHTOWL_TOKEN matches on both hosts.