timacdonald / multisite-backup-command
A wrapper around spatie/laravel-backup backup command to make it super simple to backup multiple sites on a single server
Installs: 39
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 0
Open Issues: 2
Type:utility
Requires
- php: ^7.0
- illuminate/console: ~5.5.0
- illuminate/contracts: ~5.5.0
- spatie/laravel-backup: ^5.0
Requires (Dev)
- orchestra/testbench: ^3.5
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2022-07-29 01:36:17 UTC
README
This command wraps the spatie/laravel-backup
backup command to make it super simple to backup multiple sites on a single server - from the one Laravel installation. You can read more about is over on my blog.
Installation
You should already have spatie/laravel-backup
installed and configured.
You can install using composer from Packagist.
$ composer require timacdonald/multisite-backup-command
Usage
Extend the class and add the command to your app as per usual. Then add you sites the $sites
variable:
<?php namespace App\Console\Commands; use TiMacDonald\MultisiteBackupCommand\BackupCommand as BaseBackupCommand; class BackupCommand extends BaseBackupCommand { protected $sites = [ [ 'name' => 'My Website', 'databases' => [ 'mysql' => 'timacdonald_mysql_db', 'pgsql' => 'timacdonald_pgsql_db', ], 'include' => ['timacdonald.me/storage/app'], ], [ 'name' => 'A Wordpress Website', 'databases' => ['mysql' => 'my_wp_db'], 'include' => ['wordpress.site.com.au/wp-content/uploads'], ], ]; }
And then you will have to following commands available:
# Backup all sites php artisan app:backup --run # Clean all sites php artisan app:backup --clean # List all sites php artisan app:backup --list # Monitor all sites php artisan app:backup --monitor
v1 to v2 upgrade guide
The structure of the $sites
array has changed. Please update the array and you should be good to go.
Previously:
protected $sites = [ [ 'domain' => 'timacdonald.me', 'database' => 'timacdonald_mysql_db', 'paths' => ['storage/app'], ], ];
Update each site to the following structure:
protected $sites = [ [ 'name' => 'https://timacdonald.me', 'databases' => ['mysql' => 'timacdonald_mysql_db'], 'include' => ['timacdonald.me/storage/app'], ], ];
And your done!
Thanksware
You are free to use this package, but I ask that you reach out to someone (not me) who has previously, or is currently, maintaining or contributing to an open source library you are using in your project and thank them for their work. Consider your entire tech stack: packages, frameworks, languages, databases, operating systems, frontend, backend, etc.