selfprivacy.org/content/en/docs/Backups/_index.md

95 lines
4.5 KiB
Markdown
Raw Normal View History

2023-07-31 12:42:30 +00:00
---
title: "Backups"
linkTitle: "Backups"
date: 2023-07-31T
2024-04-08 01:41:59 +00:00
weight: 4
2023-07-31 12:42:30 +00:00
description: >
Backing up your services so that they are not lost
---
## Why backing up
When your service is broken but it worked yesterday you have two options:
* Spend some time reading logs and debugging what went wrong. Meanwhile the service is unusable and maybe some data is irreversibly lost;
* Restore the service to a working state and then debug at a more relaxed pace. Hopefully it was just a solar flare or a glitch in the Matrix.
2023-07-31 12:42:30 +00:00
This second, nerve-saving option is enabled by backing up regularly, and even better, automatically.
Having a backup simplifies the process of transferring a service between machines, ensuring minimal inconvenience.
This is useful if your datacenter is on fire, if your server provider gets bought out by another corporation, or when shareholders decide that it is finally time to make more profit.
2023-07-31 12:42:30 +00:00
2023-09-17 11:16:24 +00:00
This document covers the basic terms and usage of SelfPrivacy backup subsystem.
2023-07-31 12:42:30 +00:00
## What is a snapshot?
2023-09-17 11:16:24 +00:00
SelfPrivacy does not make backups of the whole machine.
2023-07-31 12:42:30 +00:00
Instead, it saves the states of each service.
The state of the files used by a service, taken at a certain time, is called a Snapshot.
In the interface, you can see that a snapshot has an ID, a service it backs up, and a date of creation.
2023-07-31 12:42:30 +00:00
## When backups occur?
A snapshot is created in 3 cases:
2023-07-31 12:42:30 +00:00
* By user's manual command to back up a service;
* Automatically at specified intervals if Automatic Backups are enabled;
* As a precaution before an inplace restore of a service.
2023-07-31 12:42:30 +00:00
## How the data is stored?
The service's files are stored at the cloud of the user's choice.
We currently support Backblaze, with more to come.
2023-07-31 12:42:30 +00:00
All of the service data is encrypted with a local secret that the cloud never receives.
Under the hood, we use Restic to transfer encrypted data.
Cloud storage providers, such as Backblaze, have an option to prevent immediate deletion of data.
2023-07-31 12:42:30 +00:00
2023-09-17 11:16:24 +00:00
SelfPrivacy app uses this option so that in case when the server is hacked the data cannot be erased.
2023-07-31 12:42:30 +00:00
## Listing snapshots
There are 2 factors to keep in mind when looking at the list:
* For the sake of performance, the list is cached. If some snapshots are missing which you think should be there, invalidate the cache so it reloads;
* If you delete some snapshots, they will be removed from the list, but for some limited time they are still restorable with the help of the cloud.
2023-07-31 12:42:30 +00:00
## Restoring a snapshot
Restoring a snapshot involves stopping the service and reverting all files to their state at the snapshot's creation. This process can be accomplished in two distinct ways.
2023-07-31 12:42:30 +00:00
The safest one, the default one, is to download the snapshot in its entirety, verify that data is not damaged, and replace the service files with the files from the snapshot.
However, this method requires additional storage space for the snapshot.
2023-07-31 12:42:30 +00:00
A somewhat riskier way is to overwrite the service files directly, without intermediate storage. It requires less space, but if the transfer goes wrong, you end up with a broken service.
To help reduce the impact, a snapshot is taken just before restoring.
2023-07-31 12:42:30 +00:00
The app does check that we have enough space before attempting a restore.
## Forgetting a snapshot
Forgetting makes the snapshot inaccessible from the server, but deletion itself is reversible from cloud UI for some time (30 days for Backblaze by default).
2023-07-31 12:42:30 +00:00
## Automatic Backup
If you set up an automatic backup period, all of the services will be backed up according to the set period.
2023-07-31 12:42:30 +00:00
Note that backups are independent per service. If you have services A and B backed up automatically every day in the morning, and then you back up service B manually at noon, then service A's next backup will be in the morning as usual, but B's backups will occur at noons.
If it is disabled, automatic backups will not be performed.
2023-07-31 12:42:30 +00:00
## Restoring after someone has deleted all the snapshots
* Go to your Backblaze/other cloud interface directly;
* Rewind the bucket to its previous state before the deletion event;
* Open SelfPrivacy app;
* Update the snapshot list;
* Restore from snapshots as usual.
2023-07-31 12:42:30 +00:00
## Troubleshooting backups
* If you suspect that the list of snapshots is incorrect, try updating the snapshot list;
* If an inplace restore has failed, make sure that your cloud is accessible and your contract is active. Then try to restore either a snapshot that you tried to restore or a pre-restore snapshot that was automatically generated;
* If you do not have enough space on the disk for a safe restore, try restoring inplace.