# Health Check

**Package:** Laravel Compose | **Version:** 1 | **URL:** https://mozex.dev/docs/laravel-compose/v1/operating/health-check

---

If the app uses [spatie/laravel-health](https://github.com/spatie/laravel-health), one check covers every stack:

```php
use Mozex\Compose\Health\StacksCheck;
use Spatie\Health\Facades\Health;

Health::checks([
    StacksCheck::new(),
]);
```

The check asks each enabled stack for its status and reports:

| Result | When |
|---|---|
| ok | Every enabled stack is running. Also when no stack is registered, or Compose is disabled on the host. |
| warning | Every stack is running, but one has a healthcheck that isn't green (`starting` or `unhealthy`). |
| failed | An enabled stack has a stopped container, or was never created. Also when a container runs without any of the ports its compose file publishes. |

The meta carries one entry per stack (`healthy`, `unhealthy`, `no ports`, `down`, `not created`, or `disabled`), so a dashboard or an Oh Dear health page shows which one. Disabled stacks are never asked, so the check passes on hosts without Docker.

A container with no ports is alive and can even report healthy, since its healthcheck runs inside it, but nothing on the host can reach it. It happens when Docker couldn't bind a publish at start, typically an address that wasn't on the host yet at boot (see [Publish on loopback](https://mozex.dev/docs/laravel-compose/v1/stacks/compose-files#publish-on-loopback)), and the container was then started by hand. A `docker start` or `docker restart` may not bring the ports back. Recreating the container does:

```bash
php artisan compose:down meilisearch
php artisan compose:redeploy meilisearch
```

Pair it with `wait()` on the stack: `--wait` catches a container that never comes up during the deploy, and the health check catches one that dies later.

---

## Table of Contents

- [Introduction](https://mozex.dev/docs/laravel-compose/v1)
- [AI Integration](https://mozex.dev/docs/laravel-compose/v1/ai-integration)
- [Support Us](https://mozex.dev/docs/laravel-compose/v1/support-us)
- [Requirements](https://mozex.dev/docs/laravel-compose/v1/requirements)
- [Changelog](https://mozex.dev/docs/laravel-compose/v1/changelog)
- [Contributing](https://mozex.dev/docs/laravel-compose/v1/contributing)
- [Questions & Issues](https://mozex.dev/docs/laravel-compose/v1/questions-and-issues)
- [About Mozex](https://mozex.dev/docs/laravel-compose/v1/about)
- [Installation](https://mozex.dev/docs/laravel-compose/v1/installation)
- [Configuration](https://mozex.dev/docs/laravel-compose/v1/configuration)

### Stacks

- [Defining a Stack](https://mozex.dev/docs/laravel-compose/v1/stacks/defining-a-stack)
- [Discovery](https://mozex.dev/docs/laravel-compose/v1/stacks/discovery)
- [Environment Files](https://mozex.dev/docs/laravel-compose/v1/stacks/environment-files)
- [Compose Files](https://mozex.dev/docs/laravel-compose/v1/stacks/compose-files)

### Deploying

- [Redeploy](https://mozex.dev/docs/laravel-compose/v1/deploying/redeploy)
- [Hosting Platforms](https://mozex.dev/docs/laravel-compose/v1/deploying/hosting-platforms)
- [Remote Daemons](https://mozex.dev/docs/laravel-compose/v1/deploying/remote-daemons)
- [Doctor](https://mozex.dev/docs/laravel-compose/v1/deploying/doctor)

### Operating

- [Status, Logs, and Down](https://mozex.dev/docs/laravel-compose/v1/operating/status-logs-down)
- [Health Check](https://mozex.dev/docs/laravel-compose/v1/operating/health-check)
- [Events](https://mozex.dev/docs/laravel-compose/v1/operating/events)
- [Testing](https://mozex.dev/docs/laravel-compose/v1/operating/testing)

### Recipes

- [Meilisearch](https://mozex.dev/docs/laravel-compose/v1/recipes/meilisearch)
- [Telegram Bot API](https://mozex.dev/docs/laravel-compose/v1/recipes/telegram-bot-api)