Skip to content

Releases: dgtlss/capsule

v2.1.0

01 Apr 08:32

Choose a tag to compare

Laravel 13 support added to capsule 🎉

v2.0.1

25 Mar 14:31
09c70b1

Choose a tag to compare

Hotfix for include_tables and exclude_tables on parallel backups

v2.0.0

26 Feb 15:40
1751e03

Choose a tag to compare

🎉 Capsule v2.0.0 — Complete Rewrite

Capsule v2 is a ground-up rebuild that upgrades Capsule from a basic backup tool into a production-ready Laravel backup solution with enterprise-grade reliability, monitoring, and compliance.


💥 Breaking Changes (v1 → v2)

  • --v replaced by --detailed
  • Config structure updated (new sections + some re-organisation)
  • New migrations required
  • Minimum PHP version is now 8.1+
  • Filament provider consolidated into main provider

Migration

  1. composer require dgtlss/capsule
  2. php artisan vendor:publish --tag=capsule-config --force
  3. Review/merge config changes
  4. php artisan migrate
  5. Update scripts using --v--detailed
  6. Test in staging before production

🚀 Highlights

Incremental & Differential Backups

  • Incremental mode: backs up only files changed since the last full backup
  • Change detection via file size + modified time
  • Automatic fallback to full backup when no baseline exists
  • Typical strategy: weekly full + daily incremental
  • Uses BackupSnapshot to track file states between runs

Backup Simulation & Planning

  • Dry-run to estimate size and duration before committing
  • Estimates raw size, archive size, and duration from historical throughput
  • Reports largest files + top extensions
  • Compares against recent backups
  • Warns about low disk space or unusually large datasets

Backup Policies as Code

  • Define named policies (e.g. database-hourly, full-weekly)
  • Per-policy configuration: schedule, retention, disk, includes/excludes
  • Run policies manually: php artisan capsule:backup --policy=database-hourly
  • Enables multi-tier backup strategies with independent schedules

Full Restore Capability

  • New capsule:restore command
  • Restore latest or by ID
  • Database-only, files-only, or full restore
  • Browse contents with --list
  • Selective restore with --only (glob patterns)
  • Restore to different target paths / DB connections
  • --dry-run and --force supported
  • Supports MySQL, PostgreSQL, SQLite

Envelope Encryption + Key Rotation

  • Envelope encryption (DEK per backup, wrapped by a master key)
  • Manifest stores Key ID enabling key rotation
  • Old backups remain decryptable with their original keys

Anomaly Detection

  • Flags unusual backups based on rolling averages:
    • Size (>200% larger/smaller)
    • Duration (>300% longer)
    • File count shifts
    • Compression efficiency drops
  • Included in summary output and notifications

Database Dump Validation

  • Validates dumps before archiving:
    • MySQL/MariaDB: header + “Dump completed” marker
    • PostgreSQL: header format
    • SQLite: magic bytes + minimum size
  • Prevents storing corrupt/incomplete dumps

Compliance Audit Log

  • Immutable audit trail of backup operations (backup/restore/cleanup/verify)
  • Stored in backup_audit_logs
  • Useful for regulated environments (e.g. SOC2/HIPAA-style evidence)

S3 Lifecycle Management

  • Automatic object tagging for S3-compatible storage
  • Configurable storage class transitions (e.g. STANDARD → IA → GLACIER)
  • Works with AWS S3, Spaces, MinIO, etc.

Continuous Integrity Monitoring

  • Scheduled verification of archives:
    • ZIP integrity + SHA-256 checksums
  • Default re-check interval: 7 days
  • Failures trigger notifications
  • Runner command: capsule:verify-scheduled

Metrics & Schedule Advisor

  • New capsule:advisor command:
    • Size growth trends, duration patterns, compression efficiency
    • Failure rates and streaks
    • Actionable schedule optimisation suggestions

Multi-Disk Backup Redundancy

  • Replicate backups to additional_disks
  • Replication failures are logged but do not fail the backup
  • Great for geo redundancy / tiered storage
    (Per-disk retention rules coming soon)

Interactive Backup Downloads

  • New capsule:download command
  • Download latest or by ID to a local path
  • Progress output for large archives

Smart Backup Triggers

  • New capsule:backup-if-stale command
  • Runs only if last successful backup exceeds a staleness threshold (default 24h)
  • Useful for deploy hooks or redundant schedules

🔧 Improvements & Fixes

Notification System Overhaul

  • Richer notifications + better formatting
  • Modern payloads:
    • Slack Block Kit, Discord Embeds, Teams Adaptive Cards, Google Chat Card v2
  • Channel filtering via notify_on (e.g. failures only)
  • Webhook retries with exponential backoff
  • Includes app/env/host, size, duration, disk, errors, anomaly warnings

Built-in File Filters

  • MaxFileSizeFilter
  • ExtensionFilter (allow/deny)
  • PatternFilter (regex paths)
  • All implement FileFilterInterface
  • Registered via extensibility.file_filters

Better CLI Consistency

  • Replaced --v with --detailed (avoids Symfony verbosity conflicts)
  • Added --db-only and --files-only
  • All commands support --format=json for automation/CI

