# HG changeset patch # User Sean E. Russell # Date 1589909961 18000 # Tue May 19 12:39:21 2020 -0500 # Node ID 83173ec37c7bf3f50ad06d232cd9cb1e163899fa # Parent 0000000000000000000000000000000000000000 Initial commit diff --git a/README.md b/README.md new file mode 100644 --- /dev/null +++ b/README.md @@ -0,0 +1,178 @@ +Backups with restic +=================== + +Backups with restic are pretty easy, but it may save someone some time if I document my configuration. + +This outlines how to set up backups to B2 (Backblaze) using restic. It isolates configuration data and credentials, and uses systemd for the scheduling. I'm not going to justify any of the decisions, except to say that Backblaze is a great service, and is both extremely cost effective and easy to use with restic, as restic has built-in support for it. + +At the end of this, you'll have *encrypted*, automated backups in the cloud. + +Dependencies +------------ + +- restic +- systemd +- A Backblaze account + + +Structure +--------- + +This is based on directory structures in Debian, which is what I have to use because my VPS provider doesn't support Arch. However, while untested, this should be the same for other systems with the same base packages. When you're done, the relevant file structure will look like this: + +- /etc/backup +- /etc/backup/environment +- /etc/backup/paths +- /lib/systemd/system/backup.service +- /lib/systemd/system/backup.timer +- /lib/systemd/system/backup-prune.service +- /lib/systemd/system/backup-prune.timer + + +Steps +----- + +### 1. Set up your Backblaze account + +You'll create an account, a bucket, and then an access key for the bucket. + +Visit [Backblaze](https://www.backblaze.com/) and create an account. Create a bucket for your backups a key for the bucket; I create a unique key for every server, to limit damage if one server is compromized. For the same reason, I also limit bucket access for each key to exactly one bucket. If you're using multiple buckets on one machine, re-using the key would make sense. + +Copy the account ID and access key from the key you create, as well as the name of the bucket. If you have multiple servers, each of these attributes will be unique as B2 assigns a unique ID and key for each bucket. + + +### 2. The configuration files + +```bash +sudo mkdir /var/cache/restic +sudo mkdir /etc/backup +sudo chmod 700 /etc/backup +``` + +Make sure that the `/etc/backup` directory is secured, as it will contain credentials. In my examples, you'll want to replace the IDs and keys with the ones from your account. + +```bash +cat <