Skip to content

Commit bb9dee5

Browse files
author
Romain de Laage
committed
Update docs to explain restore hooks feature and add a migration guide
1 parent 4375a38 commit bb9dee5

File tree

6 files changed

+86
-22
lines changed

6 files changed

+86
-22
lines changed

docs/markdown/_toc.md

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
>
4646
> [0.x → 1.0](/migration/0.x_1.0)
4747
> [1.4 → 1.5](/migration/1.4_1.5)
48+
> [1.7 → 1.8](/migration/1.7_1.8)
4849
4950
[Examples](/examples)
5051
[Docker](/docker)

docs/markdown/config.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ version: 2
5555
5656
extras:
5757
hooks: &foo
58-
before:
59-
- echo "Hello"
60-
after:
61-
- echo "kthxbye"
58+
backup:
59+
before:
60+
- echo "Hello"
61+
after:
62+
- echo "kthxbye"
6263
policies: &bar
6364
keep-daily: 14
6465
keep-weekly: 52

docs/markdown/examples.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ autorestic exec -b my-backend -- unlock
2222
extras:
2323
healthchecks: &healthchecks
2424
hooks:
25-
before:
26-
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Starting backup for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>/start'
27-
failure:
28-
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Backup failed for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>/fail'
29-
success:
30-
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Backup successful for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>'
25+
backup:
26+
before:
27+
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Starting backup for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>/start'
28+
failure:
29+
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Backup failed for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>/fail'
30+
success:
31+
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Backup successful for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>'
3132

3233
locations:
3334
something:

docs/markdown/location/hooks.md

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Hooks
22

3-
If you want to perform some commands before and/or after a backup, you can use hooks.
3+
If you want to perform some commands before and/or after a backup or restore, you can use hooks.
44

5-
They consist of a list of commands that will be executed in the same directory as the target `from`.
5+
They consist of a list of commands that will be executed in the same directory as the config file or in the `dir` directory if configured.
66

77
The following hooks groups are supported, none are required:
88

@@ -17,16 +17,27 @@ locations:
1717
from: /data
1818
to: my-backend
1919
hooks:
20-
before:
21-
- echo "One"
22-
- echo "Two"
23-
- echo "Three"
24-
after:
25-
- echo "Byte"
26-
failure:
27-
- echo "Something went wrong"
28-
success:
29-
- echo "Well done!"
20+
backup:
21+
before:
22+
- echo "One"
23+
- echo "Two"
24+
- echo "Three"
25+
after:
26+
- echo "Byte"
27+
failure:
28+
- echo "Something went wrong"
29+
success:
30+
- echo "Well done!"
31+
restore:
32+
dir: /var/www/html
33+
before:
34+
- echo "Let's restore this backup!"
35+
after:
36+
- echo "Finished to restore"
37+
failure:
38+
- echo "A problem has been encountered :("
39+
success:
40+
- echo "Successfully restored!"
3041
```
3142
3243
## Flowchart

docs/markdown/migration/1.7_1.8.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Migration from `1.7` to `1.8`
2+
3+
## ⚠️ Important notes
4+
5+
The way snapshots are referenced in the `restore` and `prune` commands has been changed. Before they were referenced by the path. Now every backup is tagged and those tags are then referenced in the cli. This means that when running restore and forget commands old backups are not taken into account anymore.
6+
7+
## Config files
8+
9+
- The config version have been changed
10+
- You can now configure restore hooks
11+
12+
See detailed instructions below.
13+
14+
## Config Version
15+
16+
The version field of the config file has been changed from `2` to `3`.
17+
18+
## Hooks
19+
20+
Since `1.8` both backup and restore hooks are possible.
21+
For this reason, backup hooks have been moved one layer deeper, you have to move them in a `backup` object.
22+
23+
Before:
24+
25+
```yaml
26+
locations:
27+
l1:
28+
# ...
29+
from: /foo/bar
30+
hooks:
31+
before:
32+
- pwd
33+
```
34+
35+
After:
36+
37+
```yaml
38+
locations:
39+
l1:
40+
# ...
41+
from: /foo/bar
42+
hooks:
43+
backup:
44+
before:
45+
- pwd
46+
restore:
47+
after:
48+
- echo "My super restore hook"
49+
```

docs/markdown/migration/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
- [From 0.x to 1.0](/migration/0.x_1.0)
44
- [From 1.4 to 1.5](/migration/1.4_1.5)
5+
- [From 1.7 to 1.8](/migration/1.7_1.8)

0 commit comments

Comments
 (0)