Critical Bug Fixes

  • Retention cleanup: replaced aggressive orWhereNotIn with safe logic
  • Lock lifecycle: ensured lock is always released (finally block)
  • Path exclusions: fixed basename matching to avoid false positives
  • PHP requirement aligned to 8.1+
  • S3/FTP adapters moved to optional installs (suggested)

Shared Logic Extraction / Parity

  • Extracted shared components:
    • DatabaseDumper, ManifestBuilder, Helpers
  • ChunkedBackupService brought to full parity with standard backups

🧪 Testing & Quality

  • 40 tests covering backup, restore, cleanup, verification, scheduling
  • Mock implementations for safe test runs
  • CI-ready PHPUnit setup (phpunit.xml)
  • Repo hygiene: .gitignore clean-up (removed vendor/, test-app/)

📦 Programmatic API

  • New Capsule facade:
    • Capsule::backup(array $options = [])
    • Capsule::simulate()
    • Capsule::list()
    • Capsule::latest()
    • Capsule::isHealthy()

📊 Database & Config Changes

New Migrations

  • Add tag support (backup_logs)
  • backup_metrics
  • backup_snapshots
  • verification_logs
  • backup_audit_logs

New Config Sections

  • policies, chunked_backup, verification, anomaly, audit
  • s3_lifecycle, health, extensibility

🎨 New Commands

  • capsule:restore
  • capsule:download
  • capsule:advisor
  • capsule:backup-if-stale
  • capsule:verify-scheduled

v1.1.0

09 Sep 22:45

Choose a tag to compare

Version 1.1.0

  • Enhance CleanupCommand with notification support for cleanup actions
  • Improve BackupService with dynamic MySQL/MariaDB dump command selection for better compatibility.
  • Added a --days= option to the cleanup command to override config values

v1.0.4

20 Aug 09:28

Choose a tag to compare

Update version to 1.0.4 and add support for mariadb in the ChunkedBackupService

v1.0.3

14 Aug 14:24

Choose a tag to compare

Improved password handling

v1.0.2

12 Aug 14:15
c0cfc38

Choose a tag to compare

Hotfix for an intermittent issue with Amazon RDS database connectivity

v1.0.1

08 Aug 13:36

Choose a tag to compare

Reinstate laravel 12 support after v1 testing

v1.0.0

08 Aug 13:31

Choose a tag to compare

Highlights

• Reliable backups with atomic flow and manifest checksums
• Chunked streaming mode (no local disk), concurrent uploads
• Preflight DB connectivity guard (backs out early and notifies if unreachable)
• Budget‑aware retention and improved cleanup
• JSON output for CI/automation across core commands
• Locking (single‑flight) to prevent overlapping runs
• Verify at rest, including best‑effort remote checksum on S3
• Events and extension points (file filters, pre/post steps)
• Health reporting and Filament browse/inspect panel (no restore)
• Styled HTML emails and richer webhook notifications

New and improved

• Integrity and manifest
• Every archive now contains manifest.json with metadata and per‑entry SHA‑256 checksums
• capsule:verify validates the ZIP and manifest; --all supported
• S3 best‑effort ETag check (single‑part uploads) for remote verification
• Chunked backups
• Stream database dumps and files directly to storage without local disk
• Concurrent chunk uploads with stats and fault tolerance
• JSON output
• capsule:backup --format=json
• capsule:cleanup --format=json
• capsule:verify --format=json and --all
• Retention and budget
• Age/count policies plus optional storage budget via retention.max_storage_mb
• Prunes oldest backups until usage is under budget, honoring retention.min_keep
• Locking
• Prevent overlapping runs with cache locks (configurable store, timeout, wait)
• --force to bypass in emergencies
• Reliability (uploads)
• Configurable retries and exponential backoff for storage operations
• Observability and health
• capsule:diagnose includes a health summary (last success age, recent failures, usage)
• capsule:health --format=json emits a snapshot for dashboards or checks
• Optional Spatie Laravel Health check provided
• Commands
• capsule:list [--limit] [--format]
• capsule:inspect {id} [--format] (reads manifest.json from the archive)
• capsule:verify {id?} [--all] [--format]
• capsule:cleanup [--days] [--dry-run] [--format]
• capsule:backup [--no-local] [--parallel] [--compress=] [--encrypt] [--verify] [--format]
• Hooks and extensibility
• Events at each stage: BackupStarting, DatabaseDumpStarting/Completed, FilesCollectStarting/Completed, ArchiveFinalizing, BackupUploaded, BackupSucceeded/Failed
• File filters via FileFilterInterface
• Pre/post steps via StepInterface (run before/after; failures abort)
• Notifications
• Styled HTML emails
• Clear preflight failure message (“Backup Failed – Database Unreachable”) with guidance
• Filament panel (browse only)
• Simple page to list backups, health stats, and inspect hints (no automatic restore)

Configuration additions

• Locking
• lock.store, lock.timeout_seconds, lock.wait_seconds
• Retention budget
• retention.max_storage_mb, retention.min_keep
• Storage retries
• storage.retries, storage.backoff_ms, storage.max_backoff_ms
• Health thresholds
• health.max_last_success_age_days, health.max_recent_failures, health.warn_storage_percent
• Extensibility
• extensibility.file_filters, extensibility.pre_steps, extensibility.post_steps

v0.1.5

06 Aug 15:14

Choose a tag to compare

Improved the functionality and logging for the --no-local chunked backup option