sprint-digital / sprint-backup
This is my package sprint-backup
Fund package maintenance!
sprint-digital
Requires
- php: ^8.2
- laravel/framework: ^11.0
- spatie/laravel-backup: ^8.6.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^8.1.1
- orchestra/testbench: ^9.0.3
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.5
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
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.
Installation
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.
Production / Staging
You might have to install mysql on your server. (ie. worker servers)
sudo apt-get install -y default-mysql-client
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.