File tree 6 files changed +82
-22
lines changed
6 files changed +82
-22
lines changed Original file line number Diff line number Diff line change 45
45
>
46
46
> [ 0.x → 1.0] ( /migration/0.x_1.0 )
47
47
> [ 1.4 → 1.5] ( /migration/1.4_1.5 )
48
+ > [ 1.7 → 1.8] ( /migration/1.7_1.8 )
48
49
49
50
[ Examples] ( /examples )
50
51
[ Docker] ( /docker )
Original file line number Diff line number Diff line change @@ -55,10 +55,11 @@ version: 2
55
55
56
56
extras:
57
57
hooks: &foo
58
- before:
59
- - echo "Hello"
60
- after:
61
- - echo "kthxbye"
58
+ backup:
59
+ before:
60
+ - echo "Hello"
61
+ after:
62
+ - echo "kthxbye"
62
63
policies: &bar
63
64
keep-daily: 14
64
65
keep-weekly: 52
Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ autorestic exec -b my-backend -- unlock
22
22
extras :
23
23
healthchecks : &healthchecks
24
24
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>'
31
32
32
33
locations :
33
34
something :
Original file line number Diff line number Diff line change 1
1
# Hooks
2
2
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.
4
4
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 .
6
6
7
7
The following hooks groups are supported, none are required:
8
8
@@ -17,16 +17,27 @@ locations:
17
17
from : /data
18
18
to : my-backend
19
19
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!"
30
41
` ` `
31
42
32
43
## Flowchart
Original file line number Diff line number Diff line change
1
+ # Migration from ` 1.7 ` to ` 1.8 `
2
+
3
+ ## Config files
4
+
5
+ - The config version have been changed
6
+ - You can now configure restore hooks
7
+
8
+ See detailed instructions below.
9
+
10
+ ## Config Version
11
+
12
+ The version field of the config file has been changed from ` 2 ` to ` 3 ` .
13
+
14
+ ## Hooks
15
+
16
+ Since ` 1.8 ` both backup and restore hooks are possible.
17
+ For this reason, backup hooks have been moved one layer deeper, you have to move them in a ` backup ` object.
18
+
19
+ Before:
20
+
21
+ ``` yaml
22
+ locations :
23
+ l1 :
24
+ # ...
25
+ from : /foo/bar
26
+ hooks :
27
+ before :
28
+ - pwd
29
+ ` ` `
30
+
31
+ After:
32
+
33
+ ` ` ` yaml
34
+ locations :
35
+ l1 :
36
+ # ...
37
+ from : /foo/bar
38
+ hooks :
39
+ backup :
40
+ before :
41
+ - pwd
42
+ restore :
43
+ after :
44
+ - echo "My super restore hook"
45
+ ` ` `
Original file line number Diff line number Diff line change 2
2
3
3
- [ From 0.x to 1.0] ( /migration/0.x_1.0 )
4
4
- [ From 1.4 to 1.5] ( /migration/1.4_1.5 )
5
+ - [ From 1.7 to 1.8] ( /migration/1.7_1.8 )
You can’t perform that action at this time.
0 commit comments