Overview

Forge supports automated database backups that can be scheduled directly from your server’s Forge dashboard. You can choose to backup one or more databases at a specified frequency and also restore any of your recent backups. The backup script used by Forge is open source and can be found on GitHub.

Database backups are only available on our “business” plan.

Creating Backup Configurations

Storage Providers

You can choose to backup your databases to:

  1. Amazon S3
  2. DigitalOcean Spaces
  3. Scaleway
  4. OVH Cloud
  5. Custom (S3 Compatible)

For Amazon S3, DigitalOcean Spaces, Scaleway, and OVH Cloud storage providers you need to provide Forge with:

  • The region your backup should be stored in (eu-west-2, nyc3 etc..)
  • The name of the storage “bucket”
  • The access / secret keys that should be used to connect to the storage service

When using Amazon S3 in combination with an EC2 server, you can alternatively choose to use the identity of the EC2 server to stream the backup to S3 without providing credentials. In this case, you only need to check the “Use EC2 Assumed Role” checkbox.

When using Amazon S3 to store your database backups, your AWS IAM user must have the following permissions for S3:

  • s3:PutObject
  • s3:GetObject
  • s3:ListBucket
  • s3:DeleteObject

When using a custom, S3 compatible provider, you must supply:

  • The service endpoint / URL
  • The name of the storage “bucket”
  • The access / secret keys that should be used to connect to the storage service

You can also choose to provide a storage directory where backups will be restored relative to your bucket root. If left empty, backups will be stored within the root of your bucket.

Not all providers are 100% compatible with Amazon S3’s API. Some providers, such as OVH and Scaleway, require a custom configuration to work correctly, typically through the use of awscli-plugin-endpoint.

Frequency Options

Within the Forge database backup dashboard, you can select the frequency at which your database should be backed up:

  • Hourly
  • Daily (at a given time)
  • Weekly (on a given day and time)
  • Custom

When using the API to create a Daily or Weekly backup, you may provide any valid time (e.g. 13:37) to your schedule; however, for the sake of simplicity, the Forge UI allows you to select a time in 30 minute intervals. The time you select should be in your local time as reported by your web browser.

The Custom option allows you to provide a custom cron expression. You may wish to use a service such as crontab.guru to help you generate this.

Backup Retention

Forge will automatically prune old backups for you. For example, if you have configured a backup retention rate of “five”, only the last five backups will be stored within your storage provider.

Notifications For Failed Backups

You may provide an email address to be notified when a backup fails. If you need to notify multiple people, you should create a distribution list such as [email protected].

Forge will also display failed backups within the Backups panel of the Forge server’s management dashboard.

Managing Backups

Editing Backups

Existing backup configurations may be edited via the Forge UI. By default, the configuration details are locked to prevent accidental edits. You may click the Edit button to unlock editing.

When changing the databases that should be backed up, Forge will ask for confirmation that it was an intended change. This is to prevent any future data loss in the event that a database is no longer part of a backup configuration.

Deleting Backup Configurations

You can delete a backup configuration by clicking the Delete button next to your chosen backup configuration under the Backup Configurations section of the server’s Backups dashboard.

When deleting a backup configuration, your backup archives will not be removed from cloud storage. You may remove these manually if you wish.

Restoring Backups

You can restore backups to your database via the Recent Backups section. Click the Restore button next to your chosen backup. Backups will be restored to the database they were created from. If the backup configuration contains more than one database, you will be asked to select which database to restore.

If you need to restore a backup to another server or database you may download the backup archive from your cloud storage provider and restore it using a database management tool such as TablePlus.

Deleting Backups

If you need to delete an individual backup, you can do this by clicking the Delete button next to the backup.

When deleting a backup, your backup archives will be removed from your cloud storage provider. Please take caution when removing backups.

Backup Output

Each backup process will create its own log so that you can inspect the database backup process’s output in the event of a failure. You can view the output of a backup by clicking the “Eye” icon next to your backup.

Circle Permissions

The ability to manage database backups is split into two permissions.

  • server:create-backups
  • server:delete-backups