Tips for web professionals

How to backup your website

Backup best practices part 2! Today we’re going to touch on different precuations to take when backing up your website. And remember the golden rule of backups: 3-2-1. Three backups, two mediums, one off-site. This principle also applies for backing up a website on Gandi’s Simple Hosting.

Activate snapshots on Simple Hosting

A snapshot is literally that—a snapshot at a particular moment of the files on your Simple Hosting instance. In a way, it’s a photo taken at a given moment in order to fix a version of it in your data. To activate Snapshots on your Simple Hosting instance, navigate to your Simple Hosting instance’s administration page, select your instance, and click “Activate” on the Snapshots tab. The option is free, and lets you save previous states of your files. Once the option is activated, four snapshots are saved:

  • A daily snapshot saved for 24 hours
  • A daily snapshot saved for 48 hours
  • A weekly snapshot saved for 7 days
  • A weekly snapshot saved for 14 days

Snapshots are not by themselves a complete backup strategy, but are only a part of one. They are especially useful in the case of a mistake that you want to “undo”. However, snapshots are stored locally on your Simple Hosting instance—they therefore take up disk space and do not ensure enough redundancy to be a sufficient backup. For that, you’ll need to make a complete copy of your files AND your database outside of your Simple Hosting instance.

Export your MySQL database

For a MySQL database, mostly used for some of the main CMS platforms (WordPress, Prestashop, etc.), it’s possible to perform a complete export of your database using the tool PhpMyAdmin, accessible in the admin interface of your Simple Hosting instance. Once connected via PhpMyAdmin, the tab “Export” lets you choose the name nad format of the export of your database. It will generate a file with all of the information contained in your database at a given moment. It’s also possible to perform this operation online via a command line from your emergency console. We’ve outlined this procedure on our online documentation.

Automate your database export with Anacron

You can also schedule regular exports of your database using a tool integrated into your Simple Hosting instance called Anacron. This tool will create a “dump” of your database that then gets included in your snapshots. Previously, you needed to connect via sFTP to modify your “anacrontab” file. The good news is that you can now edit this file from your Simple Hosting control panel. To modify this file from your control panel, click on “Edit scheduled tasks” under “Cron.” To implement a regular export of the database, just follow the instructions on our online documentation.

Export files locally

Keeping with the spirit of the 3-2-1 rule, don’t forget to regularly copy your files locally on your PC, including the database export file, your snapshot file, or even all of your files in order to keep a complete copy of your hosting in a separate environment. For that, you just need to connect via sFTP using FileZilla for example, and download your files (you can find more information about that here). That way, your backup is optimized—you’ll have a complete, local copy of your files outside of your Simple Hosting instance. This will help you quickly get started again if there’s ever a problem on your hosting, or you forget to renew your instance.