Hi all,
First, thanks so much for this great package! I'm running v3.7.0 on Laravel 5.2, and when I try to run php artisan backup:run, it seems to get stuck on determining the files to backup, so no backup file is produced.
snipe$ php artisan backup:run
Starting backup...
Dumping database snipeit_laravel...
Determining files to backup...
And that's it. Nothing in the error logs, I see a zip file created in storage/laravel-backups/tmp, but when I open that zip, it only has the SQL dump in there. The storage/backups destination directory is writable.
I don't see the old configuration of the destination directory, just the destination disk, but I'm not seeing the console feedback where it tells me how many files it's going to store.
I only want to backup the config directory, and user uploaded files, all to the local filesystem. My config file is below:
<?php
return [
'backup' => [
/*
* The name of this application. You can use this name to monitor
* the backups.
*/
'name' => env('APP_URL'),
'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,
],
/*
* The names of the connections to the databases that should be part of the backup.
* Currently only MySQL- and PostgreSQL-databases are supported.
*/
'databases' => [
'mysql',
],
],
'destination' => [
/*
* The disk names on which the backups will be stored.
*/
'disks' => [
'local',
],
],
],
'cleanup' => [
/*
* The strategy that will be used to cleanup old backups.
* The youngest backup will never be deleted.
*/
'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,
],
/*
[
'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".
*
* Slack requires the installation of the maknz/slack package.
*/
'events' => [
'whenBackupWasSuccessful' => ['log'],
'whenCleanupWasSuccessful' => ['log'],
'whenHealthyBackupWasFound' => ['log'],
'whenBackupHasFailed' => ['log', 'mail'],
'whenCleanupHasFailed' => ['log', 'mail'],
'whenUnhealthyBackupWasFound' => ['log', 'mail'],
],
/*
* Here you can specify how emails should be sent.
*/
'mail' => [
'from' => '[email protected]',
'to' => '[email protected]',
],
/*
* Here you can specify how messages should be sent to Slack.
*/
'slack' => [
'channel' => '#backups',
'username' => 'Backup bot',
'icon' => ':robot:',
],
/*
* 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'),
],
],
]
];
Any ideas? Thanks so much in advance!
Interestingly, if I remove all of the values in the include array:
/*
* 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'),
],
to
/*
* The list of directories that should be part of the backup. You can
* specify individual files as well.
*/
'include' => [
],
I get:
snipe$ php artisan backup:run
Starting backup...
Dumping database snipeit_laravel...
Determining files to backup...
Zipping 0 files...
Copying 2016-05-12-165659.zip (size: 22.46 KB) to disk named local...
Successfully copied .zip file to disk named local.
And then it creates a directory in storage/app with the backup zip in there.
It seems if I have any value for the included files, everything stops.
Huh. If I replace the included file values, and comment out the excluded files, that also works:
snipe$ php artisan backup:run
Starting backup...
Dumping database snipeit_laravel...
Determining files to backup...
Zipping 47 files...
Copying 2016-05-12-170410.zip (size: 474.7 KB) to disk named local...
Successfully copied .zip file to disk named local.
The zip file that gets generated has realllllly long sub-directory paths though. So when I unzip the backup, I see Users, then agianotto, then Sites, etc.
(Apologies for the GH spam - just trying to provide information that might be useful.)
Hi, the paths in the zip contain the full directory path of the file where it's stored on disk. This is normal. I'm glad to commenting out the excluded files also makes your backup work. I'm assuming it has something to do with the very large number of files in node_modules. I'm actively investigating the issue and will tag a new version as soon as I have found a fix.
I know they are full paths, but is there any way to make them relative? There isn't really any good reason I can think of for them to be full paths.
Currently there is no way to do this. But I'd accept a PR that adds a config value to control if full paths should be used in the zip.
Starting backup...
Dumping database eversun...
Determining files to backup...
Zipping 1 files...
Created zip containing 1 files. Size is 2.39 KB
Copying zip to disk named local...
Successfully copied zip to disk named local.
Copying zip failed because: Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
".
Backup failed because Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required
at the end of the process I still got an error. I dont know whats happening?
@ong1995 I just had this problem but fixed it. If you are getting a message that says Backup failed because Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required it's because the backup is trying to notify you about the backup via email, but you don't have the Mail configuration set up properly in your app. Comment out mail in the notifications array in config/backup.php and you should be good! ;-) Or configure your Mail settings. 馃憤
@ong1995 I just had this problem but fixed it. If you are getting a message that says
Backup failed because Expected response code 250 but got code "530", with message "530 5.7.1 Authentication requiredit's because the backup is trying to notify you about the backup via email, but you don't have the Mail configuration set up properly in your app. Comment outnotificationsarray inconfig/backup.phpand you should be good! ;-) Or configure your Mail settings. 馃憤
It's always dns..
Most helpful comment
@ong1995 I just had this problem but fixed it. If you are getting a message that says
Backup failed because Expected response code 250 but got code "530", with message "530 5.7.1 Authentication requiredit's because the backup is trying to notify you about the backup via email, but you don't have the Mail configuration set up properly in your app. Comment outmailin thenotificationsarray inconfig/backup.phpand you should be good! ;-) Or configure your Mail settings. 馃憤