Backup of Laravel Web Applications

The Need for Backup

Generally, any web application must back up its data, including databases and objects. There are many choices available, and we are to present the alternatives.

The Setup

A Laravel project is running in a server such as a Droplet in Digital Ocean or an EC2 Instance in AWS EC2.

There is a weekly backup of the droplet by Digital Ocean.

The project is a platform for auctions, so auctioneers and users upload media files, such as images.

All uploaded media files are stored in Digital Ocean Spaces.

The project is deployed and managed with Laravel Forge.

What Do We Backup?

We are using object storage for uploaded media files. Object storage in the public clouds already has redundancy and availability, so we do not need to worry about backup for media files.

So we need to take care of database backup only.

How Do We Backup?

Laravel Backup can back up your database at whatever frequency you choose to object storage.

Now you can have three common ways where your database may reside:

  1. 1. On the application server, together with the application
  2. 2. A separate database server
  3. 3. Managed database service

Managed database services do database backups, whose frequency may not satisfy you.

So you have two choices to do the database backup, running Laravel Backup or using Laravel Forge to do the database backup.

Cost Comparison

Laravel Backup is free and easy to set up. However, backups have to be monitored to make sure they are being done. This requires a separate monitoring server to be set up. The monitoring service will notify of backup failure.

This will bring up the running cost of the application.

Laravel Forge has a backup service in the Business Plan, with an additional monthly cost. The backup service includes backup monitoring with notifications.

However, setting the backup service is simple; just fill out the setup form in Forge.

Prices do change over time, so the break-even point in terms of the cost may shift. However, the break-even point regarding setup work is clearly in favor of Laravel Forge.

Yoram Kornatzky

Yoram Kornatzky