How to use `laravel-backup`-Package with Laravel Vapor

819 Views Asked by At

We are using Laravel Vapor to manage our laravel application and planing to use the laravel-backup package to create automated database backups for our production environment.

I testet the implementation and managed to get it worked (with version 7.3.3) on my windows machine.

I set the mail configuration to get notified when an backup runs (successful or not) and set the path to mysqldump like this:

'dump' => [
    'dump_binary_path' => 'C:\xampp\mysql\bin',
    'use_single_transaction',
    'timeout' => 60 * 5,
]

To set this up and running with vapor, I changed the destination.disk-config from local to s3 with s3 as

's3' => [
    'driver' => 's3',
    'key' => env('AWS_ACCESS_KEY_ID'),
    'secret' => env('AWS_SECRET_ACCESS_KEY'),
    'region' => env('AWS_DEFAULT_REGION'),
    'bucket' => env('AWS_BUCKET'),
    'url' => env('AWS_URL'),
    'endpoint' => env('AWS_ENDPOINT'),
],

I removed the dump_binary_path, because I didn't know where to point with it in the context of vapor. So I hoped that it is at a default location as it is mentioned in the docs of the laravel-backup package:

mysqldump is used to backup MySQL databases. pg_dump is used to dump PostgreSQL databases. If these binaries are not installed in a default location, you can add a key named dump.dump_binary_path in Laravel's own database.php config file.

I included the backup command in the kernel-file

$schedule->command('backup:clean')->daily()->at('01:00');
$schedule->command('backup:run --only-db')->daily()->at('01:30');

and deployed it with vapor.

Unfortunately it isn't working. I didn't recived an email (neither success nor failure) and nothing was created at our s3.

Does someone used laravel-backup with vapor before and knows how to fix this? What am I missing?

Thanks in advance!

1

There are 1 best solutions below

0
On

The Laravel Vapor support replied this: "Our native runtime doesn't have mysqldump installed. You will need to run the Docker runtime and install yourself if this is a requirement. It's also worth noting the maximum execution time on Lambda is 15 mins so if your backup is large, you could run into issues."