- How do I set up a dedicated Laravel backup server to receive backups from multiple Laravel apps?
- Install the package via `composer require spatie/laravel-backup-server`, then configure SSH access from source servers to your Laravel backup server. Use the `BackupServer` facade to define sources and destinations in your Laravel app’s config. Each source app must run `spatie/laravel-backup` to send its backups to your central server.
- Does this package support database backups, or is it only for file-level backups?
- This package focuses on file-level backups (e.g., Laravel storage, uploads) using rsync. For databases, you’ll need to integrate external tools like `mysqldump` or `pg_dump` via the `pre_backup_commands` or `post_backup_commands` hooks in your source Laravel apps. The package doesn’t natively handle database backups.
- Can I use cloud storage (e.g., S3, Google Cloud Storage) as the backup destination?
- Yes, but with limitations. The package relies on Laravel’s filesystem drivers, so S3, GCS, or other cloud storage is supported. However, hard link deduplication (for storage savings) only works with local filesystems. Cloud storage may introduce latency or cost for frequent backups, so test performance with your chosen provider.
- What Laravel versions are supported by spatie/laravel-backup-server?
- The package requires Laravel 8+ and PHP 8.0+. It’s built on top of `spatie/laravel-backup`, which also supports Laravel 8+. Always check the [latest compatibility notes](https://docs.spatie.be/laravel-backup-server/) before upgrading, as newer Laravel versions may require adjustments.
- How do I handle SSH key management for secure backup transfers?
- Store SSH private keys securely using Laravel Forge, Envoyer, or HashiCorp Vault. Avoid hardcoding keys in config files. For production, use IAM roles or bastion hosts to manage cross-server access. Rotate keys periodically and restrict permissions to minimize exposure.
- Is there a way to monitor backup jobs or receive alerts if a backup fails?
- The package integrates with Laravel Notifications, so you can send Slack, email, or other alerts via `notifications` config. For advanced monitoring, use custom scripts or third-party tools (e.g., Datadog) to track `backup-server:list` data. Logs are stored in Laravel’s default log directory.
- How does hard link deduplication work, and can it reduce storage costs?
- Hard links create storage-efficient copies of identical files, reducing duplicate storage usage. This works best with local filesystems (e.g., NFS). For cloud storage, deduplication isn’t supported, but you can still use the package to organize backups. Monitor `used_storage` in the CLI to track savings.
- What’s the restore process like? Can I automate it, or do I need manual steps?
- The package doesn’t include built-in restore tools, so you’ll need custom scripts (e.g., rsync or Laravel commands) to restore backups. Document your restore workflow, including SSH access and file permissions. For critical systems, test restores in staging before relying on them in production.
- Are there alternatives to spatie/laravel-backup-server for centralized Laravel backups?
- Alternatives include self-hosted solutions like `duplicati` or `borgbackup`, or managed services like Backblaze B2, AWS Backup, or Laravel Forge’s built-in backup tools. However, these lack Laravel’s native integration (e.g., scheduling, notifications) or hard link deduplication. Evaluate based on your need for Laravel-specific features.
- How do I scale this for thousands of Laravel apps or large backup volumes?
- Start with a pilot phase using 1–2 non-critical sources to test performance. Use Laravel queues to offload backup dispatching and monitor CPU/memory usage. For large volumes, consider splitting backups across multiple destinations or using a distributed filesystem like Ceph. Adjust `backup_size_calculation_timeout_in_seconds` for large backups.