From 6ebc653620602b451c88b057980300ad0311db91 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 24 Jul 2018 20:29:25 -0700 Subject: [PATCH] Sparie backups config upgrade --- config/laravel-backup.php | 195 +++++++++++++++++++------------------- 1 file changed, 98 insertions(+), 97 deletions(-) diff --git a/config/laravel-backup.php b/config/laravel-backup.php index 37250195f..a1bced62b 100644 --- a/config/laravel-backup.php +++ b/config/laravel-backup.php @@ -24,25 +24,25 @@ return [ 'files' => [ /* - * The list of directories that should be part of the backup. You can - * specify individual files as well. + * The list of directories and files that will be included in the backup. */ 'include' => [ - base_path('public/uploads'), - base_path('config'), - base_path('storage/private_uploads'), - base_path('storage/oauth-private.key'), - base_path('storage/oauth-public.key'), - (env('BACKUP_ENV')=='true') ? base_path('.env') : '', + public_path('uploads'), + storage_path('private_uploads'), + storage_path('oauth-private.key'), + storage_path('oauth-public.key'), + (env('BACKUP_ENV')=='true') ? base_path('.env') : base_path('.env.example'), + ], /* - * These directories will be excluded from the backup. - * You can specify individual files as well. + * 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'), + // base_path('vendor'), + // base_path('node_modules'), ], /* @@ -52,16 +52,26 @@ return [ ], /* - * The names of the connections to the databases that should be part of the backup. - * Currently only MySQL- and PostgreSQL-databases are supported. + * The names of the connections to the databases that should be backed up + * MySQL, PostgreSQL, SQLite and Mongo databases are supported. */ 'databases' => [ 'mysql', ], ], + /* + * The database dump can be gzipped to decrease diskspace usage. + */ + 'gzip_database_dump' => false, + 'destination' => [ + /* + * The filename prefix used for the backup zip file. + */ + 'filename_prefix' => 'snipe-it-backup-', + /* * The disk names on which the backups will be stored. */ @@ -71,57 +81,52 @@ return [ ], ], - 'cleanup' => [ + /* + * You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'. + * For Slack you need to install guzzlehttp/guzzle. + * + * 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'], + ], + /* - * The strategy that will be used to cleanup old backups. - * The youngest backup will never be deleted. + * 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. */ - 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, + 'notifiable' => \Spatie\Backup\Notifications\Notifiable::class, - 'defaultStrategy' => [ + 'mail' => [ + 'to' => null, + ], + + 'slack' => [ + 'webhook_url' => '', /* - * The amount of days that all daily backups must be kept. + * If this is set to null the default channel of the webhook will be used. */ - 'keepAllBackupsForDays' => 7, - - /* - * The amount of days that all daily backups must be kept. - */ - 'keepDailyBackupsForDays' => 16, - - /* - * The amount of weeks of which one weekly backup must be kept. - */ - 'keepWeeklyBackupsForWeeks' => 8, - - /* - * The amount of months of which one monthly backup must be kept. - */ - 'keepMonthlyBackupsForMonths' => 4, - - /* - * The amount of years of which one yearly backup must be kept - */ - 'keepYearlyBackupsForYears' => 2, - - /* - * After cleaning up the backups remove the oldest backup until - * this amount of megabytes has been reached. - */ - 'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000 - ] + 'channel' => null, + ], ], - /* - * 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. + * Here you can specify which backups should be monitored. + * If a backup does not meet the specified requirements the + * UnHealthyBackupWasFound event will be fired. */ 'monitorBackups' => [ [ - 'name' => 'backups', + 'name' => env('APP_NAME'), 'disks' => ['local'], 'newestBackupsShouldNotBeOlderThanDays' => 1, 'storageUsedMayNotBeHigherThanMegabytes' => 5000, @@ -137,55 +142,51 @@ return [ */ ], - 'notifications' => [ - + 'cleanup' => [ /* - * This class will be used to send all notifications. - */ - 'handler' => Spatie\Backup\Notifications\Notifier::class, - - /* - * Here you can specify the ways you want to be notified when certain - * events take place. Possible values are "log", "mail", "slack" and "pushover". + * 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. * - * Slack requires the installation of the maknz/slack package. + * No matter how you configure it the default strategy will never + * delete the newest backup. */ - 'events' => [ - 'whenBackupWasSuccessful' => ['log'], - 'whenCleanupWasSuccessful' => ['log'], - 'whenHealthyBackupWasFound' => ['log'], - 'whenBackupHasFailed' => ['log'], - 'whenCleanupHasFailed' => ['log'], - 'whenUnhealthyBackupWasFound' => ['log'], - ], + 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, - /* - * Here you can specify how emails should be sent. - */ - 'mail' => [ - 'from' => env('MAIL_FROM_ADDR', 'your@email.com'), - 'to' => env('MAIL_FROM_ADDR', 'your@email.com'), - ], + 'defaultStrategy' => [ - /* - * Here you can specify how messages should be sent to Slack. - */ - 'slack' => [ - 'channel' => '#backups', - 'username' => 'Backup bot', - 'icon' => ':robot:', - ], + /* + * The number of days for which backups must be kept. + */ + 'keepAllBackupsForDays' => 7, - /* - * Here you can specify how messages should be sent to Pushover. - */ - 'pushover' => [ - 'token' => env('PUSHOVER_APP_TOKEN'), - 'user' => env('PUSHOVER_USER_KEY'), - 'sounds' => [ - 'success' => env('PUSHOVER_SOUND_SUCCESS','pushover'), - 'error' => env('PUSHOVER_SOUND_ERROR','siren'), - ], + /* + * The number of days for which daily backups must be kept. + */ + 'keepDailyBackupsForDays' => 16, + + /* + * The number of weeks for which one weekly backup must be kept. + */ + 'keepWeeklyBackupsForWeeks' => 8, + + /* + * The number of months for which one monthly backup must be kept. + */ + 'keepMonthlyBackupsForMonths' => 4, + + /* + * The number of years for which one yearly backup must be kept. + */ + 'keepYearlyBackupsForYears' => 2, + + /* + * After cleaning up the backups remove the oldest backup until + * this amount of megabytes has been reached. + */ + 'deleteOldestBackupsWhenUsingMoreMegabytesThan' => 5000, ], - ] + ], ]; +