Backing up to the DigitalOcean is easier than ever with their S3 clone called “Spaces”. Spaces are essentially S3 buckets. Since it’s an S3 compatible service, you can use the existing Amazon S3 libraries. Unlike Amazon, Spaces is available for a flat fee of $5/mo for up to 250GB. Additional data is only $.02 per GB, making it a much more cost effective backup solution than Amazon S3 for heavy data users.
1. First of all, you’ll need to configure a Space in DigitalOcean and access keys. Follow this tutorial from DigitalOcean.
2. Install/enable backup and migrate module.
3. Download Amazon S3 library
From your site’s root directory:
git clone https://github.com/tpyo/amazon-s3-php-class.git sites/all/libraries/s3-php5-curl
4. Set up a new destination
- Destination name – This can be whatever you like. I call them “DO” for DigitalOcean
- Host – This is the “endpoint” in your DigitalOcean account. Usually looks like
sfo2.digitaloceanspaces.com. You can find it under your Space’s “settings” page.
- S3 Bucket – This is “unique name” you picked when you set up the Space
- Subdirectory – Optional. I’d recommend using the domain name of the site you’re backing up if you plan on having site backups in the same Space
- Access Key ID & Secret Access Key – These are the keys you generated earlier
- Click “Save destination”
5. Test your backup
Run a quick backup of the database:
Verify that the backup file shows in DigitalOcean
6. Create a new schedule
Schedule Name: Daily Backup (Up to you)
Settings Profile: Default
Basic setup is to Run using Drupal’s cron
Frequency is up to you for Backup every …
You can multiple backup schedules based on your needs. For example, back up the database daily but backup the files weekly.
Backup Destination: DO
I’d recommend using “Automatically delete old backups.” Select what’s appropriate based on your own needs.
DO allows for unlimited “spaces” (“buckets”). You can create additional “spaces” as needed for organizational purposes. You can also create unique access keys, but there’s no “space” level restriction so any API key can access any of the spaces right now. However, in practice, this page should be hidden from clients via permissions, so it’s likely not an issue, but be aware any key has access to any of the spaces in the account. This particular module will only write and delete files it has created.
The spaces can be to “private” mode so that anonymous users can’t access files without an API key, and folder listings are blocked so nobody can go snooping around.