1

I'm using Spatie's Laravel Backup on a Laravel application on Laradock (Docker containers).

With this package, you can either run a manual backup or schedule it.

The manual backup does work.

First I enter into the container and then run the manual backup:

$ docker exec -it workspace bash

/var/www# artisan backup:run
Starting backup...
Dumping database superDB...
Determining files to backup...
Zipping 5111 files and directories...
Created zip containing 5111 files and directories. Size is 80.08 MB
Copying zip to disk named backup...
Successfully copied zip to disk named superBU.
Backup completed!

However, the scheduled backup is not working

$schedule->command('backup:run')->sundays()->at('11:11');

because it is throwing the following error exception:

RecursiveDirectoryIterator::__construct(/var/www/laradock/containers-data/mysql/#innodb_temp): failed to open dir: Permission denied

Exception trace: #0 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/FileSelection.php(109): Symfony\Component\Finder\Iterator\RecursiveDirectoryIterator->getChildren() #1 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/Manifest.php(41): Spatie\Backup\Tasks\Backup\FileSelection->selectedFiles() #2 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(176): Spatie\Backup\Tasks\Backup\Manifest->addFiles() #3 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(146): Spatie\Backup\Tasks\Backup\BackupJob->createBackupManifest() #4 /var/www/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(56): Spatie\Backup\Tasks\Backup\BackupJob->run()

The storage folder has the following permissions:

drwxrwxr-x.  8 root laradock   90 Sep 01 13:00 storage

Inside the storage/ folder there are two folders to achieve the backups:

drwxr-xr-x.  3 laradock www-data   50 Sep 02 10:56 backups
drwxr-xr-x.  2 laradock www-data    3 Oct 02 11:06 backup-temp

The containers-data/mysql/ folder has the following permissions:

drwxr-x---. 2  999 www-data  187 Aug 10 23:01 '#innodb_temp'

Can anyone shed some light or lots of light on this? Why doesn't the scheduled backup work? Why only does the manual backup "artisan backup:run" work?

I have checked out this question, none answer given yet.

I haven't tried this GitHub answer where suggests changing ownership to

$ sudo docker-compose exec workspace bash
# chown -R laradock:laradock /var/www/

This other answer tells how to test the laradock user inside a container. .

apokryfos
  • 34,925
  • 8
  • 65
  • 98
Pathros
  • 8,678
  • 14
  • 80
  • 131

0 Answers0