From 9cfde523b013cc36bd7f4b0c1fbfc7d2449f18cb Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 12 May 2016 16:54:07 -0700 Subject: [PATCH] Updated laravel-backup package Files are still not being generated. Open a ticket with the package maintainer --- app/Console/Kernel.php | 1 + composer.json | 2 +- composer.lock | 16 +-- config/laravel-backup.php | 227 +++++++++++++++++++++++++------------- 4 files changed, 158 insertions(+), 88 deletions(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index b79a3e556c..d400910b32 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -37,5 +37,6 @@ class Kernel extends ConsoleKernel $schedule->command('snipeit:inventory-alerts')->daily(); $schedule->command('snipeit:expiring-alerts')->daily(); $schedule->command('snipeit:backup')->weekly(); + $schedule->command('backup:clean')->daily(); } } diff --git a/composer.json b/composer.json index 4d97d4bab7..b43fb683a7 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "doctrine/common": "v2.5.3", "doctrine/dbal": "v2.4.2", "barryvdh/laravel-debugbar": "^2.1", - "spatie/laravel-backup": "3.0" + "spatie/laravel-backup": "^3.7" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 025128168f..f161f88ee6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "12b97719862dc701bb0c465f434db081", - "content-hash": "7e60a755ea83a5007fa6906346c00cc8", + "hash": "abd2bfc01b3565b7dd1f6aac9e9311b1", + "content-hash": "21294a0f9fd03e194e64084844a1d380", "packages": [ { "name": "aws/aws-sdk-php", @@ -2324,16 +2324,16 @@ }, { "name": "spatie/laravel-backup", - "version": "3.0.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-backup.git", - "reference": "1937f83d663257d1066d843cc3b634751bc98cf6" + "reference": "d41a03bae8f2b3555f9d77bd6f89133e76c2bcd2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/1937f83d663257d1066d843cc3b634751bc98cf6", - "reference": "1937f83d663257d1066d843cc3b634751bc98cf6", + "url": "https://api.github.com/repos/spatie/laravel-backup/zipball/d41a03bae8f2b3555f9d77bd6f89133e76c2bcd2", + "reference": "d41a03bae8f2b3555f9d77bd6f89133e76c2bcd2", "shasum": "" }, "require": { @@ -2342,7 +2342,7 @@ "illuminate/support": "^5.1", "league/flysystem": "^1.0.8", "php": "^5.5|^7.0", - "spatie/db-dumper": "^1.1.0", + "spatie/db-dumper": "^1.3", "symfony/finder": "^2.7|^3.0" }, "require-dev": { @@ -2382,7 +2382,7 @@ "laravel-backup", "spatie" ], - "time": "2016-03-07 18:32:17" + "time": "2016-05-12 13:34:22" }, { "name": "swiftmailer/swiftmailer", diff --git a/config/laravel-backup.php b/config/laravel-backup.php index 6e8ac6db0a..62d88e5611 100644 --- a/config/laravel-backup.php +++ b/config/laravel-backup.php @@ -2,109 +2,178 @@ return [ - 'source' => [ + 'backup' => [ - 'files' => [ + /* + * The name of this application. You can use this name to monitor + * the backups. + */ + 'name' => env('APP_URL'), - /* - * The list of directories that should be part of the backup. You can - * specify individual files as well. - */ - 'include' => [ - 'public/uploads', - 'config', - 'app/storage/private_uploads', + 'source' => [ + + 'files' => [ + + /* + * The list of directories that should be part of the backup. You can + * specify individual files as well. + */ + 'include' => [ + base_path('public/uploads'), + base_path('config'), + base_path('storage/private_uploads'), + ], + + /* + * These directories will be excluded from the backup. + * You can specify individual files as well. + */ + 'exclude' => [ + base_path('vendor'), + base_path('node_modules'), + ], + + /* + * Determines if symlinks should be followed. + */ + 'followLinks' => false, ], /* - * These directories will be excluded from the backup. - * You can specify individual files as well. + * The names of the connections to the databases that should be part of the backup. + * Currently only MySQL- and PostgreSQL-databases are supported. */ - 'exclude' => [ - base_path('vendor'), + 'databases' => [ + 'mysql', ], ], - /* - * Should the database be part of the back up. - */ - 'backup-db' => true, + 'destination' => [ + + /* + * The disk names on which the backups will be stored. + */ + 'disks' => [ + 'local', + ], + ], ], - 'destination' => [ - + 'cleanup' => [ /* - * The filesystem(s) you on which the backups will be stored. Choose one or more - * of the filesystems you configured in app/config/filesystems.php + * The strategy that will be used to cleanup old backups. + * The youngest backup will never be deleted. */ - 'filesystem' => ['local'], + 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, + + 'defaultStrategy' => [ + + /* + * The amount of days that all daily backups must be kept. + */ + '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 + ] + ], + + + /* + * 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. + */ + 'monitorBackups' => [ + [ + 'name' => env('APP_URL'), + 'disks' => ['local'], + 'newestBackupsShouldNotBeOlderThanDays' => 1, + 'storageUsedMayNotBeHigherThanMegabytes' => 5000, + ], /* - * The path where the backups will be saved. This path - * is relative to the root you configured on your chosen - * filesystem(s). + [ + 'name' => 'name of the second app', + 'disks' => ['local', 's3'], + 'newestBackupsShouldNotBeOlderThanDays' => 1, + 'storageUsedMayNotBeHigherThanMegabytes' => 5000, + ], + */ + ], + + 'notifications' => [ + + /* + * 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". * - * If you're using the local filesystem a .gitignore file will - * be automatically placed in this directory so you don't - * accidentally end up committing these backups. + * Slack requires the installation of the maknz/slack package. */ - 'path' => 'backups', + 'events' => [ + 'whenBackupWasSuccessful' => ['log'], + 'whenCleanupWasSuccessful' => ['log'], + 'whenHealthyBackupWasFound' => ['log'], + 'whenBackupHasFailed' => ['log', 'mail'], + 'whenCleanupHasFailed' => ['log', 'mail'], + 'whenUnhealthyBackupWasFound' => ['log', 'mail'], + ], /* - * By default the backups will be stored as a zipfile with a - * timestamp as the filename. With these options You can - * specify a prefix and a suffix for the filename. + * Here you can specify how emails should be sent. */ - 'prefix' => 'backup-', - 'suffix' => '', - ], - - 'clean' => [ - /* - * The clean command will remove all backups on all configured filesystems - * that are older then this amount of days. - */ - 'maxAgeInDays' => 90, - ], - - 'mysql' => [ - /* - * The path to the mysqldump binary. You can leave this empty - * if the binary is installed in the default location. - */ - 'dump_command_path' => '', + 'mail' => [ + 'from' => 'your@email.com', + 'to' => 'your@email.com', + ], /* - * If your server supports it you can turn on extended insert. - * This will result in a smaller dump file and speeds up the backup process. - * - * See: https://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_extended-insert + * Here you can specify how messages should be sent to Slack. */ - 'useExtendedInsert' => false, + 'slack' => [ + 'channel' => '#backups', + 'username' => 'Backup bot', + 'icon' => ':robot:', + ], /* - * If the dump of the db takes more seconds that the specified value, - * it will abort the backup. + * Here you can specify how messages should be sent to Pushover. */ - 'timeoutInSeconds' => 60, - ], - - 'pgsql' => [ - /* - * The path to the pg_dump binary. You can leave this empty - * if the binary is installed in the default location. - */ - 'dump_command_path' => '', - - /* - * Set to true to use pgsql 'COPY' statements instead of 'INSERT's. - */ - 'use_copy' => true, - - /* - * If the dump of the db takes more seconds that the specified value, - * it will abort the backup. - */ - 'timeoutInSeconds' => 60, - ], + 'pushover' => [ + 'token' => env('PUSHOVER_APP_TOKEN'), + 'user' => env('PUSHOVER_USER_KEY'), + 'sounds' => [ + 'success' => env('PUSHOVER_SOUND_SUCCESS','pushover'), + 'error' => env('PUSHOVER_SOUND_ERROR','siren'), + ], + ], + ] ];