Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Backup Server Laravel Package

spatie/laravel-backup-server

Securely store and manage backups from multiple Laravel apps on a dedicated backup server. Built on spatie/laravel-backup, it automatically receives and organizes incoming backups, with setup and docs tailored for Laravel deployments.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Centralized Backup Orchestration: The package excels as a dedicated backup server for Laravel applications, enabling centralized management of backups across multiple distributed Laravel instances. It leverages Laravel’s ecosystem (e.g., notifications, events, and scheduling) while abstracting the complexity of distributed backup coordination.
  • Modular Design: Built atop spatie/laravel-backup, it inherits a modular architecture for defining sources (remote servers) and destinations (storage disks). This aligns well with microservices or multi-tenant Laravel deployments where each service/tenant may require independent backup policies.
  • Event-Driven Workflow: The package’s event-based architecture (e.g., BackupCompletedEvent, BackupFailedEvent) allows for seamless integration with monitoring tools (e.g., Datadog, Sentry) or custom workflows (e.g., triggering cleanup or alerts). This is critical for observability in production.
  • Storage Efficiency: Uses hard links and rsync to minimize disk usage, which is ideal for cost-sensitive environments (e.g., cloud storage). However, this introduces complexity in multi-cloud or hybrid storage setups.

Integration Feasibility

  • Laravel-Centric: Requires a Laravel backend for the backup server, which may not fit monolithic or non-PHP stacks. For polyglot environments, additional proxies or APIs would be needed.
  • SSH/RSYNC Dependency: Relies on SSH access to source servers and rsync for transfers. Firewall rules, key management, and network latency must be pre-validated.
  • Database Limitations: Does not natively backup databases (only files). Workarounds (e.g., pre_backup_commands for mysqldump) add operational overhead and require manual synchronization with application state.
  • Storage Backend Flexibility: Supports any local filesystem disk (e.g., S3, GCS, NFS) via Laravel’s filesystem.php, but does not natively support cloud-native backups (e.g., AWS Backup, Azure Backup). This may require custom drivers or wrappers.

Technical Risk

  • Failure Modes:
    • SSH/Network Failures: Backup processes halt if SSH or rsync fails, risking silent data loss. Retry logic is manual (e.g., via cron rescheduling).
    • Storage Quota Exceeds: No built-in auto-scaling for storage; requires external monitoring (e.g., Prometheus alerts).
    • Hard Link Corruption: If backups are restored across filesystems, hard links may break, leading to data inconsistencies.
  • Performance Bottlenecks:
    • Large Backups: rsync over WAN can be slow; no compression or chunking by default.
    • Concurrent Backups: No native throttling for parallel backups, which could overload the backup server or source machines.
  • Security Risks:
    • Credential Management: SSH keys and storage credentials must be securely managed (e.g., Laravel Envoy, HashiCorp Vault). The package does not enforce encryption for backups at rest.
    • Unauthorized Access: Misconfigured pre_backup_commands could expose sensitive data (e.g., database dumps) during transfer.

Key Questions

  1. Deployment Model:
    • Will the backup server run in the same VPC as source servers, or across cloud providers? How will SSH latency and egress costs be managed?
  2. Storage Strategy:
    • Are destinations limited to local disks, or will custom drivers (e.g., for S3) be required? How will cross-region replication be handled?
  3. Database Backups:
    • How will database backups be synchronized with file backups? Will custom scripts or third-party tools (e.g., Percona XtraBackup) be needed?
  4. Disaster Recovery:
    • What is the RTO/RPO for backups? How will backups be tested (e.g., restore drills)?
  5. Observability:
    • Are there plans to integrate with existing monitoring (e.g., Grafana dashboards for backup health)?
  6. Scalability:
    • How will the backup server scale if hundreds of sources are added? Will queue workers (e.g., Laravel Horizon) be required?
  7. Compliance:
    • Does the backup strategy meet regulatory requirements (e.g., GDPR, HIPAA) for data retention, encryption, and audit logs?

