From 70147d708ce7d5998d5506fa7f2b050b32a83e87 Mon Sep 17 00:00:00 2001 From: Arnaud RITTI <77437157+arnaud-ritti@users.noreply.github.com> Date: Fri, 10 Oct 2025 18:55:28 +0200 Subject: [PATCH 1/2] Add Nightwatch health check script --- src/common/usr/local/bin/healthcheck-nightwatch | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 src/common/usr/local/bin/healthcheck-nightwatch diff --git a/src/common/usr/local/bin/healthcheck-nightwatch b/src/common/usr/local/bin/healthcheck-nightwatch new file mode 100755 index 00000000..7c21a462 --- /dev/null +++ b/src/common/usr/local/bin/healthcheck-nightwatch @@ -0,0 +1,2 @@ +#!/bin/sh +php "${APP_BASE_DIR}/artisan" nightwatch:status \ No newline at end of file From ace592e28ed259f0bb686f0369a3b5a109b880ee Mon Sep 17 00:00:00 2001 From: Jay Rogers Date: Tue, 27 Jan 2026 11:45:28 -0600 Subject: [PATCH 2/2] Add documentation for Laravel Nightwatch --- .../1.laravel/5.nightwatch.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docs/content/docs/3.framework-guides/1.laravel/5.nightwatch.md diff --git a/docs/content/docs/3.framework-guides/1.laravel/5.nightwatch.md b/docs/content/docs/3.framework-guides/1.laravel/5.nightwatch.md new file mode 100644 index 00000000..2d5e82e5 --- /dev/null +++ b/docs/content/docs/3.framework-guides/1.laravel/5.nightwatch.md @@ -0,0 +1,51 @@ +--- +head.title: 'Laravel Nightwatch with Docker - Docker PHP - Server Side Up' +description: 'Learn how to configure Laravel Nightwatch with Docker.' +layout: docs +title: Nightwatch +--- + +## Laravel Nightwatch with Docker +Run Laravel Nightwatch by passing the Artisan command as the container's command. Nightwatch is Laravel's observability platform for monitoring application performance, errors, and queries in real-time. + +::note +Before using Nightwatch with Docker, follow the [Laravel Nightwatch setup instructions](https://nightwatch.laravel.com/docs/start-guide) to install and configure the Nightwatch package in your Laravel application. +:: + +## Docker Compose example + +This example runs Nightwatch as a separate container using the same image as your web service. + +**Key points:** +- Use the same image for both your web and Nightwatch services +- Set `SIGTERM` as the stop signal for graceful shutdown (especially for `fpm-apache` and `fpm-nginx`) +- Include a health check to monitor Nightwatch status + +```yml [compose.yml] +services: + php: + image: my/laravel-app + + nightwatch: + image: my/laravel-app + command: ["php", "/var/www/html/artisan", "nightwatch:agent"] + stop_signal: SIGTERM + healthcheck: + test: ["CMD", "healthcheck-nightwatch"] + start_period: 10s +``` + +## How the health check works + +The `healthcheck-nightwatch` command runs `php artisan nightwatch:status` to verify that the Nightwatch agent is running and connected. Docker uses this to determine container health and can automatically restart unhealthy containers. + +## Advanced configuration + +**Graceful shutdown:** The `SIGTERM` signal ensures the Nightwatch agent finishes processing current events before stopping. This is especially important for `fpm-apache` and `fpm-nginx` images. + +::tip +**Multiple processes in one container:** If you're running `fpm-nginx` or `fpm-apache` and you'd like to have everything in a single container, you can [write your own S6 Overlay service script](https://github.com/just-containers/s6-overlay/tree/master#writing-a-service-script){target="_blank"} to properly manage multiple processes in a single container. Learn more about about this in our [Using S6 Overlay guide](/docs/guide/using-s6-overlay). +:: + +## Learn More +- [Laravel Nightwatch Documentation](https://nightwatch.laravel.com/docs/start-guide)