Skip to content

Commit 3033160

Browse files
committed
documentation
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent d747a41 commit 3033160

File tree

4 files changed

+164
-48
lines changed

4 files changed

+164
-48
lines changed

README.md

Lines changed: 164 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This App creates and stores backup images of your Nextcloud.
44

5+
_(documentation is still in writing)_
6+
57
- [Important notes](#notes)
68
- [Restoring Points](#restoring-point)
79
- [Hardware Requirement](#hardware)
@@ -10,6 +12,7 @@ This App creates and stores backup images of your Nextcloud.
1012
- [Important details about your data](#important)
1113
- [Upload to External Storages](#external-storages)
1214
- [AppData on External Storage](#external-appdata)
15+
- [Restoring a backup]($restoring)
1316
- [Available `occ` commands](#occ)
1417

1518
<a name="notes"></a>
@@ -19,8 +22,8 @@ This App creates and stores backup images of your Nextcloud.
1922
- **Read the full documentation**,
2023
- During the generation of the backup, the app will put your instance in `maintenance mode`,
2124
- This app generates a lot of data and can fill your hard drive,
22-
- By default **your data are encrypted**, meaning you **will need to export** the App configuration **as
23-
soon as possible** or you will **not** be able to **decrypt your backups**.
25+
- By default, **your data are encrypted** meaning you **will need to export** the configuration of the
26+
App **as soon as possible** or you will **not** be able to **decrypt your backups**.
2427

2528
<a name="restoring-point"></a>
2629

@@ -29,22 +32,22 @@ This App creates and stores backup images of your Nextcloud.
2932
A restoring point is an image of your Nextcloud at a specific time. A restoring point can be:
3033

3134
- '**Full**' (or Complete) and contains a backup of :
32-
* the instance of Nextcloud,
33-
* the apps of the Nextcloud (`apps/` and `custom_apps/`),
35+
* the instance of Nextcloud, its apps and `config/config.php`
3436
* A dump of the database,
3537
* the local folder defined as `data` of the Nextcloud.
3638

3739

3840
- '**Partial**' (or Incremental) that contains a backup of :
39-
* the instance of Nextcloud,
40-
* the apps of the Nextcloud,
41-
* A dump of the database,
42-
* local data that have been modified/generated since the last **Full Backup**
41+
* the instance of Nextcloud, its apps and `config/config.php`
42+
* A dump of the database,
43+
* local data that have been modified/generated since the last **Full Backup**
4344

4445
### What data are available in a Restoring Point
4546

46-
Please note that the **Backup App** will not store ALL data from your Nextcloud. As an example, remote
47-
files won't be stored.
47+
Let's first start with the fact that the **Backup App** will not store **ALL** data from your
48+
Nextcloud.
49+
As an example, remote files won't be stored.
50+
4851
This is a list of what can be restored and what cannot be restored when using the **Backup App**:
4952

5053
A restoring point will store
@@ -53,9 +56,9 @@ A restoring point will store
5356
- the configuration in `config/config.php`,
5457
- the `apps/` folder and any other `custom_apps/`
5558
- your local `data/`, defined by `'datadirectory'` in `config/config.php`,
56-
- original absolute paths,
57-
- A full `sqldump` of your database,
58-
- List of files and localisation within the backup.
59+
- a full `sqldump` of your database,
60+
- list of files and localisation within the backup,
61+
- metadata about the instance.
5962

6063
A restoring point will **NOT** store:
6164

@@ -69,14 +72,15 @@ backup:
6972
- Version of your Nextcloud,
7073
- The ID of the parent backup in case of partial backup,
7174
- The list of data file that compose the restoring point, the format for this data depends on the current
72-
status of the restoring point (packed/unpacked) and the settings (compression, encryption)
73-
- Checksum for each files of the backup itself,
75+
status of the restoring point (packed/unpacked) and the settings (compression, encryption),
76+
- Absolute paths for each data file,
77+
- Checksum for each file of the backup itself,
7478
- The date of the restoring point,
7579
- Comments,
7680
- Information related to the health of the files during the last check.
7781

78-
While the file `restoring-point.data` confirm the integrity of all files and parts of the backup, it is
79-
still possible to generate a restoring point based on the available files. However :
82+
While the file `restoring-point.data` is require to confirm the integrity of all files and parts of the
83+
backup, it is still possible to generate a restoring point based on the available files. However :
8084

8185
- there is no way to confirm the integrity of the restoring point,
8286
- the restoring process will require some knowledge from the admin about the original infrastructure from
@@ -86,8 +90,7 @@ still possible to generate a restoring point based on the available files. Howev
8690

8791
- Upload the files of your restoring point on your instance of Nextcloud with the Backup App installed,
8892
in a **specific** folder in your Files.
89-
- At the root of this **specific** folder, create a file named `restoring-point.data` and add this
90-
content inside:
93+
- At the root of this **specific** folder, create a file named `restoring-point.data` with this content:
9194

9295
{"action": "generate", "id": "20211023234222-full-TFTBQewCEdcQ3cS"}
9396

@@ -122,22 +125,20 @@ itself.
122125

123126
### The timing
124127

125-
126128
From the **Admin Settings**/**Backup** page, you can configure the time slot and the rate for the
127129
generation of your future backups.
128130

129131
![Settings Schedule](screenshots/settings_schedule.png)
130132

131-
132133
The time slot define the time of the day the Backup App might generate a backup, it is based on the local
133134
time on the server.
134135

135136
Keep in mind that your instance will be in `maintenance mode` for the duration of the generation of the
136137
backup. This is the reason why, by default, **Full Backup** will only be started during the week-end,
137138
while **Partial Backup** are also run during week days.
138139

139-
If you scroll down to the bottom of this page, you can have an estimation of the next backup based on
140-
your settings:
140+
If you scroll down to the bottom of this page, you can have an estimation of the date for your next
141+
backup based on your settings:
141142

142143
![Settings Next Point](screenshots/settings_next_point.png)
143144

@@ -157,32 +158,41 @@ By default, the `appdata` folder of the Backup App is located in the same folder
157158
data of your instance defined in `datadirectory`. It is estimated that the `Backup App` needs 65% of the
158159
available diskspace of the `datadirectory`
159160

160-
In case there is no enough space, you can [#external-appdata](mount an External Storage) and move
161+
In case there is not enough space, you can [#external-appdata](mount an External Storage) and move
161162
the `appdata` folder of the **Backup app** there.
162163

163164
### The second pass (the packing process)
164165

165-
![Settings Packing](screenshots/settings_packing.png)
166-
167166
The second pass does not require to put your instance in `maintenance mode`. The 2nd pass consist in the
168167
packing of the restoring point and eventually its upload on external storage.
169168

169+
You can configure the type of packing in the Admin Settings of the app
170+
171+
![Settings Packing](screenshots/settings_packing.png)
172+
170173
The packing will list each `chunk` of your backup and:
171174

172175
- Compress them (if enabled),
173176
- Split the result in multiple files (named `part`) of 100MB,
174177
- Encrypt each `part` (if enabled),
175178
- Once completed without issue, remove the original zip file of the `chunk` to free space.
176179

177-
<a name="export"></a>
180+
181+
<a name="handle-external-storages"></a>
178182

179183
### Storing on a different hard drive
180184

181-
![Settings External](screenshots/settings_upload.png)
185+
Once packed, restoring points can be stored on a different location. Locally or remotely.
182186

183-
Once packed, restoring points can be stored on a different hard drive. Locally or remotely.
184-
If [enabled and configured](#upload-to-external-storages), the Backup App will store and manage your
185-
restoring points on the **External Storage**
187+
if [configured](#external-storages), the Backup App will start storing your restoring points externally,
188+
and check their integrity every day.
189+
190+
The uploading process will check that each `part` of the packed restoring point are healthy, based on the
191+
checksum stored in the `metadata` file and will retry to upload any faulty `part`.
192+
On top of that, the data itself from the `metadata` file are signed, making the Backup App able to
193+
confirm the full integrity of the backup.
194+
195+
<a name="export"></a>
186196

187197
## Exporting your configuration
188198

@@ -221,6 +231,25 @@ restoring points on the **External Storage**
221231

222232
## Upload to External Storages
223233

234+
Uploading your packed restoring point on one (or multiple) external storages is the perfect solution when
235+
facing a huge loss of data from your disk whether it is of human or hardware origin.
236+
237+
Those external data are [fully managed](#handle-external-storages) by the app itself.
238+
239+
The configuration is done in 2 steps:
240+
241+
- The first step is to setup a folder from the **External Storage** Settings Page, it is strongly adviced
242+
to limit the availability of the folder to the `admin` group only,
243+
244+
![Settings External](screenshots/settings_external_store.png)
245+
246+
- the second step is done in the **Backup** Settings Page, the configured External Storage should be
247+
displayed in the listing of available storage location,
248+
249+
![Settings External](screenshots/settings_external_folder.png)
250+
251+
- set the path where your backup files will be stored.
252+
224253
<a name="external-appdata"></a>
225254

226255
## AppData on External Storage
@@ -237,6 +266,93 @@ its data:
237266
run `./occ backup:external:appdata` and follow instruction to select the configured external storage, and
238267
configure the path to the right folder.
239268

269+
<a name="restoring"></a>
270+
271+
## Restoring a backup
272+
273+
You can restore a single file or the whole instance to a previous state:
274+
275+
./occ backup:point:restore <pointId> [--file <filename>] [--data <dataPack>] [--chunk chunkName]
276+
277+
Please note that you can go back to a previous backup of your instance from any Nextcloud compatible with
278+
the Backup App. There is no need to install the exact same version as it will be reverted to the one used
279+
when creating the Restoring Point. Meaning that you can fully restore your instance of Nextcloud even if
280+
you lost your harddrive, as long as you kept a copy of the Restoring Point (upload to another remote
281+
instance)
282+
283+
- install nextcloud compatible with the Backup App,
284+
- ./occ app:enable backup
285+
- if the backup are encrypted (or to confirm integrity of files): `./occ backup:setup:
286+
import [--key <key>] < ~/backup_setup
287+
- if the backup are on an external storage:
288+
* `./occ app:enable files_external`
289+
* add the [external storage](#upload-to-external-storages)
290+
* `./occ backup:external:add` and follow instruction, add the path to the backup you want to reach
291+
* you should be able to see the restoring point the external storage
292+
- `./occ backup:point:list`
293+
294+
```
295+
$ ./occ backup:point:list
296+
- retreiving data from local
297+
- retreiving data from external:3
298+
> found RestoringPoint 20211031232710-full-Tu4H6vOtxKoLLb9
299+
> found RestoringPoint 20211101014009-full-QeTziynggIuaaD2
300+
+---------------------------------------+---------------------+--------+---------+-----------------------------+------------+--------------+--+
301+
| Restoring Point | Date | Parent | Comment | Status | Instance | Health | |
302+
+---------------------------------------+---------------------+--------+---------+-----------------------------+------------+--------------+--+
303+
| A 20211031232710-full-Tu4H6vOtxKoLLb9 | 2021-10-31 23:27:10 | | beta2 | packed,compressed,encrypted | external:3 | 12H, 23M ago | |
304+
| 20211101014009-full-QeTziynggIuaaD2 | 2021-11-01 01:40:09 | | | packed,compressed,encrypted | external:3 | 10H, 53M ago | |
305+
+---------------------------------------+---------------------+--------+---------+-----------------------------+------------+--------------+--+
306+
```
307+
308+
* download the restoring point
309+
310+
```
311+
$ ./occ backup:point:download --external 3 20211031232710-full-Tu4H6vOtxKoLLb9
312+
> downloading metadata
313+
check health status: 0 correct, 43 missing and 0 faulty files
314+
* Downloading data/data-0540e4d6-9d7f-4c84-a8d8-ca40764257d1/00001-B57XWKJQe5Xg1sd: ok
315+
* Downloading data/data-0540e4d6-9d7f-4c84-a8d8-ca40764257d1/00002-PXHPeS6t6OXFwkP: ok
316+
[...]
317+
```
318+
319+
* unpack the restoring point
320+
321+
```
322+
$ ./occ backup:point:unpack 20211031232710-full-Tu4H6vOtxKoLLb9
323+
Unpacking Restoring Point 20211031232710-full-Tu4H6vOtxKoLLb9
324+
> lock and set status to unpacking
325+
> Browsing RestoringData data
326+
> Unpacking RestoringChunk data-0540e4d6-9d7f-4c84-a8d8-ca40764257d1: proceeding
327+
* copying parts to temp files
328+
- 00001-B57XWKJQe5Xg1sd: /tmp/phpNnYCbZ
329+
- 00002-PXHPeS6t6OXFwkP: /tmp/phpYqRSPW
330+
[...]
331+
```
332+
333+
* for each data pack, you will be prompt to choose the location of the extraction.
334+
* If a sqldump is available, you will be prompt to use the current configuration from the instance, or
335+
use another database
336+
337+
* if the information from the file `config/config.php` are in conflict with the path or sql settings
338+
specified during the extraction, you will be notified that the restoring process wants to update
339+
them.
340+
341+
```
342+
$ ./occ backup:point:restore 20211031232710-full-Tu4H6vOtxKoLLb9
343+
Restoring Point: 20211031232710-full-Tu4H6vOtxKoLLb9
344+
Date: 2021-10-31 23:27:10
345+
Checking Health status: ok
346+
347+
348+
WARNING! You are about to initiate the complete restoration of your instance!
349+
All data generated since the creation of the selected backup will be lost...
350+
351+
Your instance will come back to a previous state from 13 hours, 17 minutes and 48 seconds ago.
352+
353+
Do you really want to continue this operation ? (y/N)
354+
```
355+
240356
<a name="occ"></a>
241357

242358
## Available `occ` commands:
@@ -332,18 +448,6 @@ appdata folder: data/appdata_qwerty123/backup/
332448

333449
./occ backup:point:details <pointId>
334450

335-
## Restoration
336-
337-
You can restore a single file or the whole instance to a previous state:
338-
339-
./occ backup:point:restore <pointId> [--file <filename>] [--data <dataPack>] [--chunk chunkName]
340-
341-
Please note that you can go back to a previous backup of your instance from any Nextcloud compatible with
342-
the Backup App. There is no need to install the exact same version as it will be reverted to the one used
343-
when creating the Restoring Point. Meaning that you can fully restore your instance of Nextcloud even if
344-
you lost your harddrive, as long as you kept a copy of the Restoring Point (upload to another remote
345-
instance)
346-
347451
## Exporting configuration
348452

349453
This is an important step of your configuration of the Backup App Some information will be needed in case
@@ -365,12 +469,24 @@ generated during the export of your setup needs to be stored somewhere safe!
365469

366470
./occ backup:setup:import [--key <key>] < ~/backup_setup.json
367471

472+
## Questions ?
473+
474+
**- Can the app be used to migrate an instance of Nextcloud ?**
368475

476+
Yes, during the restoration you can change the absolute path of your files and the configuration relative
477+
to the database.
478+
No, you cannot switch the type of the database server (mysql, postgres, ...).
369479

370-
### Known issues, because _beta_:
480+
However, the app should not be used to duplicate setup in production as each instance will be fully
481+
identical (`instanceid`, ...).
371482

372-
* custom_apps are not included in the backup.
373-
* Zip's integrity are not checked during unpack, might result in a lose of data when decrypting with the wrong key when restoring a backup with lost metadata file.
374-
* When removed from the files_external, an external storage will not be removed from the backup app's list of external folder
375-
* When restoring in another database, the process will fail if the database does not exist.
483+
## Known issues, because _beta_:
376484

485+
* custom_apps are not included in the backup.
486+
* Zip's integrity are not checked during unpack, might result in a lose of data when decrypting with the
487+
wrong key when restoring a backup with lost metadata file.
488+
* When removed from the files_external, an external storage will not be removed from the backup app's
489+
list of external folder
490+
* When restoring in another database, the process will fail if the database does not exist.
491+
* When adding a new external storage from the files_external, the folder needs to be mounted using the
492+
Files App. Browsing the root folder should be enough.
17.3 KB
Loading
38.6 KB
Loading

screenshots/settings_upload.png

-32 KB
Binary file not shown.

0 commit comments

Comments
 (0)