Primo Committ
This commit is contained in:
6
vendor/spatie/laravel-backup/docs/_index.md
vendored
Normal file
6
vendor/spatie/laravel-backup/docs/_index.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: v6
|
||||
slogan: One day you'll thank us for this
|
||||
githubUrl: https://github.com/spatie/laravel-backup
|
||||
branch: v6
|
||||
---
|
||||
13
vendor/spatie/laravel-backup/docs/about-us.md
vendored
Normal file
13
vendor/spatie/laravel-backup/docs/about-us.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: About us
|
||||
weight: 8
|
||||
---
|
||||
|
||||
[Spatie](https://spatie.be) is a webdesign agency based in Antwerp, Belgium.
|
||||
|
||||
Open source software is used in all projects we deliver. Laravel, Nginx, Ubuntu are just a few of the free pieces of software we use every single day. For this, we are very grateful.
|
||||
When we feel we have solved a problem in a way that can help other developers, we release our code as open source software [on GitHub](https://spatie.be/opensource).
|
||||
|
||||
This backup package was made by [Freek Van der Herten](https://twitter.com/freekmurze). There are [many other contributors](https://github.com/spatie/laravel-backup/graphs/contributors) who devoted time and effort to make this package better.
|
||||
|
||||
A big thank you to [Gilbert West](https://github.com/blueclock) and [Jean-Philippe Murray](https://github.com/jpmurray) for proofreading. [Sebastian De Deyne](https://github.com/sebastiandedeyne) made sure the memory use of the package is kept in check. [Daniël Klabbers](https://github.com/Luceos) gave me some useful ideas on how to make the package better.
|
||||
4
vendor/spatie/laravel-backup/docs/advanced-usage/_index.md
vendored
Normal file
4
vendor/spatie/laravel-backup/docs/advanced-usage/_index.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Advanced Usage
|
||||
weight: 5
|
||||
---
|
||||
39
vendor/spatie/laravel-backup/docs/advanced-usage/adding-extra-files-to-a-backup.md
vendored
Normal file
39
vendor/spatie/laravel-backup/docs/advanced-usage/adding-extra-files-to-a-backup.md
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
title: Adding extra files to a backup
|
||||
weight: 1
|
||||
---
|
||||
The package ships with a BackupManifestWasCreated event that enables you to add additional files to the backup zip file.
|
||||
|
||||
When backup process starts, the package will create a manifest of all file that are selected for backup. Once the manifest has been created, a zip file is made containing all the files in the manifest. The zip file will be copied to the backup destinations you configured.
|
||||
|
||||
However, if you have cases where you need to add additional files to a particular backup, you can do so, between the creation of the manifest and the creation of the zip file.
|
||||
|
||||
Right after the manifest is created and **before** the zip file is created the `Spatie\Backup\Events\BackupManifestWasCreated` event is fired. This is what is looks like:
|
||||
|
||||
```
|
||||
namespace Spatie\Backup\Events;
|
||||
|
||||
use Spatie\Backup\Tasks\Backup\Manifest;
|
||||
|
||||
class BackupManifestWasCreated
|
||||
{
|
||||
/** @var \Spatie\Backup\Tasks\Backup\Manifest */
|
||||
public $manifest;
|
||||
|
||||
public function __construct(Manifest $manifest)
|
||||
{
|
||||
$this->manifest = $manifest;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
You can use that event to add extra files to the manifest as in the example below where the extra files are passed as an array to the addFiles() method.
|
||||
|
||||
```php
|
||||
use Spatie\Backup\Events\BackupManifestWasCreated;
|
||||
|
||||
Event::listen(BackupManifestWasCreated::class, function (BackupManifestWasCreated $event) {
|
||||
$event->manifest->addFiles([$path1, $path2, ...]);
|
||||
});
|
||||
```
|
||||
12
vendor/spatie/laravel-backup/docs/advanced-usage/backing-up-a-non-laravel-application.md
vendored
Normal file
12
vendor/spatie/laravel-backup/docs/advanced-usage/backing-up-a-non-laravel-application.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Backing up a non-laravel application
|
||||
weight: 2
|
||||
---
|
||||
|
||||
This package is tailor-made for use inside Laravel applications. But with a little bit of good will you can use it to backup non-Laravel applications as well.
|
||||
|
||||
To do so install Laravel on the same server where your non-Laravel application runs. In the Laravel app you'll have to install this package using the [installation instructions](/laravel-backup/v6/installation-and-setup). In the `app/config/backup.php`configuration file specify the paths of the non-laravel application you wish to backup in the `backup.source.files.include` key.
|
||||
|
||||
Do not forget to configure the database as well. In `app/config/databases.php` put the credentials of the database used by the non-Laravel application.
|
||||
|
||||
When running `php artisan backup:run` on the command line, the application will be backed up.
|
||||
31
vendor/spatie/laravel-backup/docs/advanced-usage/binary-database-dumps-with-postgresql.md
vendored
Normal file
31
vendor/spatie/laravel-backup/docs/advanced-usage/binary-database-dumps-with-postgresql.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: Binary database dumps with PostgreSQL
|
||||
weight: 3
|
||||
---
|
||||
|
||||
PostgreSQL has the ability to produce binary database dumps via the `pg_dump` command, which produce smaller files than the SQL format and are faster to restore. See the [full list](https://www.postgresql.org/docs/current/app-pgdump.html) of `pg_dump` flags.
|
||||
|
||||
To take advantage of this, you can set the extra flags for `pg_dump` on the database connection(s) in `app/config/database.php`.
|
||||
|
||||
```php
|
||||
//config/database.php
|
||||
'connections' => [
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql'
|
||||
...,
|
||||
'dump' => [
|
||||
...,
|
||||
'add_extra_option' => '--format=c', // and any other pg_dump flags
|
||||
]
|
||||
],
|
||||
```
|
||||
|
||||
Additionally, you can change the file extension of the database dump file to signify that it is not a text SQL file.
|
||||
|
||||
```php
|
||||
//config/backup.php
|
||||
'backup' => [
|
||||
...,
|
||||
'database_dump_file_extension' => 'backup', // produces a FILENAME.backup database dump
|
||||
],
|
||||
```
|
||||
22
vendor/spatie/laravel-backup/docs/advanced-usage/encrypt-backup-archives.md
vendored
Normal file
22
vendor/spatie/laravel-backup/docs/advanced-usage/encrypt-backup-archives.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Encrypt backup archives
|
||||
weight: 4
|
||||
---
|
||||
|
||||
It's common to encrypt backups before storing them somewhere to prevent unauthorized access.
|
||||
To do so you can configure this package to use client-side symmetric zip file password encryption before storing the archive somewhere.
|
||||
|
||||
By default you only have to define the `BACKUP_ARCHIVE_PASSWORD` environment variable in your `.env` file.
|
||||
|
||||
If you want to customize this you can configure the `backup.backup.password` and `backup.backup.encryption` keys in your `config/backup.php` file.
|
||||
|
||||
The whole encryption is done with an event listener.
|
||||
The `\Spatie\Backup\Listeners\EncryptBackupArchive` listener is attached to the `\Spatie\Backup\Events\BackupZipWasCreated` event.
|
||||
The listener is added to the event when both required config keys are not `null`.
|
||||
You are free to add this listener your own or override it.
|
||||
|
||||
It's important to try this workflow and also to decrypt a backup archive.
|
||||
So you know that it works and you have a working backup restore solution.
|
||||
|
||||
**Warning:** the default MacOS app to (un)archive ZIPs seems unable to open/extract encrypted ZIP files.
|
||||
You should use an app like [The Unarchiver](https://theunarchiver.com/) or [BetterZip](https://macitbetter.com/).
|
||||
6
vendor/spatie/laravel-backup/docs/changelog.md
vendored
Normal file
6
vendor/spatie/laravel-backup/docs/changelog.md
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Changelog
|
||||
weight: 7
|
||||
---
|
||||
|
||||
All notable changes to `laravel-backup` are documented in [the changelog on GitHub](https://github.com/spatie/laravel-backup/blob/master/CHANGELOG.md).
|
||||
4
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/_index.md
vendored
Normal file
4
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/_index.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Cleaning up old backups
|
||||
weight: 2
|
||||
---
|
||||
26
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/events.md
vendored
Normal file
26
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/events.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: Events
|
||||
weight: 2
|
||||
---
|
||||
|
||||
These events are fired during the cleanup process.
|
||||
|
||||
## CleanupWasSuccessful
|
||||
|
||||
`Spatie\Backup\Events\CleanupWasSuccessful`
|
||||
|
||||
This event is fired when old backups are successfully removed from a destination filesystem.
|
||||
|
||||
It has one public property `$backupDestination` that contains an instance of `Spatie\Backup\BackupDestination\BackupDestination`.
|
||||
|
||||
## CleanupHasFailed
|
||||
|
||||
`Spatie\Backup\Events\CleanupHasFailed`
|
||||
|
||||
This event is fired when something goes wrong while cleaning up.
|
||||
|
||||
It has two public properties:
|
||||
|
||||
- `$exception`: an object that conforms to the `Exception` interface. It is highly likely that `$exception->getMessage()` will return more information on what went wrong.
|
||||
- `$backupDestination`: if this is `null` then something probably went wrong before even connecting to one of the backup destinations. If it is an instance of `Spatie\Backup\BackupDestination\BackupDestination` something went wrong when trying to connect or
|
||||
write to that destination.
|
||||
111
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/overview.md
vendored
Normal file
111
vendor/spatie/laravel-backup/docs/cleaning-up-old-backups/overview.md
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
title: Cleaning up old backups
|
||||
weight: 1
|
||||
---
|
||||
|
||||
Over time the number of backups and the storage required to store them will grow. At some point you will want to clean up old backups.
|
||||
|
||||
You can clean up your backups by running:
|
||||
|
||||
```bash
|
||||
php artisan backup:clean
|
||||
```
|
||||
|
||||
We'll tell you right off the bat that the package by default will never delete the latest backup regardless of its size or age.
|
||||
|
||||
## Determining which backups should be deleted
|
||||
|
||||
This portion of the configuration determines which backups should be deleted.
|
||||
|
||||
```php
|
||||
//config/backup.php
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* deleted the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'default_strategy' => [
|
||||
|
||||
/*
|
||||
* The number of days that all backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
|
||||
/*
|
||||
* The number of days that all daily backups must be kept.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 16,
|
||||
|
||||
/*
|
||||
* The number of weeks of which one weekly backup must be kept.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 8,
|
||||
|
||||
/*
|
||||
* The number of months of which one monthly backup must be kept.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
|
||||
/*
|
||||
* The number of years of which one yearly backup must be kept.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
*/
|
||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||
],
|
||||
],
|
||||
```
|
||||
|
||||
This package provides an opinionated method to determine which old backups should be deleted. We call this the `DefaultStrategy`. This is how it works:
|
||||
|
||||
- Rule #1: it will never delete the latest backup regardless of its size or age
|
||||
- Rule #2: it will keep all backups for the number of days specified in `keepAllBackupsForDays`
|
||||
- Rule #3: it will only keep daily backups for the number of days specified in `keepDailyBackupsForDays` for all backups
|
||||
older than those covered by rule #2
|
||||
- Rule #4: it will only keep weekly backups for the number of months specified in `keepMonthlyBackupsForMonths` for all backups older than those covered by rule #3
|
||||
- Rule #5: it'll only keep yearly backups for the number of years specified in `keepYearlyBackupsForYears` for all backups older than those covered by rule #4
|
||||
- Rule #6: it will start deleting old backups until the volume of storage used is lower than the amount specified in `deleteOldestBackupsWhenUsingMoreMegabytesThan`.
|
||||
|
||||
Of course the numbers used in the default configuration can be adjusted to suit your own needs.
|
||||
|
||||
## Creating your own strategy
|
||||
|
||||
If you're requirements are not covered by the `DefaultStrategy`, you can create your own custom strategy.
|
||||
|
||||
Extend the abstract class `Spatie\Backup\Tasks\Cleanup\CleanupStrategy`. You only need to implement this method:
|
||||
|
||||
```php
|
||||
use Spatie\Backup\BackupDestination\BackupCollection;
|
||||
|
||||
public function deleteOldBackups(BackupCollection $backupCollection)
|
||||
```
|
||||
|
||||
The `BackupCollection` class is extended from `Illuminate\Support\Collection` and contains `Spatie\Backup\BackupDestination\Backup` objects sorted by age. The latest backup is the first one in the collection.
|
||||
|
||||
Using the collection, you can easily manually delete the oldest backup:
|
||||
|
||||
```php
|
||||
// Retrieve an instance of `Spatie\Backup\BackupDestination\Backup`
|
||||
$backup = $backups->oldestBackup();
|
||||
|
||||
// Bye bye backup
|
||||
$backup->delete();
|
||||
```
|
||||
|
||||
Don't forget to specify the full classname of your custom strategy in the `cleanup.strategy` key of the `laravel-backup` config file.
|
||||
|
||||
## Get notifications when a cleanup goes wrong
|
||||
|
||||
You can receive a notification when a cleanup goes wrong. Read the section on [notifications](/laravel-backup/v5/sending-notifications/overview) for more info.
|
||||
18
vendor/spatie/laravel-backup/docs/high-level-overview.md
vendored
Normal file
18
vendor/spatie/laravel-backup/docs/high-level-overview.md
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: High level overview
|
||||
weight: 4
|
||||
---
|
||||
|
||||
## Taking backups
|
||||
|
||||
A backup is a .zip file containing all files in the directories you specify and a dump of your database (MySQL and PostgreSQL are supported). The .zip file can automatically be copied over to [any of the filesystems](https://laravel.com/docs/8.x/filesystem) you have configured.
|
||||
|
||||
To perform a new backup you just have to run `php artisan backup:run`. In most cases you'll want to schedule this command.
|
||||
|
||||
## Cleaning up old backups
|
||||
|
||||
As you create more and more backups, you'll eventually run out of disk space (or you'll have to pay a very large bill for storage). To prevent this from happening the package can delete old backups.
|
||||
|
||||
## Monitoring the health of all backups
|
||||
|
||||
The package can also check the health of your application's backups. A backup is considered unhealthy if the date of the last backup is too far in the past for it to be useful or if the backup becomes too large. In addition to monitoring the health of the application's own backups, backups of other applications can be monitored as well.
|
||||
386
vendor/spatie/laravel-backup/docs/installation-and-setup.md
vendored
Normal file
386
vendor/spatie/laravel-backup/docs/installation-and-setup.md
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
---
|
||||
title: Installation and setup
|
||||
weight: 5
|
||||
---
|
||||
|
||||
## Basic installation
|
||||
|
||||
You can install this package via composer using:
|
||||
|
||||
``` bash
|
||||
composer require spatie/laravel-backup
|
||||
```
|
||||
|
||||
The package will automatically register its service provider.
|
||||
|
||||
To publish the config file to `config/backup.php` run:
|
||||
|
||||
``` bash
|
||||
php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
|
||||
```
|
||||
|
||||
This is the default contents of the configuration:
|
||||
|
||||
```php
|
||||
return [
|
||||
|
||||
'backup' => [
|
||||
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
|
||||
'source' => [
|
||||
|
||||
'files' => [
|
||||
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
base_path(),
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*
|
||||
* Directories used by the backup process will automatically be excluded.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'follow_links' => false,
|
||||
|
||||
/*
|
||||
* Determines if it should avoid unreadable folders.
|
||||
*/
|
||||
'ignore_unreadable_directories' => false,
|
||||
|
||||
/*
|
||||
* This path is used to make directories in resulting zip-file relative
|
||||
* Set to `null` to include complete absolute path
|
||||
* Example: base_path()
|
||||
*/
|
||||
'relative_path' => null,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*
|
||||
* The content of the database dump may be customized for each connection
|
||||
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'excludeTables' => [
|
||||
* 'table_to_exclude_from_backup',
|
||||
* 'another_table_to_exclude'
|
||||
* ]
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* If you are using only InnoDB tables on a MySQL server, you can
|
||||
* also supply the useSingleTransaction option to avoid table locking.
|
||||
*
|
||||
* E.g.
|
||||
* 'mysql' => [
|
||||
* ...
|
||||
* 'dump' => [
|
||||
* 'useSingleTransaction' => true,
|
||||
* ],
|
||||
* ],
|
||||
*
|
||||
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||
*/
|
||||
'databases' => [
|
||||
'mysql',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The database dump can be compressed to decrease diskspace usage.
|
||||
*
|
||||
* Out of the box Laravel-backup supplies
|
||||
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||
*
|
||||
* You can also create custom compressor. More info on that here:
|
||||
* https://github.com/spatie/db-dumper#using-compression
|
||||
*
|
||||
* If you do not want any compressor at all, set it to null.
|
||||
*/
|
||||
'database_dump_compressor' => null,
|
||||
|
||||
/*
|
||||
* The file extension used for the database dump files.
|
||||
*
|
||||
* If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
|
||||
* The file extension should be specified without a leading .
|
||||
*/
|
||||
'database_dump_file_extension' => '',
|
||||
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The filename prefix used for the backup zip file.
|
||||
*/
|
||||
'filename_prefix' => '',
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* The directory where the temporary files will be stored.
|
||||
*/
|
||||
'temporary_directory' => storage_path('app/backup-temp'),
|
||||
|
||||
/*
|
||||
* The password to be used for archive encryption.
|
||||
* Set to `null` to disable encryption.
|
||||
*/
|
||||
'password' => env('BACKUP_ARCHIVE_PASSWORD'),
|
||||
|
||||
/*
|
||||
* The encryption algorithm to be used for archive encryption.
|
||||
* You can set it to `null` or `false` to disable encryption.
|
||||
*/
|
||||
'encryption' => \ZipArchive::EM_AES_256,
|
||||
],
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install laravel/slack-notification-channel.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Events` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => 'your@example.com',
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound event will be fired.
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
'disks' => ['local'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['local', 's3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
|
||||
'cleanup' => [
|
||||
/*
|
||||
* The strategy that will be used to cleanup old backups. The default strategy
|
||||
* will keep all backups for a certain amount of days. After that period only
|
||||
* a daily backup will be kept. After that period only weekly backups will
|
||||
* be kept and so on.
|
||||
*
|
||||
* No matter how you configure it the default strategy will never
|
||||
* delete the newest backup.
|
||||
*/
|
||||
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||
|
||||
'default_strategy' => [
|
||||
|
||||
/*
|
||||
* The number of days for which backups must be kept.
|
||||
*/
|
||||
'keep_all_backups_for_days' => 7,
|
||||
|
||||
/*
|
||||
* The number of days for which daily backups must be kept.
|
||||
*/
|
||||
'keep_daily_backups_for_days' => 16,
|
||||
|
||||
/*
|
||||
* The number of weeks for which one weekly backup must be kept.
|
||||
*/
|
||||
'keep_weekly_backups_for_weeks' => 8,
|
||||
|
||||
/*
|
||||
* The number of months for which one monthly backup must be kept.
|
||||
*/
|
||||
'keep_monthly_backups_for_months' => 4,
|
||||
|
||||
/*
|
||||
* The number of years for which one yearly backup must be kept.
|
||||
*/
|
||||
'keep_yearly_backups_for_years' => 2,
|
||||
|
||||
/*
|
||||
* After cleaning up the backups remove the oldest backup until
|
||||
* this amount of megabytes has been reached.
|
||||
*/
|
||||
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
## Configuring the backup disk
|
||||
|
||||
By default, the backup will be saved into the `public/laravel-backup/` directory of your laravel application. This folder most probably is configured to be public.
|
||||
We recommand to create a disk named `backups` (you can use any name you prefer) in `filesystems.php` and specify that name in the `disk` key of the `backup.php` config file.
|
||||
|
||||
## Scheduling
|
||||
|
||||
After you have performed the basic installation you can start using the `backup:run`, `backup:clean`, `backup:list` and `backup:monitor`-commands. In most cases you'll want to schedule these commands so you don't have to manually run `backup:run` everytime you need a new backup.
|
||||
|
||||
The commands can be scheduled in Laravel's console kernel, just like any other command.
|
||||
|
||||
```php
|
||||
// app/Console/Kernel.php
|
||||
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('backup:clean')->daily()->at('01:00');
|
||||
$schedule->command('backup:run')->daily()->at('02:00');
|
||||
}
|
||||
```
|
||||
|
||||
Of course, the times used in the code above are just examples. Adjust them to suit your own preferences.
|
||||
|
||||
If a backup cannot be taken successfully, the `backup:run` command returns an exit code of 1 which signals a general error, so you can use laravel's task hooks to specify code to be executed if the scheduled backup succeeds or fails:
|
||||
|
||||
```
|
||||
$schedule
|
||||
->command('backup:run')->daily()->at('01:00')
|
||||
->onFailure(function () {
|
||||
...
|
||||
})
|
||||
->onSuccess(function () {
|
||||
...
|
||||
});
|
||||
```
|
||||
|
||||
## Monitoring
|
||||
|
||||
If your application is broken, the scheduled jobs cannot run anymore. You might also simply forget to add a cron job needed to trigger Laravel's scheduling. In either case, you may think backups are being made when in fact nothing is being backed up.
|
||||
|
||||
To find out about problems with your backups, the package ships with monitoring functionality. It will inform you when backups become too old or when they take up too much storage.
|
||||
|
||||
Learn how to [set up monitoring](/laravel-backup/v6/monitoring-the-health-of-all-backups/overview).
|
||||
|
||||
## Dumping the database
|
||||
`mysqldump` is used to backup MySQL databases. `pg_dump` is used to dump PostgreSQL databases. If these binaries are not installed in a default location, you can add a key named `dump.dump_binary_path` in Laravel's own `database.php` config file. **Only fill in the path to the binary**. Do not include the name of the binary itself.
|
||||
|
||||
If your database dump takes a long time, you might exceed the default timeout of 60 seconds. You can set a higher (or lower) limit by providing a `dump.timeout` config key which specifies, in seconds, how long the command may run.
|
||||
|
||||
Here's an example for MySQL:
|
||||
|
||||
```php
|
||||
//config/database.php
|
||||
'connections' => [
|
||||
'mysql' => [
|
||||
'driver' => 'mysql'
|
||||
...,
|
||||
'dump' => [
|
||||
'dump_binary_path' => '/path/to/the/binary', // only the path, so without `mysqldump` or `pg_dump`
|
||||
'use_single_transaction',
|
||||
'timeout' => 60 * 5, // 5 minute timeout
|
||||
'exclude_tables' => ['table1', 'table2'],
|
||||
'add_extra_option' => '--optionname=optionvalue', // for example '--column_statistics=0'
|
||||
]
|
||||
],
|
||||
```
|
||||
|
||||
### File extensions of database dumps
|
||||
|
||||
By default, database dump files are named `.sql`, except for the MongoDB driver which are named `.archive`. If you would like to override this, you can set the file extension to be used in the config.
|
||||
|
||||
For example, to save a database dump as a `.txt` file:
|
||||
```php
|
||||
//config/backup.php
|
||||
'backup' => [
|
||||
...,
|
||||
'database_dump_file_extension' => 'txt',
|
||||
],
|
||||
```
|
||||
|
||||
> This relates to the names of the database dump files **within** the overall backup `zip` file that is generated.
|
||||
|
||||
### Custom database dumpers
|
||||
|
||||
If you need to have a custom database dumper for a driver, you can use `DbDumpFactory::extend()`. It expects the first argument to be the driver name and the second to be a callback that returns an instance of `Spatie\DbDumper\DbDumper`.
|
||||
|
||||
```php
|
||||
DbDumperFactory::extend('mysql', function() {
|
||||
return new YourCustomMysqlDumper();
|
||||
});
|
||||
```
|
||||
|
||||
```php
|
||||
use Spatie\DbDumper\DbDumper;
|
||||
|
||||
class YourCustomMysqlDumper extends DbDumper
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
28
vendor/spatie/laravel-backup/docs/introduction.md
vendored
Normal file
28
vendor/spatie/laravel-backup/docs/introduction.md
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Introduction
|
||||
weight: 1
|
||||
---
|
||||
|
||||
This Laravel package creates a backup of your application. The backup is a zipfile that contains all files in the directories you specify along with a dump of your database. The backup can be stored on [any of the filesystems](https://laravel.com/docs/8.x/filesystem) you have configured. The package can also notify you via Mail, Slack or any notification provider when something goes wrong with your backups.
|
||||
|
||||
Feeling paranoid about backups? Don't be! You can backup your application to multiple filesystems at once.
|
||||
|
||||
Once installed, making a backup of your files and databases is very easy. Just run this artisan command:
|
||||
|
||||
``` bash
|
||||
php artisan backup:run
|
||||
```
|
||||
|
||||
In addition to making the backup, the package can also clean up old backups, monitor the health of the backups, and show an overview of all backups.
|
||||
|
||||
If you need to backup multiple servers, take a look at [our laravel-backup-server package](https://spatie.be/docs/laravel-backup-server/v1/introduction).
|
||||
|
||||
## We have badges!
|
||||
|
||||
<section class="article_badges">
|
||||
<a href="https://github.com/spatie/laravel-backup/releases"><img src="https://img.shields.io/github/release/spatie/laravel-backup.svg?style=flat-square" alt="Latest Version"></a>
|
||||
<a href="https://github.com/spatie/laravel-backup/blob/master/LICENSE.md"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="Software License"></a>
|
||||
<a href="https://travis-ci.org/spatie/laravel-backup"><img src="https://img.shields.io/travis/spatie/laravel-backup/master.svg?style=flat-square" alt="Build Status"></a>
|
||||
<a href="https://scrutinizer-ci.com/g/spatie/laravel-backup"><img src="https://img.shields.io/scrutinizer/g/spatie/laravel-backup.svg?style=flat-square" alt="Quality Score"></a>
|
||||
<a href="https://packagist.org/packages/spatie/laravel-backup"><img src="https://img.shields.io/packagist/dt/spatie/laravel-backup.svg?style=flat-square" alt="Total Downloads"></a>
|
||||
</section>
|
||||
4
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/_index.md
vendored
Normal file
4
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/_index.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Monitoring the health of all backups
|
||||
weight: 3
|
||||
---
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Creating your custom health check
|
||||
weight: 2
|
||||
---
|
||||
|
||||
You can create your own custom health check by letting a class extend `Spatie\Backup\Tasks\Monitor\HealthCheck`.
|
||||
|
||||
That base class contains one abstract method that you should implement.
|
||||
|
||||
```php
|
||||
public function checkHealth(BackupDestination $backupDestination);
|
||||
```
|
||||
|
||||
If your check determines that the backup is not healthy it should throw a `Spatie\Backup\Exceptions\InvalidHealthCheck` exception. The `HealthCheck` base class contains three helpful methods that helps you do this.
|
||||
|
||||
- `fail($message)`: will throw the right exception under the hood.
|
||||
- `failIf(bool $condition, string $message)`: will throw the right exception if `$condition` is `true`
|
||||
- `failUnless(bool $condition, string $message)`: will throw the right exception if `$condition` is `false`
|
||||
|
||||
You should register your custom health check in the `health_checks` key of the `backup.php` config file.
|
||||
|
||||
To see an example of a `HealthCheck`, go read the could of the `MaximumAgeInDays` and `MaximumStorageInMegabytes` health checks that are provided by the package.
|
||||
23
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/events.md
vendored
Normal file
23
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/events.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
title: Events
|
||||
weight: 3
|
||||
---
|
||||
|
||||
These events are fired by the monitor.
|
||||
|
||||
## HealthyBackupWasFound
|
||||
|
||||
`Spatie\Backup\Events\HealthyBackupWasFound`
|
||||
|
||||
This event is fired when the monitor deems the backups on a destination filesystem to be healthy.
|
||||
|
||||
It has one public property `$backupDestinationStatus` that contains an instance of `Spatie\Backup\BackupDestination\BackupDestinationsStatus`.
|
||||
|
||||
## UnhealthyBackupWasFound
|
||||
|
||||
`Spatie\Backup\Events\UnhealthyBackupWasFound`
|
||||
|
||||
This event is fired when the monitor deems the backups on a destination filesystem to be unhealthy. It will
|
||||
also be fired if the monitor cannot read from a destination filesystem.
|
||||
|
||||
It has one public property `$backupDestinationStatus` that contains an instance of `Spatie\Backup\BackupDestination\BackupDestinationsStatus`.
|
||||
81
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/overview.md
vendored
Normal file
81
vendor/spatie/laravel-backup/docs/monitoring-the-health-of-all-backups/overview.md
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
title: Monitoring the health of all backups
|
||||
weight: 1
|
||||
---
|
||||
|
||||
The package can check the health of backups for every application where it is installed. A backup is considered unhealthy if the date of the latest backup is too far in the past to be useful or if the amount of storage space required for all backups is not available.
|
||||
|
||||
## Installation
|
||||
|
||||
We recommend setting up a separate Laravel installation to do the monitoring, preferably on a separate server. This ensures you will be notified of unhealthy backups even if one of the applications you are monitoring is broken.
|
||||
|
||||
We also recommend to use a central storage disk, like s3, for your backups when using the monitoring. You can still use monitoring for local disks but you'll have to add the monitoring to the app which runs the backups.
|
||||
|
||||
To install the monitor follow the regular [installation instructions](/laravel-backup/v5/installation-and-setup).
|
||||
Instead of scheduling the `backup:run` and `backup:clean` commands, you should schedule the monitor command.
|
||||
|
||||
```php
|
||||
//app/Console/Kernel.php
|
||||
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('backup:monitor')->daily()->at('03:00');
|
||||
}
|
||||
```
|
||||
|
||||
If you want, you can still schedule `backup:run` and `backup:clean` to backup the monitoring application itself.
|
||||
|
||||
## Specifying which backups should be monitored
|
||||
|
||||
This is the part of the configuration where you can specify which applications should be monitored and when the monitor should consider the backups of a particular application unhealthy.
|
||||
|
||||
```php
|
||||
//config/backup.php
|
||||
|
||||
/*
|
||||
* In this array you can specify which backups should be monitored.
|
||||
* If a backup does not meet the specified requirements the
|
||||
* UnHealthyBackupWasFound-event will be fired.
|
||||
*/
|
||||
'monitor_backups' => [
|
||||
[
|
||||
'name' => env('APP_NAME'),
|
||||
'disks' => ['s3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
[
|
||||
'name' => 'name of the second app',
|
||||
'disks' => ['s3'],
|
||||
'health_checks' => [
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||
],
|
||||
],
|
||||
*/
|
||||
],
|
||||
```
|
||||
|
||||
The `MaximumAgeInDays` check will fail if the latest backup is older that the specified amount of days. If you don't need this check, just remove it.
|
||||
|
||||
The `MaximumStorageInMegabytes` check will fail if the total size of your backups is greater that the specified amount of megabytes. If you don't need this check just remove it.
|
||||
|
||||
The `name` of a monitor should match the value you have specified in the `backup.name`-key of the config file in
|
||||
the application that is being backed up.
|
||||
|
||||
## Get notifications of (un)healthy backups
|
||||
|
||||
You can receive notifications when the monitor finds an (un)healthy backup.
|
||||
Read the section on [notifications](/laravel-backup/v6/sending-notifications/overview) to learn more.
|
||||
|
||||
## Checking all backups
|
||||
|
||||
To see the status of all monitored destination filesystems, use this command
|
||||
|
||||
```bash
|
||||
php artisan backup:list
|
||||
```
|
||||
8
vendor/spatie/laravel-backup/docs/questions-and-issues.md
vendored
Normal file
8
vendor/spatie/laravel-backup/docs/questions-and-issues.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Questions & issues
|
||||
weight: 6
|
||||
---
|
||||
|
||||
Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the backup package? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-backup/issues), we'll try to address it as soon as possible.
|
||||
|
||||
If you've found a bug regarding security please mail [freek@spatie.be](mailto:freek@spatie.be) instead of using the issue tracker.
|
||||
22
vendor/spatie/laravel-backup/docs/requirements.md
vendored
Normal file
22
vendor/spatie/laravel-backup/docs/requirements.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: Requirements
|
||||
weight: 3
|
||||
---
|
||||
|
||||
This backup package requires **PHP 7.3**, with the [ZIP module](http://php.net/manual/en/book.zip.php) and **Laravel 6.0 or higher**. It's not compatible with Windows servers.
|
||||
|
||||
If you are using an older version of Laravel, take a look at one of the previous versions of this package.
|
||||
|
||||
The package needs free disk space where it can create backups. Ensure that you have **at least** as much free space as the total size of the files you want to backup.
|
||||
|
||||
Make sure `mysqldump` is installed on your system if you want to backup MySQL databases.
|
||||
|
||||
Make sure `pg_dump` is installed on your system if you want to backup PostgreSQL databases.
|
||||
|
||||
Make sure `mongodump` is installed on your system if you want to backup Mongo databases.
|
||||
|
||||
To send notifications to Slack you'll need to install `laravel/slack-notification-channel`:
|
||||
|
||||
```bash
|
||||
composer require laravel/slack-notification-channel
|
||||
```
|
||||
4
vendor/spatie/laravel-backup/docs/sending-notifications/_index.md
vendored
Normal file
4
vendor/spatie/laravel-backup/docs/sending-notifications/_index.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Sending notifications
|
||||
weight: 4
|
||||
---
|
||||
62
vendor/spatie/laravel-backup/docs/sending-notifications/adding-extra-notification-channels.md
vendored
Normal file
62
vendor/spatie/laravel-backup/docs/sending-notifications/adding-extra-notification-channels.md
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: Adding extra notification channels
|
||||
weight: 2
|
||||
---
|
||||
|
||||
By default the package send notifications via email or Slack. It's easy to add an extra notification channel such as Telegram or native mobile push notification, etc.
|
||||
|
||||
The Laravel community is awesome. Shortly after Laravel 5.3 was released various developers worked together to create 30+ notification channels. You can view them all on [http://laravel-notification-channels.com](http://laravel-notification-channels.com).
|
||||
|
||||
In the following example we're going to add the Pusher push notifications channel. Other notification drivers can be added in the same way.
|
||||
|
||||
### 1. Install the notification channel driver
|
||||
|
||||
For Pusher Push notifications, require this package
|
||||
|
||||
```php
|
||||
laravel-notification-channels/pusher-push-notifications
|
||||
```
|
||||
|
||||
After composer has pulled in the package, just follow [the installation instructions of the package](https://github.com/laravel-notification-channels#installation) to complete the installation.
|
||||
|
||||
|
||||
### 2. Creating your own custom notification
|
||||
|
||||
Let say you want to be notified via Pusher push notifications when a backup fails. To make this happen you'll need to create your own `BackupFailed` notification class like the one below:
|
||||
|
||||
```php
|
||||
namespace App\Notifications;
|
||||
|
||||
use Spatie\Backup\Notifications\Notifications\BackupHasFailed as BaseNotification;
|
||||
use NotificationChannels\PusherPushNotifications\Message;
|
||||
|
||||
class BackupHasFailed extends BaseNotification
|
||||
{
|
||||
public function toPushNotification($notifiable)
|
||||
{
|
||||
return Message::create()
|
||||
->iOS()
|
||||
->badge(1)
|
||||
->sound('fail')
|
||||
->body("The backup of {$this->applicationName()} to disk {$this->diskName()} has failed");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Register your custom notification in the config file
|
||||
|
||||
The last thing you need to do is register your custom notification in the config file.
|
||||
|
||||
```php
|
||||
// config/backup.php
|
||||
use \NotificationChannels\PusherPushNotifications\Channel as PusherChannel
|
||||
|
||||
...
|
||||
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\App\Notifications\BackupHasFailed::class => ['mail', 'slack', PusherChannel::class],
|
||||
...
|
||||
```
|
||||
|
||||
40
vendor/spatie/laravel-backup/docs/sending-notifications/customizing-the-notifiable.md
vendored
Normal file
40
vendor/spatie/laravel-backup/docs/sending-notifications/customizing-the-notifiable.md
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
title: Customizing the notifiable
|
||||
weight: 3
|
||||
---
|
||||
|
||||
Laravel's notifications are sent to a notifiable. A notifiable provides configuration values that determine how notifications will be sent.
|
||||
|
||||
By default the package uses this notifiable class: `\Spatie\Backup\Notifications\Notifiable`. This class will read out the config file. All mail notifications will be sent to the mail address specified in the `notifications.mail.to` key of the config file.
|
||||
|
||||
If you use a channel that needs some get some extra information out of the notifiable you can easily extend the default notifiable.
|
||||
|
||||
Here's how that might look like:
|
||||
|
||||
```php
|
||||
namespace App\Notifications;
|
||||
|
||||
use Spatie\Backup\Notifications\Notifiable;
|
||||
|
||||
class BackupNotifiable extends Notifiable
|
||||
{
|
||||
public function routeNotificationForAnotherNotificationChannel()
|
||||
{
|
||||
return config('backup.notifications.another_notification_channel.property');
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Don't forget to register the notifiable in the config file:
|
||||
|
||||
```php
|
||||
// config/backup.php
|
||||
'notifications' => [
|
||||
...
|
||||
|
||||
'notifiable' => App\Notifications\BackupNotifiable::class,
|
||||
```
|
||||
|
||||
|
||||
|
||||
64
vendor/spatie/laravel-backup/docs/sending-notifications/overview.md
vendored
Normal file
64
vendor/spatie/laravel-backup/docs/sending-notifications/overview.md
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
title: Sending notifications
|
||||
weight: 1
|
||||
---
|
||||
|
||||
The package leverages Laravel's native notifications to let you know that your backups are ok, or not. Out of the box it can send notifications via mail and Slack (for Slack you'll need to require `laravel/slack-notification-channel` in your project).
|
||||
|
||||
## Configuration
|
||||
|
||||
This is the portion of the configuration that will determine when and how notifications will be sent.
|
||||
|
||||
```php
|
||||
//config/backup.php
|
||||
|
||||
/*
|
||||
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||
* For Slack you need to install laravel/slack-notification-channel.
|
||||
*
|
||||
* You can also use your own notification classes, just make sure the class is named after one of
|
||||
* the `Spatie\Backup\Events` classes.
|
||||
*/
|
||||
'notifications' => [
|
||||
|
||||
'notifications' => [
|
||||
\Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupHasFailed::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessful::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFound::class => ['mail'],
|
||||
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessful::class => ['mail'],
|
||||
],
|
||||
|
||||
/*
|
||||
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||
* notifiable will use the variables specified in this config file.
|
||||
*/
|
||||
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||
|
||||
'mail' => [
|
||||
'to' => 'your@example.com',
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'webhook_url' => '',
|
||||
|
||||
/*
|
||||
* If this is set to null the default channel of the webhook will be used.
|
||||
*/
|
||||
'channel' => null,
|
||||
|
||||
'username' => null,
|
||||
|
||||
'icon' => null,
|
||||
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
```
|
||||
8
vendor/spatie/laravel-backup/docs/support-us.md
vendored
Normal file
8
vendor/spatie/laravel-backup/docs/support-us.md
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
title: Support us
|
||||
weight: 2
|
||||
---
|
||||
|
||||
We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).
|
||||
|
||||
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).
|
||||
4
vendor/spatie/laravel-backup/docs/taking-backups/_index.md
vendored
Normal file
4
vendor/spatie/laravel-backup/docs/taking-backups/_index.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
title: Taking Backups
|
||||
weight: 1
|
||||
---
|
||||
43
vendor/spatie/laravel-backup/docs/taking-backups/events.md
vendored
Normal file
43
vendor/spatie/laravel-backup/docs/taking-backups/events.md
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Events
|
||||
weight: 2
|
||||
---
|
||||
|
||||
These events are fired during the backup process.
|
||||
|
||||
## BackupWasSuccessful
|
||||
|
||||
`Spatie\Backup\Events\BackupWasSuccessful`
|
||||
|
||||
This event is fired when the zip file containing all files that should be backed up has successfully been copied to a destination filesystem.
|
||||
|
||||
It has one public property `$backupDestination` that contains an instance
|
||||
of `Spatie\Backup\BackupDestination\BackupDestination`.
|
||||
|
||||
## BackupHasFailed
|
||||
|
||||
`Spatie\Backup\Events\BackupHasFailed`
|
||||
|
||||
This event will be fired when something goes wrong while backing up.
|
||||
|
||||
It has two public properties:
|
||||
|
||||
- `$exception`: an object that extends PHP's `Exception` class. It is highly likely that `$exception->getMessage()` will return more information on what went wrong.
|
||||
|
||||
- `$backupDestination`: if this is `null` then something probably went wrong zipping the files. If it's an instance of `Spatie\Backup\BackupDestination\BackupDestination` then something went wrong copying the zip over to the backup destination.
|
||||
|
||||
## BackupManifestWasCreated
|
||||
|
||||
`Spatie\Backup\Events\BackupManifestWasCreated`
|
||||
|
||||
Internally the package will build up a manifest of files. This manifest contains the dumps of the databases and any files that are selected for backup. All the files in the manifest will be zipped.
|
||||
|
||||
It has one public property `$manifest` which is an instance of `Spatie\Backup\Tasks\Backup\Manifest`
|
||||
|
||||
## BackupZipWasCreated
|
||||
|
||||
`Spatie\Backup\Events\BackupZipWasCreated`
|
||||
|
||||
This event will be fired right after the zipfile - containing the dumps of the databases and any files that were selected for backup - is created, and before that zip will get copied over to the backup destination(s). You can use this event to do last minute manipulations on the created zip file.
|
||||
|
||||
It has one public method `$pathToZip` which contains a path to the created zipfile.
|
||||
154
vendor/spatie/laravel-backup/docs/taking-backups/overview.md
vendored
Normal file
154
vendor/spatie/laravel-backup/docs/taking-backups/overview.md
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
---
|
||||
title: Taking backups
|
||||
weight: 1
|
||||
---
|
||||
|
||||
You can backup your app by running:
|
||||
|
||||
```bash
|
||||
php artisan backup:run
|
||||
```
|
||||
|
||||
If you want to backup to a specific disk instead of all disks, run:
|
||||
|
||||
```bash
|
||||
php artisan backup:run --only-to-disk=name-of-your-disk
|
||||
```
|
||||
|
||||
If you only need to backup the db, run:
|
||||
|
||||
```bash
|
||||
php artisan backup:run --only-db
|
||||
```
|
||||
|
||||
If you only need to backup the files, and want to skip dumping the databases, run:
|
||||
|
||||
```bash
|
||||
php artisan backup:run --only-files
|
||||
```
|
||||
|
||||
<div class="alert -warning">
|
||||
Be very careful with `--only-db` and `--only-files`. When monitoring backups, the package **does not** make
|
||||
a distinction between full backups and a backup which only contains files or databases. It may be the case that you will not be able to recover from a partial backup.
|
||||
</div>
|
||||
|
||||
|
||||
## Configuration
|
||||
|
||||
### Determining the content of the backup
|
||||
|
||||
This section of the configuration determines which files and databases will be backed up. Most options should be self explanatory.
|
||||
|
||||
```php
|
||||
'backup' => [
|
||||
|
||||
/*
|
||||
* The name of this application. You can use this name to monitor
|
||||
* the backups.
|
||||
*/
|
||||
'name' => env('APP_NAME', 'laravel-backup'),
|
||||
|
||||
'source' => [
|
||||
|
||||
'files' => [
|
||||
|
||||
/*
|
||||
* The list of directories and files that will be included in the backup.
|
||||
*/
|
||||
'include' => [
|
||||
base_path(),
|
||||
],
|
||||
|
||||
/*
|
||||
* These directories and files will be excluded from the backup.
|
||||
*/
|
||||
'exclude' => [
|
||||
base_path('vendor'),
|
||||
base_path('node_modules'),
|
||||
],
|
||||
|
||||
/*
|
||||
* Determines if symlinks should be followed.
|
||||
*/
|
||||
'follow_links' => false,
|
||||
|
||||
/*
|
||||
* This path is used to make directories in resulting zip-file relative
|
||||
* Set to false to include complete absolute path
|
||||
* Example: base_path()
|
||||
*/
|
||||
'relative_path' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
* The names of the connections to the databases that should be backed up
|
||||
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||
*/
|
||||
'databases' => [
|
||||
'mysql',
|
||||
],
|
||||
],
|
||||
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local',
|
||||
],
|
||||
],
|
||||
]
|
||||
```
|
||||
|
||||
The specified databases will be dumped and, together with the selected files, zipped. The zip file will be named`<specified name in configuration>/<Y-m-d-H-i-s>.zip`.
|
||||
|
||||
The more files you need to backup, the bigger the zip will become. Make sure there's enough free space on your disk to create the zip file. After the source zip file has been copied to all destinations, it will be deleted.
|
||||
|
||||
### Determining the destination of the backup
|
||||
|
||||
The zipped backup can be copied to one or more filesystems. This section of the configuration is where you specify those destination filesystems.
|
||||
|
||||
```php
|
||||
'destination' => [
|
||||
|
||||
/*
|
||||
* The disk names on which the backups will be stored.
|
||||
*/
|
||||
'disks' => [
|
||||
'local'
|
||||
],
|
||||
],
|
||||
```
|
||||
|
||||
The default value of `config('backup.destination.disks')` is an array with only one key: `local`. Beware! If you only use the local disk to take backups and that disk crashes you will have nothing left but tears. Having a backup is not the same as having a backup strategy!
|
||||
|
||||
We highly recommend that you configure some extra disks in `app/config/filesystems.php` and add them as destination filesystems for the backup. Those disks should use external servers or services (such as S3 or Dropbox).
|
||||
|
||||
If you need to pass extra options to the underlying Flysystem driver of the disk, you can do so by adding a `backup_options` array to the configuration of that disk. In most cases this is not needed.
|
||||
|
||||
```php
|
||||
// in config filesystems.php
|
||||
|
||||
return [
|
||||
|
||||
// ..
|
||||
|
||||
'disks' => [
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
// ...
|
||||
'backup_options' => [
|
||||
// add extra options here
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
```
|
||||
|
||||
If something goes wrong copying the zip file to one filesystem, the package will still try to copy zipped backup to all other configured filesystems.
|
||||
|
||||
## Get notifications when a backup goes wrong
|
||||
|
||||
You can receive a notification when a backup goes wrong. Read
|
||||
the section on [notifications](/laravel-backup/v6/sending-notifications/overview) to find out more.
|
||||
Reference in New Issue
Block a user