To sustain this free service, we receive affiliate commissions via some of our links. This doesn’t affect rankings. Our review process.
Ever wondered how to set up automated, scheduled backups of your Drupal 6 database and files to Rackspace Cloud Files for safe storage? The process requires a bit of upfront time setting up the modules and configuring the backups, but once set up the backups will run automatically.
Rackspace Cloud Files
You’ll need to know your Rackspace Cloud Files username and API key. If you don’t have an API key yet, you can get it by logging into Rackspace Cloud Control Panel with your username and password. Then go to Your Account -> API Access and follow the instructions to generate an API key. Copy this key somewhere secure; you’ll need it when you set up the module on your Drupal site.
Install the Drupal Modules
Three modules will need to be installed on your Drupal site:
- Backup and Migrate – the parent module of the process,
- Backup and Migrate Rackspace Cloudfiles – allows for the transfer of the backups to Rackspace
- Backup and Migrate Files – necessary if you wish to back up file directories.
If you had already been using Backup and Migrate, make sure to upgrade to the most recent version of the module (which is 6.x-2.6 at the time of this write-up). Backup and Migrate does have associated user permissions; assign them to a high level user role.
Backup and Migrate Rackspace Cloudfiles requires that you download the Rackspace PHP wrapper (click on Downloads, then choose the button to download it as zip or tar.gz). Place the unzipped files in: sites/all/libraries/rackspace/php-cloudfiles
If you will be backing up file directories, the Archive_Tar PEAR extension will need to be enabled on your server, if it is not already. The readme.txt file contained in Backup and Migrate Files contains instructions on how to do this. In our hosting environment, it was easy to enable it in cPanel by going to PHP PEAR Packages. If Archive_Tar has already been enabled, you will see it under “Installed PHP Extension(s) and Application(s).” If not, click on “Show Available PHP Extension(s) and Application(s)” then in the list of extensions, click on the Install button for Archive_Tar.
Set up the Backups
The final stage of the process involves setting the Destinations, Profiles and Schedules for your backups. These options are found under the tabs at: /admin/content/ backup_migrate
Add Rackspace as a Destination
When installed, Backup and Migrate creates two destinations (and corresponding directories in your files directory): Manual and Scheduled. This is normally where backups that you run manually or on a schedule will be stored.
To have your backups uploaded to Rackspace Cloud Files instead, you will need to create a destination for Rackspace. Go to the Destination tab, and click on “Create a New Destination” and choose “Rackspace Cloudfiles.” At the next screen you will be asked for a destination name (for example, “Rackspace”), Cloudfiles Container (this is the Cloud Files equivalent of a directory; give the container a name like “my site backups”), your username and API key. Finally, you can customize the metadata associated with the uploaded files. Follow the instructions given on the page to create your own metadata elements. Save your destination and you will now see your new destination in the list. You will use this later when you set up your scheduled backup.
Create Destinations for File Backups
If you want to back up file directories (in addition to your database) you’ll have to do a little more work with destinations. The Backup and Migrate Files module also uses the Destinations tab, but for this module the Destinations tab is where you tell Drupal which file directories to include in a backup. When installed, the Backup and Migrate Files module creates a “Files Directory” destination for you. This destination will back up the files directory (or whatever directory you have set up as the Drupal files system path), and all subdirectories contained within it.
If there are other directories that you would like to have backed up, you will need to create additional file backup destinations. To do this, click on “Create a New Destination,” then click on “File Directory.” Give your destination a name (“my theme” for example) and then the Directory path (sites/all/themes/mytheme for example). Unfortunately, you cannot specify specific files to backup, only directories. Note that the instructions displayed under the Directory path field are completely irrelevant for setting up your file destinations, you can ignore them. Click on “Save Destination” and you’ll see your “my theme” destination in the list.
How to Backup Files that Live at the Root Directory
You’ll notice that when you set the Directory path when creating a new Destination, it assumes that the path begins with the root directory such as public_html or htdocs. This is a problem if you want to back up files that live at that the root, such as robots.txt or .htaccess (remember you cannot specify individual files to backup). This also means you will have to create several destinations and several scheduled backups if you want more than one top-level directory backed up. The workaround to this dilemma is to create a destination such as “public_html backup” and enter in the full directory path to your web files, such as: /home/mysite/public_html, this will grab the entire public_html directory, including files that live at the root of public_html. However, since this may include many files that don’t need to be backed up, the next step “Set up Profiles” will explain how to fine-tune your file backup by excluding unneeded directories.
Set Up Profiles
The Profiles tab allows you to further customize your backups. When Backup and Migrate is installed it creates a “Default Settings” profile that is usually sufficient. However, if you are backing up both your database and your files, you probably will want to create a profile for your files backup so that, at the very least, the files backup has a different name.
In addition, if there are any directories in the files destinations that you want to exclude, you do that with a new Profile. Click on “Create a new profile,” give the profile a name such as “public_html profile.” The next few fields dictate the name of the zipped backup file, you might want to add something such as “-files” to the backup name to differentiate it from the database backup. Appending a timestamp is a good idea. Towards the bottom of the screen you will see a familiar list of destinations, including ones that you created such as “public_html backup.” Click on the destination you want to customize and enter in the directories, one line at a time, that you want to exclude. For example, you may want to exclude the includes, modules, scripts and other Drupal core directories, keeping just your files and sites directories. When you use this profile to run the public_html backup, all of the directories, except the ones you listed, will be included.
Set Up Automated Scheduled Backups
The final step is to set up automated scheduled backups. Go to the Schedules tab and click on “Create a new schedule.” To back up your database to Rackspace, choose “Default Database” under Backup Source, “Default Settings” under Settings Profile and “Rackspace” under Destination. Choose how often you want to backup to run and click Save Schedule. To back up your files to Rackspace, create a new schedule and choose your files destination (such as “public_html backups”) under Backup Source, your custom profile (“public_html profile”) under Settings Profile and Rackspace under Destination. Choose how often you want to backup to run and click Save Schedule. Repeat these step for each files destination that you created above, if necessary.
Drupal will zip up the files (or database) into a compressed file, upload it to Rackspace and display a message informing you of the success or failed of your backup. That’s it!
Disclaimer: This website contains reviews, opinions and information regarding products and services manufactured or provided by third parties. We are not responsible in any way for such products and services, and nothing contained here should be construed as a guarantee of the functionality, utility, safety or reliability of any product or services reviewed or discussed. Please follow the directions provided by the manufacturer or service provider when using any product or service reviewed or discussed on this website.