Integration Approach

Stack Fit

  • Core Stack: Optimized for Laravel 8/9/10 with PHP 8.1+. Leverages Laravel’s:
    • Artisan commands for backup orchestration.
    • Events/Listeners for extensibility.
    • Filesystem abstraction for storage backends.
    • Notifications for alerts.
  • Compatibility:
    • Sources: Any Linux/Unix server with SSH and rsync (no Windows support).
    • Destinations: Any filesystem supported by Laravel’s local driver (e.g., S3, GCS, NFS, local disks).
    • Databases: Requires external tools (e.g., mysqldump, pg_dump) via pre_backup_commands.
  • Extensions:
    • Notification Channels: Supports Laravel Notification Channels (e.g., Slack, Telegram, Pusher).
    • Custom Logic: Extend via events (e.g., trigger cleanup on BackupCompletedEvent).

Migration Path

  1. Pilot Phase:
    • Start with 1–2 non-critical Laravel instances to validate SSH/rsync performance and storage efficiency.
    • Use backup-server:list to monitor health and backup-server:find-files for data verification.
  2. Incremental Rollout:
    • Gradually add sources, prioritizing those with highest RPO requirements.
    • Implement database backup scripts in pre_backup_commands and test restores.
  3. Storage Optimization:
    • Configure retention policies (e.g., cleanup_rules in config/backup-server.php) to automate old backup deletion.
    • Evaluate compression (e.g., tar + rsync) if network bandwidth is constrained.
  4. Observability:
    • Set up Slack/email notifications for backup failures.
    • Integrate with Laravel Telescope or Prometheus to track backup metrics (e.g., duration, size).

Compatibility

  • Laravel Version: Tested on Laravel 8+. For older versions, check package support.
  • PHP Extensions: Requires ssh2 or phpseclib for SSH (install via pecl install ssh2 or composer require phpseclib/phpseclib).
  • Storage Drivers: Only local disks are officially supported. For cloud storage, ensure the Laravel filesystem driver is configured (e.g., aws, gcs).
  • Firewall/Network: Ensure ports 22 (SSH) and custom ports (if SSH is tunneled) are open between sources and the backup server.

Sequencing

  1. Prerequisites:
    • Deploy the backup server (Laravel instance with PHP 8.1+).
    • Configure SSH key-based authentication between sources and the backup server.
    • Set up storage destinations (e.g., S3 bucket, NFS share) and update config/filesystems.php.
  2. Configuration:
    • Define sources (Sources\BackupServer\Models\Source) and destinations (Destinations\BackupServer\Models\Destination).
    • Configure backup_hour for automated backups or set up a cron job for backup-server:dispatch-backups.
  3. Testing:
    • Run manual backups (php artisan backup-server:backup <source>) and verify data integrity.
    • Test restore workflows (e.g., copy files from destination to a staging environment).
  4. Productionization:
    • Schedule backups via cron or Laravel’s task scheduler.
    • Set up notifications and monitoring.
    • Document the restore procedure for disaster recovery.

Operational Impact

Maintenance

  • Configuration Drift: Sources/destinations must be manually updated if IP addresses, storage paths, or backup policies change. Consider a database-backed configuration (e.g., using Laravel Scout or a custom admin panel).
  • Dependency Updates: Monitor spatie/laravel-backup-server and Laravel for breaking changes. The package is actively maintained (last release: 2026-05-11), but custom scripts (e.g., pre_backup_commands) may require updates.
  • Storage Management: Regularly audit storage usage (backup-server:list-destinations) and adjust cleanup rules to avoid quota exceeds.

Support

  • Troubleshooting:
    • Use backup-server:list to identify unhealthy sources.
    • Check logs (storage/logs/laravel.log) for rsync or SSH failures.
    • For database backups, verify pre_backup_commands output (e.g., mysqldump success).
  • Common Issues:
    • **SSH Timeouts
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony