generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0158fa6
commit e08c8f9
Showing
23 changed files
with
144 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
title: Backups | ||
weight: 2 | ||
--- | ||
|
||
Using a package like [spatie/laravel-backup](https://spatie.be/docs/laravel-backup) you can create backups of your application. The backups are stored as zip files in a directory. | ||
|
||
The `BackupCheck` will verify if your backups are up to date. It can check: | ||
- if the youngest backup has been made before a certain date | ||
- if the oldest backup was made after a certain date | ||
- the number of backups | ||
- the size of the backups | ||
|
||
## Usage | ||
|
||
Here's how you can register the check. | ||
|
||
You can use the `locatedAt` method to specify the directory where the backups are stored. The `locatedAt` method accepts a glob pattern. | ||
|
||
```php | ||
use Spatie\Health\Facades\Health; | ||
use Spatie\Health\Checks\Checks\BackupsCheck; | ||
|
||
Health::checks([ | ||
BackupsCheck::new()->locatedAt('/path/to/backups/*.zip'), | ||
]); | ||
``` | ||
|
||
### Check the number of the backups | ||
|
||
You can use the `numberOfBackups` method to check if the number of backups is within a certain range. | ||
The function accepts a `min` and/or a `max` parameter. | ||
|
||
```php | ||
use Spatie\Health\Facades\Health; | ||
use Spatie\Health\Checks\Checks\BackupsCheck; | ||
|
||
Health::checks([ | ||
BackupsCheck::new()->locatedAt('/path/to/backups/*.zip')->numberOfBackups(min: 5, max: 10), | ||
]); | ||
``` | ||
|
||
### Check the age of the backups | ||
|
||
You can use the `youngestBackShouldHaveBeenMadeBefore` method to check if the youngest backup was made before a certain date. | ||
|
||
Here's an example where we make sure the most recent backup is not older than 1 day. | ||
|
||
```php | ||
use Spatie\Health\Facades\Health; | ||
use Spatie\Health\Checks\Checks\BackupsCheck; | ||
|
||
Health::checks([ | ||
BackupsCheck::new() | ||
->locatedAt('/path/to/backups/*.zip') | ||
->youngestBackShouldHaveBeenMadeBefore(now()->subDays(1)), | ||
]); | ||
``` | ||
|
||
You can use the `oldestBackShouldHaveBeenMadeAfter` method to check if the oldest backup was made after a certain date. | ||
|
||
Here's an example where we make sure the oldest backup is older than 1 week. | ||
|
||
```php | ||
use Spatie\Health\Facades\Health; | ||
use Spatie\Health\Checks\Checks\BackupsCheck; | ||
|
||
Health::checks([ | ||
BackupsCheck::new() | ||
->locatedAt('/path/to/backups/*.zip') | ||
->oldestBackShouldHaveBeenMadeAfter(now()->subWeeks(1)), | ||
]); | ||
``` | ||
|
||
### Specify a minimum size | ||
|
||
You can use the `atLeastSizeInMb` method to specify a minimum size for the backups. Only backups that are larger than the specified size will be considered valid. | ||
|
||
```php | ||
use Spatie\Health\Facades\Health; | ||
use Spatie\Health\Checks\Checks\BackupsCheck; | ||
|
||
Health::checks([ | ||
BackupsCheck::new() | ||
->locatedAt('/path/to/backups/*.zip') | ||
->atLeastSizeInMb(20), | ||
]); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: CPU load | ||
weight: 4 | ||
weight: 5 | ||
--- | ||
|
||
This check makes sure that your CPU load isn't too high. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters