Skip to content
Laravel Forge server backup with restic and Backblaze B2.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Forge Backup

This is a shell script for establishing encrypted, efficient backups of your Laravel Forge server on cheap Backblaze B2 storage. For a more thorough overview, see my Easy Forge Backups with Restic and Backblaze B2 blog post.

This is a free script with no support or warranty. You're responsible for whatever joy or sadness it brings you!


  • Server provisioned with Laravel Forge running Ubuntu 18+.
  • Backblaze account.

What It Does

  • Installs restic, a free, secure, and efficient backup program.
  • Creates a read-only backup MySQL user for generating dumps.
  • Adds shell scripts:
    • for generating and pruning dumps in /home/forge/backup/mysql
    • for running database dumps and backing up /home/forge to B2
    • for locally mounting and browsing+verifying your backups
  • Stores configuration and shell scripts in /root/restic.


Create a Backblaze B2 bucket for your server, and an application key limited to that new bucket.

Run the installer as root (not sudo!) On its initial run, it will ask for B2 credentials and your forge database password to create the backup database user.

sudo bash
curl -O && chmod +x && ./


Once the restic repository is established, try running a few backups and mounting them with to be sure everything looks good. If it does, automate backups by adding a scheduled job that runs as root:

/root/restic/ >/dev/null 2>&1

A custom value of 0 3 * * * will run every day at 3am.

Optionally run the MySQL backup on its own interval:

/root/restic/ >/dev/null 2>&1
You can’t perform that action at this time.