General backup best practices
- Always back up the entire site before updating or upgrading. (It is also a good idea before migrating, copying, moving, or replacing.)
- Date your backups. Save each one into a directory or file with a title that includes the date of the backup. You do not want to be guessing which backup is the most recent one when you are trying to recover your failed site. Panic is not conducive to a good recovery process.
- Save a copy of each backup in a different location than your webserver. Remember, if the data doesn't exist in three places, it doesn't exist at all. If your webserver crashes, then all the backup files might be gone too (see earlier reference to panic).
- Inquire about your ISP or web host's backup policies. Most good web hosts have a backup plan that kicks in every 24 hours. If yours does not, it's up to you to back up your site daily, or find a host who will. It cannot be stressed enough that if a site's data does not exist in three places, it doesn't exist at all.
- In addition to your web host's backups, routinely do it yourself. Periodically run a separate backup monthly, weekly, daily or whatever fits your site's needs. Gauge the backup cycle by how much of your user's data you can afford to lose without all the users revolting and starting a riot. Even if you tell yourself, "It's no big deal", it is, and you do not want to lose content.
- Document and test your backup and restore procedure before you need it. The forum and gitter chat are full of people who want help recovering from some unforeseen fatal error, and if they knew how to restore their site using the backups, they'd created, they would be in business and making money rather than waiting for help from a Backdrop volunteer
Specific backup strategy
Backing up a Backdrop site involves backing up the sites's database and its files.
Backing up the database
The Backup and Migrate module allows you to download backups, or save backups on a schedule (though users should stay updated on any open, known issues). The sql-dump-sanitize script is an alternative, but requires cli access and knowledge. Both Backup and Migrate and sql-dump-sanatize can backup your database and file assets.
Backing up your files
The Backdrop source code itself that makes your site work its magic, is in the webroot of your sites server. If you are using version control like git you can use that as a backup of the source code of the site. Then you can make a separate backup of the sites file assets (BACKDROP_ROOT/files), using either Backup and Migrate, sql-dump-sanatize, or manually on the command line.
If you are not using git, then you will want to backup the source code and the file assets.