Add a tutorial

This commit is contained in:
Quentin 2021-04-28 15:22:29 +02:00
parent 81bf5405e7
commit 39282224cc
Signed by: quentin
GPG key ID: A98E9B769E4FF428

View file

@ -17,11 +17,71 @@ Create a backup before running any command and double check all your operations.
## Installation
As a pre-requesite, you need a recent version of [Go](golang.org/).
```
go get git.deuxfleurs.fr/quentin/seafile_recovery
~/go/bin/seafile_recovery --help
```
## Tutorial
Let's suppose you start by knowing nothing about your storage folder and its repositories,
start by picking one repository ID in the `storage/commits` folder and run the `head` subcommand. For our example,
we will use `0011d396-4890-463a-8266-bcbd978d8d1c`.
```
$ seafile_recovery head 0011d396-4890-463a-8266-bcbd978d8d1c
2021/04/28 15:10:34 Repo contains 6 commits
2021/04/28 15:10:34 Repo has 1 sources
2021/04/28 15:10:34 Repo has 1 sinks
2021/04/28 15:10:34 Proposing following HEAD:
RootId: 5911dd2d363f591e43df4e80591d0a54975f2aaf
CreatorName: quentin@example.com
Creator: 0000000000000000000000000000000000000000
Description: Added "telecom-reclaimed-web-single-page.pdf".
Ctime: 2021-04-26 12:22:59 +0200 CEST
RepoName: Ma bibliothèque
RepoDesc: Ma bibliothèque
```
We know learnt some information about the repository, especially its name ("Ma bibliothèque"), who did the last change ("quentin@example.com") and the RootId ("5911dd2d363f591e43df4e80591d0a54975f2aaf").
We can now explore its last file hierarchy thanks to the RootId (we can only copy a part of the Id to keep the command more readable):
```
$ seafile_recovery ls 0011d396-4890-463a-8266-bcbd978d8d1c --dir=5911dd2
2021/04/28 15:15:40 5911dd /
2021/04/28 15:15:40 b88ab9 /seafile-tutorial.doc
2021/04/28 15:15:40 d24616 /Capture décran de 2021-04-11 23-07-31.png
2021/04/28 15:15:40 f123de /My Folder/
2021/04/28 15:15:40 15be4d /My Folder/telecom-reclaimed-web-single-page.pdf
2021/04/28 15:15:40 380a0e /My Folder/Capture décran vidéo de 19-12-2020 10:30:15.webm
2021/04/28 15:15:40 Total size: 25.6M
```
Now, let's suppose I want to extract the folder "My Folder" and its content and put it in a folder named `out`:
```
$ ~/go/bin/seafile_recovery cp 0011d396-4890-463a-8266-bcbd978d8d1c --dir=f123de ./out
2021/04/28 15:17:28 f123de /
2021/04/28 15:17:28 15be4d /telecom-reclaimed-web-single-page.pdf
2021/04/28 15:17:28 380a0e /Capture décran vidéo de 19-12-2020 10:30:15.webm
$ ls out/
'Capture décran vidéo de 19-12-2020 10:30:15.webm' telecom-reclaimed-web-single-page.pdf
```
Finally, if I prefer to upload this content directly on a S3 bucket, you can do:
```
$ ~/go/bin/seafile_recovery cp 0011d396-4890-463a-8266-bcbd978d8d1c --dir=f123de s3://ACCESS_KEY:SECRET_KEY@ENDPOINT/REGION/BUCKET[/PREFIX]
2021/04/28 15:17:28 f123de /
2021/04/28 15:17:28 15be4d /telecom-reclaimed-web-single-page.pdf
2021/04/28 15:17:28 380a0e /Capture décran vidéo de 19-12-2020 10:30:15.webm
```
**Be careful !** This tool is not intended to change your seafile backend from local filesystem to the S3 backend. Migrating to the S3 backend implies to keep Seafile's objects which is a totally different job. Appropriate scripts are available from Seafile's official distribution.
## Usage
```
@ -44,7 +104,6 @@ Options:
## Seafile on-disk storage
```
storage/commits/(repoid) storage/fs/(repoid) storage/blocks/(repoid)
(plain text json) (json + zlib) (chunk of raw data)
@ -72,8 +131,6 @@ Initial│69/ca6b5..├──────────? └────
X no parent
```
## Tutorial
----