Back up and secure database to AWS S3. Then redistribute the backup to other team environments.
DO NOT SKIP THIS STEP!!! please read AWS setup HERE.
You can install the package via composer:
composer require sprint-digital/sprint-backup
Add environment variables to your .env
file:
BACKUP_AWS_ACCESS_KEY_ID=
BACKUP_AWS_SECRET_ACCESS_KEY=
BACKUP_AWS_DEFAULT_REGION=ap-southeast-2
BACKUP_AWS_BUCKET=sprint-db-bucket
BACKUP_AWS_USE_PATH_STYLE_ENDPOINT=false
BACKUP_ARCHIVE_PASSWORD="{zipSecret}"
BACKUP_AWS_PATH="{repoName}"
BACKUP_MASTER_PASSWORD="{userPassword}"
Add the following to your config/filesystems.php
in disks
array:
's3-backup' => [
'driver' => 's3',
'key' => env('BACKUP_AWS_ACCESS_KEY_ID'),
'secret' => env('BACKUP_AWS_SECRET_ACCESS_KEY'),
'region' => env('BACKUP_AWS_DEFAULT_REGION'),
'bucket' => env('BACKUP_AWS_BUCKET'),
'url' => env('BACKUP_AWS_URL') . '/' . env('BACKUP_AWS_PATH'),
'endpoint' => env('BACKUP_AWS_ENDPOINT'),
'use_path_style_endpoint' => env('BACKUP_AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],
You can publish the config file with:
php artisan backup:install
Backup database:
php artisan backup:to-sprint
Restore database:
php artisan backup:restore
# or auto run the last backup
php artisan backup:restore --last-backup
In some cases the .sql file is too large to be restored. You need to increase the memory limit in your php.ini
file.
You might have to install mysql on your server. (ie. worker servers)
sudo apt-get install -y default-mysql-client
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.