Faire un Backup fichier de la base mysql dans l’application laravel.
Installation:
composer require spatie/laravel-backup
Configuration:
php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"
Attention! Deux choses à changer:
/*
* The list of directories and files that will be included in the backup.
*/
'include' => [
base_path(), => //base_path(),
],
'mail' => [
'to' => 'your@example.com',
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
Ajouter les bonnes coordonnées !!
Pour le sheduling:
// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run')->daily()->at('01:30');
}
Activation:
backup:clean Remove all backups older than specified number of days in config.
backup:list Display a list of all backups.
backup:monitor Monitor the health of all backups.
backup:run Run the backup.