Files
wiki/Backups.md

53 lines
2.7 KiB
Markdown

---
title: Backups
description: What is backed up? Where is it backed up? look here!
published: true
date: 2022-04-30T20:10:24.250Z
tags: maintanence, backup
editor: markdown
dateCreated: 2021-09-02T08:29:45.542Z
---
I use several methods of backup to keep important data stowed away. Below is an outline of what is backed up and how.
> Local Backups are transitioning to Seafile - in progress!
{.info}
# Cloud Backups
The first and most reliable form of backup is a [Restic](https://restic.net/) repository stored on [Backblaze B2](https://secure.backblaze.com/b2_buckets.htm).
Three things are currently backed up with B2:
1. Photos (Path: `/Red-Vol/Media/Pictures`, Bucket: `Gerbil-TK`)
2. Containers (Path: `/Red-Vol/Media/Containers`, Bucket: `Gerbil-TK-Containers`)
3. Cloud Data gathered using Synching (Path: `/Red-Vol/Media/Cloud/Syncthing/`, Bucket: `Pukeko-XYZ-Cloud`)
Backups run on a cron job which executes the following commands:
- `restic -r b2:Gerbil-TK backup /Red-Vol/Media/Pictures/ --exclude='*סתם*' --exclude='2021' --exclude='Photos from *'` for photos.
- `restic -r b2:Gerbil-TK-Containers backup --exclude=“photoprism” --exclude=“transmission” --exclude=“jekyll” --exclude=“minecraftserver” /Red-Vol/Media/Containers` for Docker containers.
- `restic -r b2:Pukeko-XYZ-Cloud backup /Red-Vol/Media/Cloud/Syncthing/`
## Important Points
- Photoprism pictures are not backed up as their source directories are already backed up.
- `/home` is backed up under the Cloud backup.
- Anything crucial is expected to be backed up via Syncthing, and from there to B2.
- Containers back up their data, which is always contained in their directory by convention. They are also another copy of the [Docker Git repository](https://git.gerbil.tk/shmick/docker).
## B2 Cloud Points
- When first creating a new bucket, it needs to be initialized with Restic by running `restic init`.
> Example:
`restic -r b2:Pukeko-XYZ-Cloud init`
{.info}
> The password is read from the `RESTIC_PASSWORD` environment variable set in the `zprofile`. It is also stored in the [BitWarden password manager](https://vault.pukeko.xyz).
{.warning}
- Bucket names are globally unique and cannot be changed once created (as far as I'm aware).
- When creating a new bucket, set it to be as basic as possible - no object locks, no encryption, no snapshots - Restic handles all of these things.
# Local Backups
Local backups are done using [Syncthing](https://sync.pukeko.xyz), a decenteralized sync engine. Syncthing provides encrypted, delta-aware backups, and is very granular - what is uploaded and where is set by each client. Sync can also be configured as single direction (send-only or receive-only).
By convention, every backup is placed under `/Red-Vol/Media/Cloud/Syncthing/[user]`.