Skip to main content
The NightOwl agent is a long-running process. Don’t leave it in the foreground of an SSH session — hand it to a supervisor so it restarts on crash and survives reboots.

Buffer directory

Before starting the agent, ensure the local SQLite buffer directory exists and is writable by the process user:
Inside a Docker container the buffer directory is required at container start — bake it into your image or mount a persistent volume so buffered telemetry survives restarts.

Supervisor

Recommended for most deployments — works out of the box on Ubuntu/Debian/RHEL, integrates with Laravel Forge and most PaaS runners.
Reload with:
stopwaitsecs=30 gives the agent time to flush pending rows out of SQLite into PostgreSQL before SIGKILL. If you drain heavy volume, bump it to 60.

systemd

Use this on stock Linux without Supervisor (or when you already manage app services with systemd).
Save as /etc/systemd/system/nightowl-agent.service, then:

Docker

Run the agent as its own container (separate from your web container). Share the app code and the storage/nightowl volume:
Putting the agent in its own container keeps ingest throughput independent of your PHP-FPM worker count, and lets you scale drain workers without touching the web tier.

Graceful shutdown

On SIGTERM the agent:
  1. Stops accepting new TCP/UDP payloads.
  2. Flushes any in-memory batches to SQLite.
  3. Waits up to 30 seconds for drain workers to finish their current COPY batch.
  4. Closes the PostgreSQL connection cleanly.
Because all data passes through the SQLite WAL buffer before PostgreSQL, a hard kill won’t lose telemetry — it’ll just resume draining on the next start.

Health checks

The async driver exposes a health endpoint on NIGHTOWL_HEALTH_PORT (default 2409):
Returns ingest/drain rates, buffer depth, and active diagnosis rules. Wire this into your existing health-check infrastructure (Kubernetes liveness probe, Consul check, uptime monitor) so a stalled agent pages you before the buffer fills up. See Health monitoring for the fields and what to alert on.