- How do I install `wnx/laravel-backup-restore` for Laravel 12?
- Run `composer require wnx/laravel-backup-restore` to install the package. Ensure your Laravel app is on version 12+ and PHP 8.4+ for compatibility. Publish the config file with `php artisan vendor:publish --tag=backup-restore-config` if you need to customize health checks.
- Can I restore backups created with other tools like custom scripts or AWS RDS?
- No, this package only works with backups generated by `spatie/laravel-backup`. If you use other tools, you’ll need to migrate those backups to the spatie format or use a different restore solution.
- What happens if my backup is corrupted during restore?
- The package lacks built-in corruption detection, so a corrupted backup may fail silently or partially restore. Always verify backups before relying on them, and consider adding custom health checks to validate critical data post-restore.
- How do I automate backups and restores in a CI/CD pipeline?
- You can trigger restores via CLI in scripts, but the package requires interactive input for backup selection. For automation, pre-select backups by passing `--backup` and `--password` flags or use environment variables to streamline the process.
- Does this package support PostgreSQL extensions or custom database functions?
- No, the package restores raw database dumps and may fail if your schema includes PostgreSQL extensions, custom functions, or non-standard SQL. Test thoroughly in a staging environment before production use.
- Can I restore backups stored in S3 or other cloud storage?
- Yes, the package works with any storage backend supported by `spatie/laravel-backup`, including S3, FTP, or Dropbox. Ensure your Laravel app has the necessary credentials and permissions to access the storage during restore.
- How do I add custom health checks to validate the restored database?
- Extend the `HealthCheck` class and add your class path to the `health-checks` array in the published config file. The restore command will fail if any health check fails, ensuring data integrity.
- What’s the best way to handle large database restores to avoid timeouts?
- The package doesn’t optimize for large databases, so restores may time out or hit memory limits. Test with a subset of data first, and consider splitting large databases into smaller backups or using database-specific tools for chunked restores.
- How do I roll back if a restore fails in production?
- The package doesn’t include built-in rollback features. Plan for manual intervention, such as restoring from a previous backup or reverting application changes. Document your disaster recovery steps and test them regularly.
- Are there alternatives to `wnx/laravel-backup-restore` for Laravel?
- If you need more flexibility, consider `spatie/laravel-backup`’s direct restore methods or third-party tools like `laravel-backup` with custom scripts. For cloud-based solutions, AWS RDS snapshots or managed database backups may also fit your needs.