Skip to main content

Installation

Before diving into provider-specific configurations, ensure you have completed the initial setup steps outlined in our quick start guide. If you’re looking for an easier way to deploy Nightwatch, consider using Laravel Cloud or Laravel Forge, which offer streamlined setup processes.

Linux servers

The instructions below are tailored for Ubuntu systems. If you’re running a different Linux distribution, you may need to adjust the commands accordingly. After installing the Nightwatch package via Composer, add your environment variables to your application’s .env file:
Important: If you add or modify the NIGHTWATCH_TOKEN after starting the service, you will need to restart the service for the changes to take effect.

Running as a systemd service

For production deployments, we recommend running the Nightwatch agent as a systemd service since systemd is installed by default on every Ubuntu system. This ensures the agent starts automatically on boot and restarts if it ever crashes. First, create a new service file:
Then, add the following configuration:
Finally, enable and start the service:
You can check the service status at any time:

Using Supervisor

If you prefer Supervisor over systemd, follow these steps to set it up:
Create a configuration file:
Add the configuration:
Update Supervisor and start the process:

Monitoring

Health checks

The Nightwatch agent includes a built-in status command:
This command exits with a non-zero status code if there are any connectivity issues, making it ideal for monitoring scripts.