Compare commits

...

317 Commits
0.28 ... master

Author SHA1 Message Date
Nicco 62a81d1420
add blog post to community page :) 2024-05-17 19:23:54 +02:00
Nicco e4b33cad1f
version bump 2024-03-28 09:29:39 +01:00
Tucker Kern a82273ec13
Allow REST backend with docker volumes (#366) 2024-03-27 20:20:13 +01:00
dependabot[bot] 2418da5636
Bump gopkg.in/yaml.v3 from 3.0.0-20210107192922-496545a6307b to 3.0.0 (#363)
Bumps gopkg.in/yaml.v3 from 3.0.0-20210107192922-496545a6307b to 3.0.0.

---
updated-dependencies:
- dependency-name: gopkg.in/yaml.v3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 22:47:08 +01:00
dependabot[bot] 7508df7d66
Bump katex from 0.16.8 to 0.16.10 in /docs (#364)
Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.16.8 to 0.16.10.
- [Release notes](https://github.com/KaTeX/KaTeX/releases)
- [Changelog](https://github.com/KaTeX/KaTeX/blob/main/CHANGELOG.md)
- [Commits](https://github.com/KaTeX/KaTeX/compare/v0.16.8...v0.16.10)

---
updated-dependencies:
- dependency-name: katex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-25 22:46:58 +01:00
Nicco 6e34196220
Update config.go 2024-03-13 12:40:11 +01:00
Florian dc56911a45
fix(unlock cmd): ignore process if its the current id (#360) 2024-03-13 12:39:51 +01:00
Nicco edb3ba35d8
Update config.go 2024-03-12 15:27:11 +01:00
Florian 12f6143bb4
fix: cli command to unlock the autorestic running value (#329)
* fix: cli command to unlock the autorestic running value

* fix(unlock cmd): get user confirmation in case an instance is still running

* fix(cmd unlock): add force flag
2024-03-12 15:26:12 +01:00
Pete a6bf1d1408
fix relative path to options forget (#331)
/location/options/forget instead of /location/forget.
2024-03-12 15:24:25 +01:00
Stuart Hickinbottom 13aa560fda
Add PreValidate hook (#359)
Fix #332.

This adds a new "PreValidate" hook that is executed before checking
the backup location. This allows, for example, mounting a remote
source to make the directories of the location available.

"PreValidate" is added as a new hook to avoid any breakage that might
have been caused by changing the behaviour of the "before" hook.

Documentataion updates included.
2024-03-12 15:22:43 +01:00
Romain de Laage bbb1c85cad
Fix upgrade command (#259)
fix #191

Co-authored-by: Romain de Laage <romain.delaage@rdelaage.ovh>
2024-02-15 14:27:37 +01:00
Natanel Shitrit 4cc44315ab
feat: add `docker-cli` package (#339)
Co-authored-by: Nicco <hi@nicco.io>
2024-02-15 14:26:26 +01:00
dependabot[bot] b3440cd87c
Bump golang from 1.21-alpine to 1.22-alpine (#355)
Bumps golang from 1.21-alpine to 1.22-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-15 14:24:17 +01:00
Romain de Laage 4848702929
Use options on exec command (#253)
Co-authored-by: Romain de Laage <romain.delaage@rdelaage.ovh>
2024-02-15 14:23:43 +01:00
Nicco b5604b8b9f
update deps (#353) 2024-02-09 14:18:24 +01:00
Alexander Zhang 24220f6b62
Fix broken link in docs (#350) 2024-02-09 14:18:06 +01:00
Niccolo Borgioli ced20801c1
bump version 2024-01-11 19:17:53 +01:00
Christoph Loy ce9140fa1e
Fix handling of `XDG_CONFIG_HOME` (#347) 2024-01-11 19:01:59 +01:00
Matthias Liffers 046c79fd15
Add curl to docker image (#344) 2024-01-11 18:56:35 +01:00
Skye J f8603425d1
Update installation.md to add AUR back (#348)
I have been maintaining the AUR package, so it is no longer deprecated.
2024-01-11 18:52:23 +01:00
Niccolo Borgioli 068121d722
adjust base url 2023-10-11 21:50:43 +02:00
Nicco 8eea7d33f8
delete old docs (#327)
* delete old docs

* new docs
2023-10-08 19:24:04 +02:00
Vladimir Mikryukov fc8b5fdbe2
fix typos in `cron.md` (#316) 2023-10-02 14:10:51 +02:00
Christoph Loy f67bb7f73c
Bump version to 1.7.9 (#325) 2023-10-02 14:09:34 +02:00
Christoph Loy 530b1b646c
Update restic to 0.16.0 (#324) 2023-10-02 11:08:28 +02:00
Major Hayden 3b57602fe8
Docs: Add Fedora installation choice (#320)
Fedora now has an autorestic package and users can install it directly
from Fedora's repositories.

Signed-off-by: Major Hayden <major@mhtx.net>
2023-08-01 13:10:12 +02:00
Mikel Olasagasti Uranga 045513234f
Use Printf instead of Println (#318)
Testing in Fedora reports:

./root.go:58:4: (*github.com/fatih/color.Color).Println call has
possible Printf formatting directive %s
2023-07-31 10:03:18 +02:00
dependabot[bot] 78b0db50e0
Bump webpack from 5.75.0 to 5.76.1 in /docs/.codedoc (#295)
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-22 15:25:32 +01:00
dependabot[bot] 62dd371d51
Bump webpack from 5.75.0 to 5.76.1 in /docs (#296)
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.76.1)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-22 15:25:20 +01:00
dependabot[bot] 08766b75db
Bump prismjs from 1.23.0 to 1.29.0 in /docs/.codedoc (#269)
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.23.0 to 1.29.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.23.0...v1.29.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-22 15:25:05 +01:00
cupcakearmy b3b7c8df95
update versions 2023-03-05 17:52:40 +01:00
cupcakearmy 2c5266c9a0
fix build system 2023-03-05 17:22:03 +01:00
Nicco 087b293c39
version bump 2023-03-02 15:03:57 +01:00
Andreas 112a69d743
Allow env variables in path for rest backend (#280) 2023-03-02 15:00:39 +01:00
dependabot[bot] 37d55c691f
Bump golang.org/x/text from 0.3.7 to 0.3.8 (#289)
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.3.7 to 0.3.8.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.3.7...v0.3.8)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-01 20:22:18 +01:00
dependabot[bot] 715b6f791c
Bump golang from 1.19-alpine to 1.20-alpine (#287)
Bumps golang from 1.19-alpine to 1.20-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-01 20:22:07 +01:00
dependabot[bot] 38b38c6805
Bump restic/restic from 0.15.0 to 0.15.1 (#286)
Bumps restic/restic from 0.15.0 to 0.15.1.

---
updated-dependencies:
- dependency-name: restic/restic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-01 20:21:49 +01:00
Nicco c82db56069
Update config.go 2023-01-19 09:44:05 +01:00
cupcakearmy 27821dc3ef
changelog 2023-01-18 22:45:46 +01:00
cupcakearmy 866975d32d
update deps 2023-01-18 22:43:56 +01:00
dependabot[bot] 955ac0e323
Bump restic/restic from 0.14.0 to 0.15.0 (#283)
Bumps restic/restic from 0.14.0 to 0.15.0.

---
updated-dependencies:
- dependency-name: restic/restic
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-18 22:39:38 +01:00
Mariusz Kozakowski 1512db5b55
Fix regexp for AddedExtractor (#284)
Co-authored-by: mariom <11mariom@gmail.com>
2023-01-18 22:39:12 +01:00
dependabot[bot] 046331748c
Bump golang from 1.18-alpine to 1.19-alpine (#268)
Bumps golang from 1.18-alpine to 1.19-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 17:31:54 +01:00
cupcakearmy 72a40eaaa2
update deps 2022-12-09 17:29:07 +01:00
cupcakearmy ec61effe22
Merge branch 'master' of https://github.com/cupcakearmy/autorestic 2022-12-09 17:24:07 +01:00
cupcakearmy d6acab94a5
use restic as base image 2022-12-09 17:24:03 +01:00
Daniel Brennand d0d2fcf0f2
docs: add `dbrennand.autorestic` role (#250) 2022-10-29 21:32:48 +02:00
Nicco 58fd41fafb
consistent casing (#247) 2022-10-18 16:23:27 +02:00
Šimon Woidig d0c4a32879
Update install.sh (#246)
Add check for bzip2 command existance
2022-10-18 16:17:35 +02:00
Nicco 74979e9a2a
Update config.go 2022-10-17 15:03:17 +02:00
Romain de Laage 3732dcf6ff
Check for errors on forget after having backuped (#241) 2022-10-17 15:02:47 +02:00
Andreas Wagner 874ed52e3b
add more architectures for linux build process (#243)
* add more architectures for linux build process

equivalent to 7d665fa1f4/helpers/build-release-binaries/main.go

* add solaris and s390x

Co-authored-by: Nicco <hi@nicco.io>
2022-10-06 15:41:01 +01:00
Nicco 4d9a2b828e
Update config.go 2022-09-13 15:16:21 +02:00
Chosto b830667264
Use options when calling check or init (#199) 2022-09-13 15:15:02 +02:00
John Burkhardt 83eeb847ac
Add command line flag to override docker image. (#233) 2022-09-13 15:04:12 +02:00
shahvirb a89ba5a40a
Update forget.md keep-within argument to be '14d' (#236)
keep-within duration can only have units 'y', 'm', 'd', and 'h'. The current documentation of '2w' yields:
```invalid argument "2w" for "--keep-within" flag: invalid unit 'w' found after number 2```

https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy
2022-09-13 14:59:46 +02:00
Romain de Laage 6990bf6adc
Check for errors and forward on exec command (#227)
fix #226
2022-08-26 17:09:26 +02:00
Romain de Laage 2f407cf211
Add forget for copy backend (#223)
fix #221
2022-08-24 12:09:32 +02:00
Nicco 489f3078fe
bump version 2022-08-24 12:03:11 +02:00
Romain de Laage e07dd0d991
Don't check if path is a directory (#220)
We only run a stat on the path to check there is no error
2022-08-22 17:28:38 +02:00
kenc 2b9dc9f17c
Add test for locking behaviour (#211) 2022-06-27 09:03:34 +02:00
kenc 465bc037c2
Add lock tests (#209)
* Add lock tests

* Refactor setLock to accept key value pairs

This allows SetCron and Lock to use the same function setLockValue. It
also removes the need to call getLock explicitly in tests by returning
the lock object.
2022-06-06 12:59:47 +02:00
kenc 37a043afff
Add location unit tests (#208) 2022-06-02 17:05:44 +02:00
kenc e91b632181
Add backend unit tests (#207) 2022-06-01 14:58:38 +02:00
kenc 2b30998b9a
Add options parsing unit tests (#205)
* Add options parsing unit tests

* Refactor into subtests
2022-05-30 12:56:25 +02:00
Varac 49b37a0a9a
Add varacs ansible role (#201)
Co-authored-by: Nicco <hi@nicco.io>
2022-05-24 13:34:10 +02:00
cupcakearmy 3bc091f826
lean flag 2022-04-27 00:55:31 +02:00
Nicco 5bcf5c9217
1.7.0 (#188)
* stream the output (#186)

* dont duplicate global flags (#187)

* docs for tagging

* fix self update path (#190)

* version bump & changelog
2022-04-27 00:48:52 +02:00
cupcakearmy ff2e3714d1
1.6.2 2022-04-14 17:44:54 +02:00
cupcakearmy 2e6764223d
bump go version in docker 2022-04-14 12:05:19 +02:00
Nicco 434862ed4e
1.6.0 (#180)
* fix for #178

* restore options

* error codes

* update docs

* forget docs

* add option to auto forget

* add copy option

* update go version to enable generics

* copy docs

* changelog & version bump
2022-04-14 11:51:32 +02:00
cupcakearmy 2da440a1cd
richtiattribution 2022-04-13 08:55:53 +02:00
cupcakearmy 0f6c34dc6b
healthcheck example 2022-04-12 23:59:12 +02:00
Nicco 3457fc01bf
Merge pull request #176 from ninjabenji/ninjabenji-doc-update 2022-04-08 15:06:37 +02:00
ninjabenji 1e62f6cb05
DOC - Note on config filename extension
Seems the config file can be located wherever needed but not using an extension or using an extension other than .yml causes the following error
could not load config file
Unsupported Config Type ""
2022-04-08 10:31:42 +01:00
Nicco 8112aceb30
Merge pull request #175 from ninjabenji/ninjabenji-backend-name-warning
Add lower case warning for backend name
2022-04-07 11:51:13 +02:00
ninjabenji b4cc0f0ab1
Add warning about location names.
Location names need to be lower case in order to work properly.
2022-04-07 10:32:17 +01:00
ninjabenji a3e539b0b7
Add line break in documentation 2022-04-07 10:00:28 +01:00
ninjabenji 79164e3de0
Add lower case warning for backend name
If uppercase characters are used in a backend name a check (and I assume other actions) will fail.
2022-04-06 21:28:25 +01:00
cupcakearmy 8b74a98836
better error handling 2022-03-18 13:06:19 +01:00
cupcakearmy 8a713e497d
add ssh & update deps 2022-03-12 14:13:29 +01:00
Nicco 71601ae7a6
Merge pull request #170 from fariszr/patch-2
Add OpenSSH to Autorestic Docker container
2022-03-12 14:11:03 +01:00
FarisZR 85d3f06b79
fix #169 2022-03-11 22:34:33 +03:00
cupcakearmy 5afad86e37
1.5.6 2022-03-10 16:36:26 +01:00
Nicco ba9e090695
Merge pull request #167 from fariszr/patch-1
Add bash to docker image
2022-03-10 16:32:43 +01:00
FarisZR 05def04770
Fix #166 2022-03-10 18:28:46 +03:00
cupcakearmy d85470459f
fix home directory 2022-02-16 21:58:09 +01:00
cupcakearmy 1f69a7974a
bump go version 2022-02-16 21:52:12 +01:00
cupcakearmy db9f5dea66
1.5.4 2022-02-16 21:42:54 +01:00
Nicco 75160d4d6a
Merge pull request #160 from cupcakearmy/1.5.3
1.5.3
2022-02-16 21:29:10 +01:00
cupcakearmy 92feaef5bb
version bump 2022-02-16 21:28:13 +01:00
cupcakearmy 2a7e233cdb
only check on config if it is getting used 2022-02-16 21:22:42 +01:00
cupcakearmy a373c07fb0
contrib 2022-02-13 16:25:51 +01:00
cupcakearmy ec9e2aebcd
1.5.2 2022-02-13 16:25:09 +01:00
Nicco 7d87160706
Merge pull request #156 from jjromannet/verbose-config-loading
Add error handling to reading of config file.
2022-02-13 16:23:05 +01:00
Nicco 8e1fe6af65
Merge pull request #157 from jjromannet/fix-copy-config-file-before-overriding
Make a copy of config before overriding it
2022-02-13 16:20:46 +01:00
Jan 65ba1f6ac1 Make a copy of config before overriding it 2022-02-09 20:35:29 +01:00
Jan 6bf4953003 Add error handling to reading config file. 2022-02-09 20:26:02 +01:00
cupcakearmy 27758a03fa
add help message 2021-12-22 14:45:04 +01:00
cupcakearmy bbdae05199
changelog 2021-12-06 17:27:59 +01:00
Nicco 389490c4ea
Merge pull request #136 from cupcakearmy/1.5.1
1.5.1
2021-12-06 17:24:19 +01:00
cupcakearmy 21b83b4c89
docker docs 2021-12-06 17:20:06 +01:00
cupcakearmy 982f9e0b5c
better error handling 2021-12-06 12:13:18 +01:00
cupcakearmy 0c37af5588
#140 Docker version pinning 2021-12-06 11:59:58 +01:00
cupcakearmy e3c378f2a1
release day 2021-11-24 09:57:10 +01:00
cupcakearmy 3b541665ae
changelog 2021-11-24 09:45:23 +01:00
cupcakearmy e0b2c99ccd
contrib 2021-11-24 09:45:19 +01:00
cupcakearmy 2b14e6b1af
remove print 2021-11-24 09:35:31 +01:00
Nicco 1810af8d02
Merge pull request #137 from g-a-c/issues/130
refactor downloading of binaries
2021-11-23 13:01:09 +01:00
cupcakearmy 252968e15e
ensure config is loaded before lock 2021-11-23 12:32:35 +01:00
cupcakearmy 26de4385ea
version bump 2021-11-23 12:32:22 +01:00
cupcakearmy 0c71bea93e
use own docker image 2021-11-21 21:10:32 +01:00
cupcakearmy 3029259d82
docs 2021-11-21 21:06:25 +01:00
Gavin Chappell 389f7c25dd refactor downloading of binaries
* If `/tmp` is a `tmpfs` or somehow not the same filesystem, `os.Rename()` will fail so use `io.Copy()` instead
* don't defer cleanup of `to` as this removes the newly-created file if the operation is successful, making `install` and `upgrade` _functionally_ `uninstall`
* defer cleanup of the temporary file since it will still be in place if `os.Rename()` fails

Fixes: #130
2021-11-20 19:30:46 +00:00
Nicco e055e28cfe
Merge pull request #125 from cupcakearmy/1.5.0
1.5.0
2021-11-20 17:11:44 +01:00
cupcakearmy ed3c17d678
migration docs 2021-11-20 17:09:42 +01:00
cupcakearmy 8802b74b47
changelog and docs 2021-11-20 17:03:54 +01:00
cupcakearmy e94e7030fc
docker image 2021-11-20 16:59:13 +01:00
cupcakearmy c55e91b8ff
version bump 2021-11-20 16:55:20 +01:00
cupcakearmy 170bdb81ad
tags 2021-11-07 11:48:03 +01:00
cupcakearmy 4126436f7f
migration docs 2021-11-07 11:42:45 +01:00
cupcakearmy 113a97c283
add config version to ensure compatibility 2021-11-06 22:00:44 +01:00
cupcakearmy c250391f67
docs 2021-11-01 11:19:27 +01:00
cupcakearmy d3b4915d25
deprecation notion 2021-11-01 09:09:29 +01:00
cupcakearmy cd7a5cbc13
also enable azure and google cloud 2021-11-01 00:19:32 +01:00
cupcakearmy 3dd3956d64
support for rclone 2021-11-01 00:16:54 +01:00
cupcakearmy 59035da46a
remove output 2021-10-31 23:58:08 +01:00
cupcakearmy 90914d2078
changelog 2021-10-31 23:35:52 +01:00
cupcakearmy 0ae374cd45
docs 2021-10-31 23:35:46 +01:00
cupcakearmy 3665cea62d
foo 2021-10-31 23:11:57 +01:00
cupcakearmy cf92d400c2
changelog 2021-10-31 23:11:06 +01:00
Nicco 696bd14ac7
Merge pull request #124 from cupcakearmy/multiple-paths
Multiple paths
2021-10-31 23:09:23 +01:00
cupcakearmy a68e3e426e
simplify options handling 2021-10-31 23:07:12 +01:00
cupcakearmy 27e82c8529
Merge branch 'master' into multiple-paths 2021-10-31 22:54:14 +01:00
Nicco 7f9251f06b
Merge pull request #123 from cupcakearmy/1.4.1
allow all values from envs
2021-10-31 22:47:33 +01:00
cupcakearmy 09cfa4a98e
changelog 2021-10-31 22:46:37 +01:00
cupcakearmy 05c3458a95
version bump 2021-10-31 22:45:54 +01:00
cupcakearmy 2826f9586d
allow all values from envs 2021-10-31 22:45:03 +01:00
cupcakearmy 4fe241e6f3
support for multiple sources 2021-10-31 22:33:02 +01:00
cupcakearmy d0b1b86fdd
docker runner 2021-10-31 22:32:55 +01:00
cupcakearmy 14dd41d60d
docs 2021-10-31 22:32:34 +01:00
cupcakearmy bcfc734cd1
describe multiple sources 2021-10-31 22:32:30 +01:00
cupcakearmy 6817f494ef
util to check if volume exists 2021-10-31 22:32:01 +01:00
cupcakearmy 2c46f0da0c
restore arg help 2021-10-31 22:31:47 +01:00
cupcakearmy ac756dfbde
bug not showing error messages 2021-10-31 22:31:31 +01:00
Nicco f71425be5b
Merge pull request #122 from n194/patch-1
Remove credit from AUR
2021-10-31 14:47:16 +01:00
n d78fbb6650
Remove credit from AUR 2021-10-31 19:40:53 +09:00
cupcakearmy 7ad6f7ce9e
Merge remote-tracking branch 'origin/master' into multiple-paths 2021-10-30 15:06:13 +02:00
Nicco de663f287c
Merge pull request #118 from cupcakearmy/1.4.0
1.4.0
2021-10-30 15:02:27 +02:00
cupcakearmy 439076d7ab
chengelog 2021-10-30 14:54:41 +02:00
cupcakearmy 8c30134f7c
error handling for upgrade and uninstall 2021-10-30 14:50:27 +02:00
cupcakearmy 11d1da7468
use wget 2021-10-30 14:38:53 +02:00
cupcakearmy 92b1577634
use wget 2021-10-30 14:36:25 +02:00
cupcakearmy a7944aed1f
don't install restic as default 2021-10-30 14:36:16 +02:00
cupcakearmy 3b99e301e9
only use wget 2021-10-30 14:30:53 +02:00
cupcakearmy 246e6fc0d8
enable generic env variables 2021-10-30 13:48:44 +02:00
cupcakearmy c2f9ed9204
multiple paths 2021-10-30 13:01:31 +02:00
cupcakearmy 4055ebf8e8
changelog 2021-10-29 18:35:24 +02:00
cupcakearmy 6be0a80b29
use built in function 2021-10-29 18:35:21 +02:00
cupcakearmy efd4a7dfea
version bump 2021-10-28 18:10:33 +02:00
cupcakearmy 440609220c
support for global flags 2021-10-28 18:10:14 +02:00
cupcakearmy fb6217d868
docs for global flags 2021-10-28 18:09:38 +02:00
cupcakearmy 1628384e1f
docs 2021-10-28 17:35:51 +02:00
Nicco 3e80e6d18e
Merge pull request #117 from cupcakearmy/specific-location
specific location
2021-10-28 17:30:51 +02:00
cupcakearmy 83905d2993
specific location 2021-10-28 17:29:32 +02:00
Nicco ddc3accb30
Merge pull request #114 from cupcakearmy/1.3.0
1.3.0
2021-10-26 16:03:09 +02:00
cupcakearmy 7874512ec0
changelog 2021-10-26 16:02:30 +02:00
cupcakearmy 0b5f4017e4
version bump 2021-10-26 15:59:49 +02:00
cupcakearmy 88198c4fcb
docs for hook envs 2021-10-26 15:57:47 +02:00
cupcakearmy 8cd759105f
env for hooks 2021-10-26 15:57:40 +02:00
cupcakearmy 6137e31c3b
allow argumentless flags 2021-10-25 18:29:59 +02:00
cupcakearmy 2789502c89
toc 2021-10-25 18:02:56 +02:00
cupcakearmy b87381cd3b
docs for envs 2021-10-25 18:02:51 +02:00
cupcakearmy 048a5ffed8
renamed env 2021-10-25 18:02:45 +02:00
cupcakearmy 02a8e461d4
ability to use keys from envs 2021-10-25 17:36:06 +02:00
cupcakearmy a1abe13a39
docs on cron 2021-10-25 17:07:29 +02:00
Nicco ddf287f6f5
Merge pull request #113 from cupcakearmy/1.3.0
1.3.0
2021-10-22 17:59:25 +02:00
cupcakearmy 56f82ae656
pnpm & typo 2021-10-22 17:57:43 +02:00
Nicco 95b1ca3297
Merge pull request #108 from FuzzyMistborn/patch-2
Add third ansible role to community docs
2021-10-07 12:14:08 +02:00
Fuzzy 7a8830cb2f
Add third ansible role to community docs 2021-10-06 13:24:40 -04:00
cupcakearmy 959d19cbdb
add XDG_CONFIG_HOME to config 2021-10-06 15:50:23 +02:00
Nicco 9dc7763445
Merge pull request #103 from IronicBadger/master
fixes small typo
2021-09-01 10:31:53 +02:00
Alex Kretzschmar 50984f6771 typo 2021-08-31 18:35:11 -04:00
cupcakearmy e80f200873
systemd units 2021-08-06 10:20:40 +02:00
cupcakearmy 86ae70672a
right version 2021-08-05 21:58:48 +02:00
cupcakearmy 5c0788900f
docs 2021-08-05 21:54:40 +02:00
cupcakearmy 20334a7e83
better config handling 2021-08-05 21:48:02 +02:00
cupcakearmy 7bebd04482
validate and show cwd 2021-07-12 19:10:36 +02:00
cupcakearmy b9b8857bf4
aliases 2021-07-12 19:10:25 +02:00
cupcakearmy dd6e618161
typo 2021-07-11 14:03:04 +02:00
cupcakearmy a4b54f9f64
check config bugs 2021-07-11 13:51:04 +02:00
Nicco c2e88193cd
Update contrib.md 2021-06-06 15:51:50 +02:00
Nicco a2ef69d96d
Merge pull request #87 from somebox/patch-1
correction to B2 config in the example
2021-06-06 15:48:02 +02:00
Jeremy Seitz d45949b028
correction to B2 config in the example
This example was missing the `env:` block in YAML, which if missing, caused `autorestic check` to compain:

``` * 'Backends[remote]' has invalid keys: b2_account_id, b2_account_key```
2021-06-06 14:27:26 +02:00
cupcakearmy 77d47cc697
add arm in install script 2021-05-25 22:57:42 +02:00
cupcakearmy a3239c0f3b
changelog 2021-05-17 22:40:27 +02:00
cupcakearmy 90cd3171e5
docs 2021-05-17 22:40:23 +02:00
cupcakearmy 61673bd88b
allow options for backend 2021-05-17 22:34:14 +02:00
cupcakearmy 41736ea3c4
typos 2021-05-07 11:34:46 +02:00
Nicco a7779e04bd
Merge pull request #75 from FuzzyMistborn/patch-2
Update update command in docs
2021-05-07 11:31:26 +02:00
Fuzzy 1326e7e53c
Update update command in docs 2021-05-06 23:05:34 -04:00
cupcakearmy 478e193d78
forgot version bump 2021-05-06 16:17:45 +02:00
cupcakearmy 11d4c67dce
docs 2021-05-06 16:14:29 +02:00
cupcakearmy 1643309957
changelog 2021-05-06 15:57:28 +02:00
cupcakearmy e05386b0b5
add failure and success hooks 2021-05-06 15:55:32 +02:00
cupcakearmy aebaf0a225
Merge branch 'master' of https://github.com/cupcakearmy/autorestic 2021-05-06 15:12:37 +02:00
Nicco c090013bf5
Update README.md 2021-05-06 15:12:11 +02:00
cupcakearmy 88c6949208
custom restic binary 2021-05-06 15:04:35 +02:00
cupcakearmy 9256cdc38c
changelog 2021-05-01 22:57:01 +02:00
cupcakearmy a8c611e8ce
Merge branch 'master' of https://github.com/cupcakearmy/autorestic 2021-05-01 22:54:57 +02:00
cupcakearmy d4522c7ffe
fix validation for docker volumes 2021-05-01 22:54:52 +02:00
Nicco 21185d894e
Update contrib.md 2021-05-01 17:25:50 +02:00
Nicco b119fc7ea5
Merge pull request #72 from themorlan/master
Correcting some typos in the Documentation
2021-05-01 17:25:20 +02:00
themorlan 73f4bcfd48
missing words in sentence 2021-05-01 15:18:05 +02:00
themorlan 3567319314
typo 2021-05-01 15:16:13 +02:00
themorlan bf19c983d1
typo 2021-05-01 15:15:44 +02:00
themorlan 12e4de110b
typo 2021-05-01 15:14:50 +02:00
cupcakearmy c9f425ef64
docs on native flags 2021-04-30 10:47:29 +02:00
Nicco 974f555dff
Update contrib.md 2021-04-29 15:18:03 +02:00
cupcakearmy 1688c1f3c3
add brew docs 2021-04-29 15:16:33 +02:00
cupcakearmy 29e46d3b5c
brew stuff 2021-04-29 14:45:17 +02:00
cupcakearmy 0335abb669
add sign 2021-04-28 14:51:56 +02:00
cupcakearmy b2f9b9a54e
typo 2021-04-28 13:50:11 +02:00
cupcakearmy 2b13a6e13d
installtion docs 2021-04-28 13:44:20 +02:00
Nicco cc293ea256
Update installation.md 2021-04-28 13:38:20 +02:00
Nicco a4ddd5bbcb
Update contrib.md 2021-04-28 13:34:58 +02:00
Nicco 7cbf43b75d
Update README.md 2021-04-28 11:13:16 +02:00
Nicco bae77c4673
Update README.md 2021-04-28 11:10:36 +02:00
cupcakearmy 12adeb2b06
changelog 2021-04-28 10:54:33 +02:00
cupcakearmy 37b26dfc31
consistent casing 2021-04-28 10:54:30 +02:00
cupcakearmy c1795b2acc
lean flag 2021-04-28 10:54:07 +02:00
cupcakearmy b8d12e518c
completion docs 2021-04-28 10:34:43 +02:00
cupcakearmy 50060cf539
explain verbose flag 2021-04-27 18:38:51 +02:00
cupcakearmy c33aac42dc
quickstart 2021-04-27 18:35:32 +02:00
Nicco c359053e0e
Update contrib.md 2021-04-27 09:02:39 +02:00
Nicco c16340ab26
Update available.md 2021-04-27 09:01:01 +02:00
Nicco edc85c4ac3
Merge pull request #60 from david-boles/backblaze
Update Backblaze docs
2021-04-27 08:59:44 +02:00
Nicco 68682777f2
Merge pull request #59 from david-boles/consistent-config-location
Recommend a consistent config location
2021-04-27 08:26:22 +02:00
David Boles b6c7922df5 Recommend a consistent config location 2021-04-26 16:47:00 -07:00
David Boles 991b8bec22 Update backblaze docs 2021-04-26 16:38:08 -07:00
cupcakearmy bbc32568ad
parallel builds 2021-04-26 13:29:26 +02:00
cupcakearmy f3c038c716
changelog & version bump 2021-04-26 13:18:02 +02:00
cupcakearmy 59612a97b6
Merge branch 'master' of https://github.com/cupcakearmy/autorestic 2021-04-26 13:16:01 +02:00
cupcakearmy 33319a00ef
add arm for darwin 2021-04-26 13:15:58 +02:00
Nicco 8eb14ea14f
Update quick.md 2021-04-25 11:19:39 +02:00
cupcakearmy 70eb9e441f
add rclone support 2021-04-24 16:40:53 +02:00
Nicco be25af2d76
Merge pull request #53 from TheForcer/master
Fix typo in check output
2021-04-24 13:19:34 +02:00
cupcakearmy 1c436369f0
check folder 2021-04-24 12:40:33 +02:00
cupcakearmy 6efcce07b7
show error and exit with bad code if not found 2021-04-23 23:53:57 +02:00
Felix dc6dd2e712
Fix typo in check output 2021-04-23 19:19:03 +02:00
Felix 68628d3776
Merge pull request #1 from cupcakearmy/master
Update
2021-04-23 19:18:08 +02:00
Nicco 40988ef3b4
Update contrib.md 2021-04-23 17:53:48 +02:00
Nicco fad33fcdaa
Merge pull request #51 from TheForcer/master
Fix typos in docs
2021-04-23 17:53:15 +02:00
Felix 8cf8a77558
Fix typos in docs 2021-04-23 17:45:02 +02:00
cupcakearmy 36998cfd3b
changelog 2021-04-23 13:47:21 +02:00
cupcakearmy cf03562ea2
docs 2021-04-23 13:45:54 +02:00
cupcakearmy 188560395d
exclude items from config when empty and rest options 2021-04-23 13:11:15 +02:00
cupcakearmy bacbd0f806
docs 2021-04-23 12:31:24 +02:00
cupcakearmy 93bf0388a4
add force flag description 2021-04-22 10:00:52 +02:00
cupcakearmy ec8fdbd135
updated contrib list 2021-04-22 01:14:47 +02:00
Nicco 420934489c
Merge pull request #46 from FuzzyMistborn/patch-1
Fix typo in install script
2021-04-22 01:07:11 +02:00
Fuzzy 2ba767c8c3
Fix typo in install script
Fix typo
2021-04-21 14:32:11 -04:00
cupcakearmy b489c662c7
docs 2021-04-21 09:41:14 +02:00
cupcakearmy 6862529a89
move envs to new format 2021-04-21 09:36:47 +02:00
cupcakearmy aa96a95600
typos 2021-04-21 09:34:01 +02:00
cupcakearmy 89e32c298c
update the quick guide 2021-04-21 09:27:35 +02:00
cupcakearmy 873170c6d1
fix auto update 2021-04-20 23:26:57 +02:00
cupcakearmy ea82fea8e1
add cron tag 2021-04-20 20:49:09 +02:00
cupcakearmy a35edcaea5
version bump 2021-04-17 20:55:09 +02:00
cupcakearmy 86d44eafad
exit with better message 2021-04-17 20:51:40 +02:00
cupcakearmy e927fd5a64
panic on already running 2021-04-17 20:45:52 +02:00
cupcakearmy d5e13d4e27
changelog 2021-04-17 17:54:24 +02:00
cupcakearmy 824c90904c
docs 2021-04-17 17:51:23 +02:00
Nicco 58fb5e073a
Update README.md 2021-04-17 17:50:53 +02:00
cupcakearmy 541a7c2a72
add autocompletetions 2021-04-17 17:48:31 +02:00
cupcakearmy e671780e54
fix version upgrade 2021-04-17 17:41:53 +02:00
cupcakearmy a5471efa21
check self update 2021-04-17 17:32:05 +02:00
Nicco 769ae4c566
Merge pull request #44 from cupcakearmy/rewrite
Rewrite
2021-04-17 17:21:19 +02:00
cupcakearmy f2934f60ae
docs 2021-04-17 17:19:59 +02:00
cupcakearmy f6bc91e9b5
merge 2021-04-17 17:16:58 +02:00
cupcakearmy fb073627a8
Merge remote-tracking branch 'origin/master' into rewrite 2021-04-17 17:16:52 +02:00
cupcakearmy 976a3beab5
upgrade logic 2021-04-17 17:13:03 +02:00
cupcakearmy ec2377287e
docs 2021-04-17 17:04:43 +02:00
cupcakearmy 7b7eec2dba
install script 2021-04-17 15:57:15 +02:00
cupcakearmy 33be94ba55
licensing 2021-04-17 15:12:44 +02:00
cupcakearmy 8f7513b103
v30 2021-04-17 14:49:29 +02:00
cupcakearmy cf417e360d
roadmap 2021-04-17 13:13:17 +02:00
cupcakearmy b5caad2d70
docs 2021-04-17 13:12:25 +02:00
cupcakearmy 2e594cade6
docs 2021-04-17 13:12:20 +02:00
cupcakearmy 276c424106
pass env of backends to restic 2021-04-17 13:04:40 +02:00
cupcakearmy b314912821
describe backends 2021-04-17 12:02:00 +02:00
cupcakearmy b1054f3512
info command 2021-04-16 22:37:15 +02:00
cupcakearmy 1bbd3879fe
make back compatible 2021-04-16 22:02:25 +02:00
cupcakearmy aa0b81023f
vercel 2021-04-16 00:31:34 +02:00
cupcakearmy 09e0ee4dec
shorthand for config 2021-04-16 00:27:06 +02:00
cupcakearmy 952334fecb
docs 2021-04-16 00:26:57 +02:00
cupcakearmy a45eee6009
only when tagged 2021-04-15 23:36:01 +02:00
cupcakearmy a658b6bb21
workflow 2021-04-15 23:35:00 +02:00
cupcakearmy 8e13e7bc40
linting 2021-04-15 23:16:47 +02:00
cupcakearmy 6449b8999f
support for volume locations 2021-04-15 21:55:35 +02:00
cupcakearmy 7629626ae0
comment on major version 2021-04-15 01:08:56 +02:00
cupcakearmy da6d9c53aa
docs 2021-04-12 16:41:46 +02:00
cupcakearmy 604354741e
remove tmp file 2021-04-12 16:16:08 +02:00
cupcakearmy 3ccaee4066
cleaner output and ctrl-c 2021-04-12 16:15:17 +02:00
cupcakearmy 640b60c47f
current state 2021-04-12 10:55:57 +02:00
cupcakearmy d293e93fa8
cron job 2021-04-12 00:17:29 +02:00
cupcakearmy 03ca0c8677
add key if not present 2021-04-12 00:02:35 +02:00
cupcakearmy 19e75c1dad
fixes 2021-04-11 18:17:21 +02:00
cupcakearmy 6e25b90915
unlock on error and named arrays for config 2021-04-11 17:02:34 +02:00
cupcakearmy 8a1fe41825
cron 2021-04-11 15:02:27 +02:00
cupcakearmy 5d92b5bcc1
dry run for forget cmd 2021-04-11 14:22:46 +02:00
cupcakearmy 05be58a3a7
restore cmd 2021-04-11 14:03:38 +02:00
cupcakearmy 9ba58ee7f8
decsriptions 2021-04-11 13:08:50 +02:00
cupcakearmy 335724cce7
progress 2021-04-11 13:04:11 +02:00
cupcakearmy 43244302be
build file 2021-04-11 13:03:47 +02:00
cupcakearmy 03cbbfd91c
go rewrite 2021-04-09 01:55:10 +02:00
155 changed files with 8338 additions and 8163 deletions

View File

@ -1,15 +0,0 @@
import { build } from '@codedoc/core';
import { config } from './config';
import { installTheme$ } from './content/theme';
import { content } from './content';
build(config, content, installTheme$, {
resolve: {
modules: ['.codedoc/node_modules']
},
resolveLoader: {
modules: ['.codedoc/node_modules']
}
});

View File

@ -1,24 +0,0 @@
import { configuration } from '@codedoc/core'
export const config = configuration({
src: {
base: 'docs',
},
dest: {
html: './build',
assets: './build',
bundle: './_',
styles: './_',
},
page: {
title: {
base: 'Autorestic',
},
},
misc: {
github: {
user: 'cupcakearmy',
repo: 'autorestic',
},
},
})

View File

@ -1,19 +0,0 @@
import { CodedocConfig } from '@codedoc/core';
import { Footer as _Footer, GitterToggle$, Watermark} from '@codedoc/core/components';
export function Footer(config: CodedocConfig, renderer: any) {
let github$;
if (config.misc?.github)
github$ = <a href={`https://github.com/${config.misc.github.user}/${config.misc.github.repo}/`}
target="_blank">GitHub</a>;
let community$;
if (config.misc?.gitter)
community$ = <GitterToggle$ room={config.misc.gitter.room}/>
if (github$ && community$) return <_Footer>{github$}<hr/>{community$}</_Footer>;
else if (github$) return <_Footer>{github$}</_Footer>;
else if (community$) return <_Footer>{community$}</_Footer>;
else return <_Footer><Watermark/></_Footer>;
}

View File

@ -1,21 +0,0 @@
import { CodedocConfig } from '@codedoc/core';
import { Header as _Header, GithubButton, Watermark } from '@codedoc/core/components';
export function Header(config: CodedocConfig, renderer: any) {
return (
<_Header>{config.misc?.github ?
<fragment>
<GithubButton action={config.misc.github.action || 'Star'}
repo={config.misc.github.repo}
user={config.misc.github.user}
large={config.misc.github.large === true}
count={config.misc.github.count !== false}
standardIcon={config.misc.github.standardIcon !== false}/>
<br/><br/>
</fragment>
: ''}
<Watermark/>
</_Header>
)
}

View File

@ -1,57 +0,0 @@
import { RendererLike } from '@connectv/html'
import { File } from 'rxline/fs'
import {
Page,
Meta,
ContentNav,
Fonts,
ToC,
GithubSearch$,
} from '@codedoc/core/components'
import { config } from '../config'
import { Header } from './header'
import { Footer } from './footer'
export function content(
_content: HTMLElement,
toc: HTMLElement,
renderer: RendererLike<any, any>,
file: File<string>
) {
return (
<Page
title={config.page.title.extractor(_content, config, file)}
favicon={config.page.favicon}
meta={<Meta {...config.page.meta} />}
fonts={<Fonts {...config.page.fonts} />}
scripts={config.page.scripts}
stylesheets={config.page.stylesheets}
header={<Header {...config} />}
footer={<Footer {...config} />}
toc={
<ToC
default={'open'}
search={
config.misc?.github ? (
<GithubSearch$
repo={config.misc.github.repo}
user={config.misc.github.user}
root={config.src.base}
pick={config.src.pick.source}
drop={config.src.drop.source}
/>
) : (
false
)
}
>
{toc}
</ToC>
}
>
{_content}
<ContentNav content={_content} />
</Page>
)
}

View File

@ -1,8 +0,0 @@
import { funcTransport } from '@connectv/sdh/transport';
import { useTheme } from '@codedoc/core/transport';
import { theme } from '../theme';
export function installTheme() { useTheme(theme); }
export const installTheme$ = /*#__PURE__*/funcTransport(installTheme);

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +0,0 @@
{
"dependencies": {
"@codedoc/core": "^0.2.15"
}
}

View File

@ -1,18 +0,0 @@
import { join } from 'path';
import { serve } from '@codedoc/core';
import { config } from './config';
import { content } from './content';
import { installTheme$ } from './content/theme';
const root = join(__dirname, '../');
serve(root, config, content, installTheme$, {
resolve: {
modules: ['.codedoc/node_modules']
},
resolveLoader: {
modules: ['.codedoc/node_modules']
}
});

View File

@ -1,11 +0,0 @@
import { createTheme } from '@codedoc/core/transport';
export const theme = /*#__PURE__*/createTheme({
light: {
primary: '#1eb2a6'
},
dark: {
primary: '#1eb2a6'
}
});

View File

@ -1,26 +0,0 @@
{
"compilerOptions": {
"target": "es6",
"noImplicitAny": true,
"declaration": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"alwaysStrict": true,
"sourceMap": true,
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"jsx": "react",
"jsxFactory": "renderer.create",
"lib": [
"es2017",
"dom"
]
},
"include": [
"./**/*"
]
}

View File

@ -1,22 +0,0 @@
import { exec, spawn } from 'child_process';
import { config } from './config';
const cmd = 'ts-node-dev';
const params = `--project .codedoc/tsconfig.json`
+ ` -T --watch ${config.src.base},.codedoc`
+ ` --ignore-watch .codedoc/node_modules`
+ ` .codedoc/serve`;
if (process.platform === 'win32') {
const child = exec(cmd + ' ' + params);
child.stdout?.pipe(process.stdout);
child.stderr?.pipe(process.stderr);
child.on('close', () => {});
}
else {
const child = spawn(cmd, [params], { stdio: 'inherit', shell: 'bash' });
child.on('close', () => {});
}

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
*
!**/*.go
!build
!cmd
!internal
!go.*

8
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,8 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"

51
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Main
on:
push:
tags:
- 'v*.*.*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Labels
id: meta
uses: crazy-max/ghaction-docker-meta@v4
with:
images: cupcakearmy/autorestic
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.21'
- name: Build
run: go run build/build.go
- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

23
.gitignore vendored
View File

@ -2,20 +2,11 @@
.idea
.vscode
# Node
node_modules/
# Build & Runtime
bin
lib
data
restore
docker
Dockerfile
build
dist
# Config
.autorestic.yml
.autorestic.lock
.docker.yml
.autorestic*
# Build & Dev
test
autorestic
data
dist

View File

@ -1,4 +0,0 @@
semi: false
singleQuote: true
trailingComma: 'es5'
printWidth: 150

View File

@ -1,3 +1,282 @@
## 0.27
# Changelog
- fix locking issue
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.7.4] - 2023-01-18
### Fixed
- Transformer for extracting information. @11mariom
### Changed
- Bump docker restic version.
- Docs dependencies updated.
## [1.7.1] - 2022-04-27
### Fixed
- #178 Lean flag not working properly.
## [1.7.0] - 2022-04-27
### Changed
- #147 Stream output instead of buffering.
### Fixed
- #184 duplicate global options.
- #154 add docs for migration.
- #182 fix bug with upgrading custom restic with custom path.
## [1.6.2] - 2022-04-14
### Fixed
- Version bump in code.
## [1.6.1] - 2022-04-14
### Fixed
- Bump go version in docker file to 18.
## [1.6.0] - 2022-04-14
### Added
- support for copy command #145
- partial restore with `--include`, `--exclude`, `--iinclude`, `--iexclude` flags #161
- run forget automatically after backup #158
- exit codes to hooks as env variable #142
### Fixed
- Lean flag not removing all output #178
## [1.5.8] - 2022-03-18
### Fixed
- Better error handling for bad config files.
## [1.5.7] - 2022-03-11
### Added
- SSH in docker image. @fariszr
### Security
- Updated dependencies
## [1.5.6] - 2022-03-10
### Fixed
- Add bash in docker image for hooks. @fariszr
## [1.5.5] - 2022-02-16
### Changed
- Go version was updated from `1.16` to `1.17`
### Fixed
- Home directory was not being taken into account for loading configs.
## [1.5.4] - 2022-02-16
### Fixed
- Lean flag not omitting all output.
## [1.5.3] - 2022-02-16
### Fixed
- Error throwing not finding config even it's not being used.
## [1.5.2] - 2022-02-13
### Fixed
- Config loading @jjromannet
- Making a backup of the file @jjromannet
## [1.5.1] - 2021-12-06
### Changed
- use official docker image instead of installing rclone every time docker is used.
- docker docs
### Fixed
- lock file not always next to the config file.
- update / install bugs.
- lock docker image tag to the current autorestic version
- better error logging
## [1.5.0] - 2021-11-20
### Added
- Support for multiple paths.
- Improved error handling.
- Allow for specific snapshot to be restored.
- Docker image.
### Fixed
- rclone in docker volumes.
### Changed
- [Breaking Change] Declaration of docker volumes. See: https://autorestic.vercel.app/migration/1.4_1.5.
- [Breaking Change] Hooks default executing directory now defaults to the config file directory. See: https://autorestic.vercel.app/migration/1.4_1.5.
## [1.4.1] - 2021-10-31
### Fixed
- Numeric values from config files not being passed to env.
## [1.4.0] - 2021-10-30
### Added
- Allow specify to specify a backend for location backup.
- Global restic flags.
- Generic ENV support for backends.
### Changed
- Install now only requires `wget`.
- Env variable for the `KEY` has been renamed from `AUTORESTIC_[BACKEND NAME]_KEY` -> `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`.
### Fixed
- Error handling during upgrade & uninstall.
## [1.3.0] - 2021-10-26
### Added
- Pass restic backup metadata as ENV to hooks.
- Support for `XDG_CONFIG_HOME` and `${HOME}/.config` as default locations for `.autorestic.yaml` file.
- Binary restic flags are now supported.
- Pass encryption keys from env variables or files.
## [1.2.0] - 2021-08-05
### Added
- Community page
- Support for yaml references and aliases.
### Fixed
- Better verbose output for hooks.
- Better error message for bad formatted configs.
## [1.1.2] - 2021-07-11
### Fixes
Don't check all backend when running `forget` or `exec` commands.
## [1.1.1] - 2021-05-17
### Added
- Options for backends.
## [1.1.0] - 2021-05-06
### Added
- use custom restic binary.
- success & failure hooks.
### Fixed
- don't skip other locations on failure.
## [1.0.9] - 2021-05-01
### Fixed
- Validation for docker volumes.
## [1.0.8] - 2021-04-28
### Added
- `--lean` flag to cron command for less output about skipping backups.
### Fixed
- consistent lower casing in usage descriptions.
## [1.0.7] - 2021-04-26
### Added
- Support for `darwin/arm64` aka Apple Silicon.
- Added support for `arm64` and `aarch64` in install scripts.
## [1.0.6] - 2021-04-24
### Added
- Support for rclone.
## [1.0.5] - 2021-04-24
### Fixed
- Correct exit code on backup failure and better logging/output/feedback.
- Check if `from` key is an actual directory.
## [1.0.4] - 2021-04-23
### Added
- Options to add rest username and password in config.
### Fixed
- Don't add empty strings when saving config.
## [1.0.3] - 2021-04-20
### Fixed
- Auto upgrade script was not working on linux as linux does not support writing to the binary that is being executed.
## [1.0.2] - 2021-04-20
### Added
- Add the `cron` tag to backup to backups made with cron.
### Fixed
- Don't unlock lockfile if process is already running.
## [1.0.1] - 2021-04-17
### Added
- Completion command for various shells.
## [1.0.0] - 2021-04-17
- Rewrite in go. See https://autorestic.vercel.app/upgrade for migration.

30
DEVELOPMENT.md Normal file
View File

@ -0,0 +1,30 @@
# Development
## Coding
The easiest way (imo) is to run [`gowatch`](https://github.com/silenceper/gowatch) in a separate terminal and the simply run `./autorestic ...`. `gowatch` will watch the code and automatically rebuild the binary when changes are saved to disk.
## Building
```bash
go run build/build.go
```
This will build and compress binaries for multiple platforms. The output will be put in the `dist` folder.
## Releasing
Releases are automatically built by the github workflow and uploaded to the release.
1. Bump `VERSION` in `internal/config.go`.
2. Update `CHANGELOG.md`
3. Commit to master
4. Create a new release with the `v1.2.3` tag and mark as pre-release.
5. The Github action will build the binaries, upload and mark the release as ready when done.
### Brew
1. Download the latest release.
2. Check the checksum with `shasum -a 256 autorestic-1.2.3.tar.gz`
3. Update `url` and `sha256` in the brew repo.
4. Submit PR

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM golang:1.22-alpine as builder
WORKDIR /app
COPY go.* .
RUN go mod download
COPY . .
RUN go build
FROM restic/restic:0.16.4
RUN apk add --no-cache rclone bash curl docker-cli
COPY --from=builder /app/autorestic /usr/bin/autorestic
ENTRYPOINT []
CMD [ "autorestic" ]

215
LICENSE
View File

@ -1,21 +1,202 @@
MIT License
Copyright (c) 2019 Nicco
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. Definitions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -10,16 +10,41 @@
Config driven, easy backup cli for <a href="https://restic.net/">restic</a>.
<br>
<strong><a href="https://autorestic.vercel.app/">»»» Docs & Getting Started »»»</a></strong>
<br><br>
<a target="_blank" href="https://discord.gg/wS7RpYTYd2">
<img src="https://img.shields.io/discord/252403122348097536" alt="discord badge" />
<img src="https://img.shields.io/github/contributors/cupcakearmy/autorestic" alt="contributor badge" />
<img src="https://img.shields.io/github/downloads/cupcakearmy/autorestic/total" alt="downloads badge" />
<img src="https://img.shields.io/github/v/release/cupcakearmy/autorestic" alt="version badge" />
</a>
</p>
</p>
<br>
<br>
### Why / What?
### 💭 Why / What?
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different locations that you want to backup to multiple locations. This utility is aimed at making this easier 🙂.
### Questions / Support
### 🌈 Features
Check the [discussions page](https://github.com/cupcakearmy/autorestic/discussions)
- YAML config files, no CLI
- Incremental -> Minimal space is used
- Backup locations to multiple backends
- Snapshot policies and pruning
- Fully encrypted
- Before/after backup hooks
- Exclude pattern/files
- Cron jobs for automatic backup
- Backup & Restore docker volume
- Generated completions for `[bash|zsh|fish|powershell]`
### ❓ Questions / Support
Check the [discussions page](https://github.com/cupcakearmy/autorestic/discussions) or [join on discord](https://discord.gg/wS7RpYTYd2)
## Contributing / Developing
PRs, feature requests, etc. are welcomed :)
Have a look at [the dev docs](./DEVELOPMENT.md)

View File

@ -1,9 +0,0 @@
# Releasing
Releases are handled by the CD server with includes checksums for each binary.
```bash
git tag 0.x
git push
git push origin --tags
```

132
build/build.go Normal file
View File

@ -0,0 +1,132 @@
// Heavily inspired (copied) by the restic build file
// https://github.com/restic/restic/blob/aa0faa8c7d7800b6ba7b11164fa2d3683f7f78aa/helpers/build-release-binaries/main.go#L225
package main
import (
"crypto/md5"
"crypto/sha1"
"crypto/sha256"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path"
"path/filepath"
"sync"
"github.com/cupcakearmy/autorestic/internal"
)
var DIR, _ = filepath.Abs("./dist")
var targets = map[string][]string{
// "aix": {"ppc64"}, // Not supported by fsnotify
"darwin": {"amd64", "arm64"},
"freebsd": {"386", "amd64", "arm"},
"linux": {"386", "amd64", "arm", "arm64", "ppc64le", "mips", "mipsle", "mips64", "mips64le", "s390x"},
"netbsd": {"386", "amd64"},
"openbsd": {"386", "amd64"},
// "windows": {"386", "amd64"}, // Not supported by autorestic
"solaris": {"amd64"},
}
type buildOptions struct {
Target, Arch, Version string
}
const (
CHECKSUM_MD5 = "MD5SUMS"
CHECKSUM_SHA_1 = "SHA1SUMS"
CHECKSUM_SHA_256 = "SHA256SUMS"
)
type Checksums struct {
filename, md5, sha1, sha256 string
}
func writeChecksums(checksums *[]Checksums) {
FILE_MD5, _ := os.OpenFile(path.Join(DIR, CHECKSUM_MD5), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
defer FILE_MD5.Close()
FILE_SHA1, _ := os.OpenFile(path.Join(DIR, CHECKSUM_SHA_1), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
defer FILE_SHA1.Close()
FILE_SHA256, _ := os.OpenFile(path.Join(DIR, CHECKSUM_SHA_256), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
defer FILE_SHA256.Close()
for _, checksum := range *checksums {
fmt.Fprintf(FILE_MD5, "%s %s\n", checksum.md5, checksum.filename)
fmt.Fprintf(FILE_SHA1, "%s %s\n", checksum.sha1, checksum.filename)
fmt.Fprintf(FILE_SHA256, "%s %s\n", checksum.sha256, checksum.filename)
}
}
func build(options buildOptions, wg *sync.WaitGroup, checksums *[]Checksums) {
defer wg.Done()
fmt.Printf("Building: %s %s\n", options.Target, options.Arch)
out := fmt.Sprintf("autorestic_%s_%s_%s", options.Version, options.Target, options.Arch)
out = path.Join(DIR, out)
// Build
{
c := exec.Command("go", "build", "-o", out, "./main.go")
c.Stdout = os.Stdout
c.Stderr = os.Stderr
c.Env = append(os.Environ(),
"CGO_ENABLED=0",
"GOOS="+options.Target,
"GOARCH="+options.Arch,
)
err := c.Run()
if err != nil {
panic(err)
}
}
// Compress
{
c := exec.Command("bzip2", out)
c.Dir = DIR
c.Stdout = os.Stdout
c.Stderr = os.Stderr
err := c.Run()
if err != nil {
panic(err)
}
}
// Checksum
{
file := out + ".bz2"
content, _ := ioutil.ReadFile(file)
*checksums = append(*checksums, Checksums{
filename: path.Base(file),
md5: fmt.Sprintf("%x", md5.Sum(content)),
sha1: fmt.Sprintf("%x", sha1.Sum(content)),
sha256: fmt.Sprintf("%x", sha256.Sum256(content)),
})
}
fmt.Printf("Built: %s\n", path.Base(out))
}
func main() {
os.RemoveAll(DIR)
v := internal.VERSION
checksums := []Checksums{}
// Build async
var wg sync.WaitGroup
for target, archs := range targets {
for _, arch := range archs {
wg.Add(1)
go build(buildOptions{
Target: target,
Arch: arch,
Version: v,
}, &wg, &checksums)
}
}
wg.Wait()
writeChecksums(&checksums)
}

47
cmd/backup.go Normal file
View File

@ -0,0 +1,47 @@
package cmd
import (
"fmt"
"strings"
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var backupCmd = &cobra.Command{
Use: "backup",
Short: "Create backups for given locations",
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
selected, err := internal.GetAllOrSelected(cmd, false)
CheckErr(err)
errors := 0
for _, name := range selected {
var splitted = strings.Split(name, "@")
var specificBackend = ""
if len(splitted) > 1 {
specificBackend = splitted[1]
}
location, _ := internal.GetLocation(splitted[0])
errs := location.Backup(false, specificBackend)
for _, err := range errs {
colors.Error.Printf("%s\n\n", err)
errors++
}
}
if errors > 0 {
CheckErr(fmt.Errorf("%d errors were found", errors))
}
},
}
func init() {
rootCmd.AddCommand(backupCmd)
internal.AddFlagsToCommand(backupCmd, false)
}

27
cmd/check.go Normal file
View File

@ -0,0 +1,27 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var checkCmd = &cobra.Command{
Use: "check",
Short: "Check if everything is setup",
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
CheckErr(internal.CheckConfig())
colors.Success.Println("Everything is fine.")
},
}
func init() {
rootCmd.AddCommand(checkCmd)
}

70
cmd/completion.go Normal file
View File

@ -0,0 +1,70 @@
package cmd
import (
"os"
"github.com/spf13/cobra"
)
var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate completion script",
Long: `To load completions:
Bash:
$ source <(autorestic completion bash)
# To load completions for each session, execute once:
# Linux:
$ autorestic completion bash > /etc/bash_completion.d/autorestic
# macOS:
$ autorestic completion bash > /usr/local/etc/bash_completion.d/autorestic
Zsh:
# If shell completion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
# To load completions for each session, execute once:
$ autorestic completion zsh > "${fpath[1]}/_autorestic"
# You will need to start a new shell for this setup to take effect.
fish:
$ autorestic completion fish | source
# To load completions for each session, execute once:
$ autorestic completion fish > ~/.config/fish/completions/autorestic.fish
PowerShell:
PS> autorestic completion powershell | Out-String | Invoke-Expression
# To load completions for every new session, run:
PS> autorestic completion powershell > autorestic.ps1
# and source this file from your PowerShell profile.
`,
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Args: cobra.ExactValidArgs(1),
Run: func(cmd *cobra.Command, args []string) {
switch args[0] {
case "bash":
cmd.Root().GenBashCompletion(os.Stdout)
case "zsh":
cmd.Root().GenZshCompletion(os.Stdout)
case "fish":
cmd.Root().GenFishCompletion(os.Stdout, true)
case "powershell":
cmd.Root().GenPowerShellCompletionWithDesc(os.Stdout)
}
},
}
func init() {
rootCmd.AddCommand(completionCmd)
}

28
cmd/cron.go Normal file
View File

@ -0,0 +1,28 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/flags"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var cronCmd = &cobra.Command{
Use: "cron",
Short: "Run cron job for automated backups",
Long: `Intended to be mainly triggered by an automated system like systemd or crontab. For each location checks if a cron backup is due and runs it.`,
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
err = internal.RunCron()
CheckErr(err)
},
}
func init() {
rootCmd.AddCommand(cronCmd)
cronCmd.Flags().BoolVar(&flags.CRON_LEAN, "lean", false, "only output information about actual backups")
}

47
cmd/exec.go Normal file
View File

@ -0,0 +1,47 @@
package cmd
import (
"fmt"
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var execCmd = &cobra.Command{
Use: "exec",
Short: "Execute arbitrary native restic commands for given backends",
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
selected, err := internal.GetAllOrSelected(cmd, true)
CheckErr(err)
var errors []error
for _, name := range selected {
colors.PrimaryPrint(" Executing on \"%s\" ", name)
backend, _ := internal.GetBackend(name)
err := backend.Exec(args)
if err != nil {
errors = append(errors, err)
}
}
if len(errors) > 0 {
for _, err := range errors {
colors.Error.Printf("%s\n\n", err)
}
CheckErr(fmt.Errorf("%d errors were found", len(errors)))
}
},
}
func init() {
rootCmd.AddCommand(execCmd)
internal.AddFlagsToCommand(execCmd, true)
}

35
cmd/forget.go Normal file
View File

@ -0,0 +1,35 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var forgetCmd = &cobra.Command{
Use: "forget",
Short: "Forget and optionally prune snapshots according the specified policies",
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
selected, err := internal.GetAllOrSelected(cmd, false)
CheckErr(err)
prune, _ := cmd.Flags().GetBool("prune")
dry, _ := cmd.Flags().GetBool("dry-run")
for _, name := range selected {
location, _ := internal.GetLocation(name)
err := location.Forget(prune, dry)
CheckErr(err)
}
},
}
func init() {
rootCmd.AddCommand(forgetCmd)
internal.AddFlagsToCommand(forgetCmd, false)
forgetCmd.Flags().Bool("prune", false, "also prune repository")
forgetCmd.Flags().Bool("dry-run", false, "do not write changes, show what would be affected")
}

18
cmd/info.go Normal file
View File

@ -0,0 +1,18 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal"
"github.com/spf13/cobra"
)
var infoCmd = &cobra.Command{
Use: "info",
Short: "Show info about the config",
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig().Describe()
},
}
func init() {
rootCmd.AddCommand(infoCmd)
}

19
cmd/install.go Normal file
View File

@ -0,0 +1,19 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal/bins"
"github.com/spf13/cobra"
)
var installCmd = &cobra.Command{
Use: "install",
Short: "Install restic if missing",
Run: func(cmd *cobra.Command, args []string) {
err := bins.InstallRestic()
CheckErr(err)
},
}
func init() {
rootCmd.AddCommand(installCmd)
}

63
cmd/restore.go Normal file
View File

@ -0,0 +1,63 @@
package cmd
import (
"fmt"
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var restoreCmd = &cobra.Command{
Use: "restore [snapshot id]",
Short: "Restore backup for location",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
err := lock.Lock()
CheckErr(err)
defer lock.Unlock()
location, _ := cmd.Flags().GetString("location")
l, ok := internal.GetLocation(location)
if !ok {
CheckErr(fmt.Errorf("invalid location \"%s\"", location))
}
target, _ := cmd.Flags().GetString("to")
from, _ := cmd.Flags().GetString("from")
force, _ := cmd.Flags().GetBool("force")
snapshot := ""
if len(args) > 0 {
snapshot = args[0]
}
// Get optional flags
optional := []string{}
for _, flag := range []string{"include", "exclude", "iinclude", "iexclude"} {
values, err := cmd.Flags().GetStringSlice(flag)
if err == nil {
for _, value := range values {
optional = append(optional, "--"+flag, value)
}
}
}
err = l.Restore(target, from, force, snapshot, optional)
CheckErr(err)
},
}
func init() {
rootCmd.AddCommand(restoreCmd)
restoreCmd.Flags().BoolP("force", "f", false, "Force, target folder will be overwritten")
restoreCmd.Flags().String("from", "", "Which backend to use")
restoreCmd.Flags().String("to", "", "Where to restore the data")
restoreCmd.Flags().StringP("location", "l", "", "Location to be restored")
restoreCmd.MarkFlagRequired("location")
// Passed on flags
restoreCmd.Flags().StringSliceP("include", "i", []string{}, "Include a pattern")
restoreCmd.Flags().StringSliceP("exclude", "e", []string{}, "Exclude a pattern")
restoreCmd.Flags().StringSlice("iinclude", []string{}, "Include a pattern, case insensitive")
restoreCmd.Flags().StringSlice("iexclude", []string{}, "Exclude a pattern, case insensitive")
}

92
cmd/root.go Normal file
View File

@ -0,0 +1,92 @@
package cmd
import (
"os"
"path/filepath"
"strings"
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/flags"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
)
func CheckErr(err error) {
if err != nil {
colors.Error.Fprintln(os.Stderr, "Error:", err)
lock.Unlock()
os.Exit(1)
}
}
var cfgFile string
var rootCmd = &cobra.Command{
Version: internal.VERSION,
Use: "autorestic",
Short: "CLI Wrapper for restic",
Long: "Documentation:\thttps://autorestic.vercel.app\nSupport:\thttps://discord.gg/wS7RpYTYd2",
}
func Execute() {
CheckErr(rootCmd.Execute())
}
func init() {
rootCmd.PersistentFlags().StringVarP(&cfgFile, "config", "c", "", "config file (default is $HOME/.autorestic.yml or ./.autorestic.yml)")
rootCmd.PersistentFlags().BoolVar(&flags.CI, "ci", false, "CI mode disabled interactive mode and colors and enables verbosity")
rootCmd.PersistentFlags().BoolVarP(&flags.VERBOSE, "verbose", "v", false, "verbose mode")
rootCmd.PersistentFlags().StringVar(&flags.RESTIC_BIN, "restic-bin", "restic", "specify custom restic binary")
rootCmd.PersistentFlags().StringVar(&flags.DOCKER_IMAGE, "docker-image", "cupcakearmy/autorestic:"+internal.VERSION, "specify a custom docker image")
cobra.OnInitialize(initConfig)
}
func initConfig() {
if ci, _ := rootCmd.Flags().GetBool("ci"); ci {
colors.DisableColors(true)
flags.VERBOSE = true
}
if cfgFile != "" {
viper.SetConfigFile(cfgFile)
viper.AutomaticEnv()
if viper.ConfigFileUsed() == "" {
colors.Error.Printf("cannot read config file %s\n", cfgFile)
os.Exit(1)
}
} else {
configPaths := getConfigPaths()
for _, cfgPath := range configPaths {
viper.AddConfigPath(cfgPath)
}
if flags.VERBOSE {
colors.Faint.Printf("Using config paths: %s\n", strings.Join(configPaths, " "))
}
cfgFileName := ".autorestic"
viper.SetConfigName(cfgFileName)
viper.AutomaticEnv()
}
}
func getConfigPaths() []string {
result := []string{"."}
if home, err := homedir.Dir(); err == nil {
result = append(result, home)
}
{
xdgConfigHome, found := os.LookupEnv("XDG_CONFIG_HOME")
if !found {
if home, err := homedir.Dir(); err == nil {
xdgConfigHome = filepath.Join(home, ".config")
}
}
xdgConfig := filepath.Join(xdgConfigHome, "autorestic")
result = append(result, xdgConfig)
}
return result
}

36
cmd/root_test.go Normal file
View File

@ -0,0 +1,36 @@
package cmd
import (
"github.com/mitchellh/go-homedir"
"os"
"path/filepath"
"slices"
"testing"
)
const xdgConfigHome = "XDG_CONFIG_HOME"
func assertContains(t *testing.T, array []string, element string) {
if !slices.Contains(array, element) {
t.Errorf("Expected %s to be contained in %s", element, array)
}
}
func TestConfigResolving(t *testing.T) {
t.Run("~/.config/autorestic is used if XDG_CONFIG_HOME is not set", func(t *testing.T) {
// Override env using testing so that env gets restored after test
t.Setenv(xdgConfigHome, "")
_ = os.Unsetenv("XDG_CONFIG_HOME")
configPaths := getConfigPaths()
homeDir, _ := homedir.Dir()
expectedConfigPath := filepath.Join(homeDir, ".config/autorestic")
assertContains(t, configPaths, expectedConfigPath)
})
t.Run("XDG_CONFIG_HOME is respected if set", func(t *testing.T) {
t.Setenv(xdgConfigHome, "/foo/bar")
configPaths := getConfigPaths()
assertContains(t, configPaths, filepath.Join("/", "foo", "bar", "autorestic"))
})
}

20
cmd/uninstall.go Normal file
View File

@ -0,0 +1,20 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal/bins"
"github.com/spf13/cobra"
)
var uninstallCmd = &cobra.Command{
Use: "uninstall",
Short: "Uninstall restic and autorestic",
Run: func(cmd *cobra.Command, args []string) {
restic, _ := cmd.Flags().GetBool("restic")
bins.Uninstall(restic)
},
}
func init() {
rootCmd.AddCommand(uninstallCmd)
uninstallCmd.Flags().Bool("restic", false, "also uninstall restic.")
}

81
cmd/unlock.go Normal file
View File

@ -0,0 +1,81 @@
package cmd
import (
"bytes"
"fmt"
"os"
"os/exec"
"strings"
"github.com/cupcakearmy/autorestic/internal"
"github.com/cupcakearmy/autorestic/internal/colors"
"github.com/cupcakearmy/autorestic/internal/lock"
"github.com/spf13/cobra"
)
var unlockCmd = &cobra.Command{
Use: "unlock",
Short: "Unlock autorestic only if you are sure that no other instance is running",
Long: `Unlock autorestic only if you are sure that no other instance is running.
To check you can run "ps aux | grep autorestic".`,
Run: func(cmd *cobra.Command, args []string) {
internal.GetConfig()
force, _ := cmd.Flags().GetBool("force")
if !force && isAutoresticRunning() {
colors.Error.Print("Another autorestic instance is running. Are you sure you want to unlock? (yes/no): ")
var response string
fmt.Scanln(&response)
if strings.ToLower(response) != "yes" {
colors.Primary.Println("Unlocking aborted.")
return
}
}
err := lock.Unlock()
if err != nil {
colors.Error.Println("Could not unlock:", err)
return
}
colors.Success.Println("Unlock successful")
},
}
func init() {
rootCmd.AddCommand(unlockCmd)
unlockCmd.Flags().Bool("force", false, "force unlock")
}
// isAutoresticRunning checks if autorestic is running
// and returns true if it is.
// It also prints the processes to stdout.
func isAutoresticRunning() bool {
cmd := exec.Command("sh", "-c", "ps aux | grep autorestic")
var out bytes.Buffer
cmd.Stdout = &out
err := cmd.Run()
if err != nil {
return false
}
lines := strings.Split(out.String(), "\n")
autoresticProcesses := []string{}
currentPid := fmt.Sprint(os.Getpid())
for _, line := range lines {
if strings.Contains(line, "autorestic") && !strings.Contains(line, "grep autorestic") && !strings.Contains(line, currentPid) {
autoresticProcesses = append(autoresticProcesses, line)
}
}
if len(autoresticProcesses) > 0 {
colors.Faint.Println("Found autorestic processes:")
for _, proc := range autoresticProcesses {
colors.Faint.Println(proc)
}
return true
}
return false
}

21
cmd/upgrade.go Normal file
View File

@ -0,0 +1,21 @@
package cmd
import (
"github.com/cupcakearmy/autorestic/internal/bins"
"github.com/spf13/cobra"
)
var upgradeCmd = &cobra.Command{
Use: "upgrade",
Short: "Upgrade autorestic and restic",
Run: func(cmd *cobra.Command, args []string) {
restic, _ := cmd.Flags().GetBool("restic")
err := bins.Upgrade(restic)
CheckErr(err)
},
}
func init() {
rootCmd.AddCommand(upgradeCmd)
upgradeCmd.Flags().Bool("restic", true, "also update restic")
}

2
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
.next

1
docs/.nvmrc Normal file
View File

@ -0,0 +1 @@
v20.8.0

View File

@ -1,38 +0,0 @@
[Home](/)
[Quick Start](/quick)
[Installation](/installation)
[Configuration](/config)
> :Collapse label=Locations
>
> [Overview](/location/overview)
> [Hooks](/location/hooks)
> [Excluding Files](/location/exclude)
> [Forget Policy](/location/forget)
> [Cron](/location/cron)
> [Docker Volumes](/location/docker)
> :Collapse label=Backend
>
> [Overview](/backend/overview)
> [Available Backends](/backend/available)
> :Collapse label=CLI
>
> [General](/cli/general)
> [Info](/cli/info)
> [Check](/cli/check)
> [Backup](/cli/backup)
> [Restore](/cli/restore)
> [Forget](/cli/forget)
> [Cron](/cli/cron)
> [Exec](/cli/exec)
> [Install](/cli/install)
> [Uninstall](/cli/uninstall)
> [Update](/cli/update)
[Examples](/examples)
[QA](/qa)
[Contributors](/contrib)

View File

@ -1,13 +0,0 @@
# Backup
```bash
autorestic backup [-l, --location] [-a, --all]
```
Performs a backup of all locations if the `-a` flag is passed. To only backup some locations pass one or more `-l` or `--location` flags.
```bash
autorestic backup -l my-location
```
> :ToCPrevNext

View File

@ -1,15 +0,0 @@
# Check
```bash
autorestic check [-b, --backend] [-a, --all]
```
Cheks if one or more backend are configured properly and initializes them if they are not already.
This is mostly an internal command, but useful to verify if a backend is configured correctly.
```bash
autorestic check -b my-backend
```
> :ToCPrevNext

View File

@ -1,11 +0,0 @@
# Cron
```bash
autorestic cron
```
This command is mostly intended to be triggered by an automated system like systemd or crontab.
It will run cron jobs es [specified in the cron section](/locations/cron) of a specific location.
> :ToCPrevNext

View File

@ -1,15 +0,0 @@
# Exec
```bash
autorestic exec [-b, --backend] [-a, --all] <command> -- [native options]
```
This is avery handy command which enables you to run any native restic command on desired backends. An example would be listing all the snapshots of all your backends:
```bash
autorestic exec -a -- snapshots
```
With `exec` you can basically run every cli command that you would be able to run with the restic cli. It only pre-fills path, key, etc.
> :ToCPrevNext

View File

@ -1,11 +0,0 @@
# Forget
```bash
autorestic forget [-l, --location] [-a, --all] [--dry-run]
```
This will prune and remove old data form the backends according to the [keep policy you have specified for the location](/locations/forget)
The `--dry-run` flag will do a dry run showing what would have been deleted, but won't touch the actual data.
> :ToCPrevNext

View File

@ -1,29 +0,0 @@
# General
## `--version`
Prints the current version
```bash
autorestic --version
```
## `--c, --config`
Specify the config file to be used.
If omitted `autorestic` will search for for a `.autorestic.yml` in the current directory and your home directory.
```bash
autorestic -c /path/to/my/config.yml
```
## `--ci`
> Available since version 0.22
Run the CLI in CI Mode, which means there will be no interactivity.
This can be useful when you want to run cron e.g. as all the output will be saved.
```bash
autorestic --ci
```

View File

@ -1,17 +0,0 @@
# Restore
```bash
autorestic restore [-l, --location] [--from backend] [--to <out dir>]
```
This will restore all the locations to the selected target. If for one location there are more than one backends specified autorestic will take the first one.
## Example
```bash
autorestic restore -l home --from hdd --to /path/where/to/restore
```
This will restore the location `home` to the `/path/where/to/restore` folder and taking the data from the backend `hdd`
> :ToCPrevNext

View File

@ -1,9 +0,0 @@
# Uninstall
Installs both restic and autorestic from `/usr/local/bin`.
```bash
autorestic uninstall
```
> :ToCPrevNext

View File

@ -1,11 +0,0 @@
# Update
Autorestic can update itself! Super handy right? Simply run autorestic update and we will check for you if there are updates for restic and autorestic and install them if necessary.
```bash
autorestic update
```
Updates both restic and autorestic automagically.
> :ToCPrevNext

View File

@ -1,42 +0,0 @@
# 🎛 Config File
## Path
By default autorestic searches for a `.autorestic.yml` file in the current directory and your home folder.
- `./.autorestic.yml`
- `~/.autorestic.yml`
You can also specify a custom file with the `-c path/to/some/config.yml`
> **⚠️ WARNING ⚠️**
>
> Note that the data is automatically encrypted on the server. The key will be generated and added to your config file. Every backend will have a separate key. **You should keep a copy of the keys or config file somewhere in case your server dies**. Otherwise DATA IS LOST!
## Example configuration
```yaml | .autorestic.yml
locations:
home:
from: /home/me
to: remote
important:
from: /path/to/important/stuff
to:
- remote
- hdd
backends:
remote:
type: b2
path: 'myBucket:backup/home'
B2_ACCOUNT_ID: account_id
B2_ACCOUNT_KEY: account_key
hdd:
type: local
path: /mnt/my_external_storage
```
> :ToCPrevNext

View File

@ -1,8 +0,0 @@
# 🙋‍♀️🙋‍♂️ Contributors
This amazing people helped the project!
- @ChanceM [Docs]
- @EliotBerriot [Docs, Pruning, S3]
> :ToCPrevNext

View File

@ -1,21 +0,0 @@
# 🐣 Examples
## Exec
### List all the snapshots for all the backends
```bash
autorestic exec -a -- snapshots
```
### Unlock a locked repository
If you accidentally cancelled a running operation this could be useful.
Only do this if you know what you are doing.
```bash
autorestic exec -b my-backend -- unlock
```
> :ToCPrevNext

View File

@ -1,11 +0,0 @@
# 🛳 Installation
Linux & macOS. Windows is not supported. If you have problems installing please open an issue :)
Autorestic requires `curl`, `wget` and `bzip2` to be installed. For most systems these should be already installed.
```bash
curl -s https://raw.githubusercontent.com/CupCakeArmy/autorestic/master/install.sh | bash
```
> :ToCPrevNext

View File

@ -1,49 +0,0 @@
# Cron
Often it is usefull to trigger backups autmatically. For this we can specify a `cron` attribute to each location.
> Available since version 0.18
```yaml | .autorestic.yml
locations:
my-location:
from: /data
to: my-backend
cron: '0 3 * * 0' # Every Sunday at 3:00
```
Here is a awesome website with [some examples](https://crontab.guru/examples.html) and an [explorer](https://crontab.guru/)
## Installing the cron
**This has to be done only once, regadless of now many cros you have in your config file.**
To actually enable cron jobs you need something to call `autorestic cron` on a timed shedule.
Note that the shedule has nothing to do with the `cron` attribute in each location.
My advise would be to trigger the command every 5min, but if you have a cronjob that runs only once a week, it's probably enough to shedule it once a day.
### Crontab
Here is an example using crontab, but systemd would do too.
First, open your crontab in edit mode
```bash
crontab -e
```
Then paste this at the bottom of the file and save it. Note that in this specific example the `.autorestic.yml` is located in `/srv/`. You need to modify that part of course to fit your config file.
```bash
# This is required, as it otherwise cannot find restic as a command.
PATH="/usr/local/bin:/usr/bin:/bin"
# Example running every 5 minutes
*/5 * * * * autorestic -c /srv/.autorestic.yml --ci cron
```
> The `--ci` option is not required, but recommended
Now you can add as many `cron` attributes as you wish in the config file ⏱
> :ToCPrevNext

View File

@ -1,58 +0,0 @@
# Docker
autorestic supports docker volumes directly, without needing them to be mounted to the host filesystem.
> Available since version 0.13
Let see an example.
```yaml | docker-compose.yml
version: '3.7'
volumes:
data:
name: my-data
services:
api:
image: alpine
volumes:
- data:/foo/bar
```
```yaml | .autorestic.yml
locations:
hello:
from: 'volume:my-data'
to:
- remote
options:
forget:
keep-last: 14 # Useful for limitations explained belowd
backends:
remote: ...
```
Now you can backup and restore as always.
```bash
autorestic -l hello backup
```
```bash
autorestic -l hello restore
```
If the volume does not exist on restore, autorestic will create it for you and then fill it with the data.
## Limitations
Unfortunately there are some limitations when backing up directly from a docker volume without mounting the volume to the host:
1. Incremental updates are not possible right now due to how the current docker mounting works. This means that it will take significantely more space.
2. Exclude patterns and files also do not work as restic only sees a compressed tarball as source and not the actual data.
If you are curious or have ideas how to improve this, please [read more here](https://github.com/cupcakearmy/autorestic/issues/4#issuecomment-568771951). Any help is welcomed 🙂
> :ToCPrevNext

View File

@ -1,25 +0,0 @@
# Forget/Prune Policies
Autorestic supports declaring snapshot policies for location to avoid keeping old snapshot around if you don't need them.
This is based on [Restic's snapshots policies](https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy), and can be enabled for each location as shown below:
> **Note** This is a full example, of course you also can specify only one of them
```yaml | .autorestic.yml
locations:
etc:
from: /etc
to: local
options:
forget:
keep-last: 5 # always keep at least 5 snapshots
keep-hourly: 3 # keep 3 last hourly shapshots
keep-daily: 4 # keep 4 last daily shapshots
keep-weekly: 1 # keep 1 last weekly shapshots
keep-monthly: 12 # keep 12 last monthly shapshots
keep-yearly: 7 # keep 7 last yearly shapshots
keep-within: '2w' # keep snapshots from the last 2 weeks
```
> :ToCPrevNext

View File

@ -1,18 +0,0 @@
# Hooks
Sometimes you might want to stop an app/db before backing up data and start the service again after the backup has completed. This is what the hooks are made for. Simply add them to your location config. You can have as many commands as you wish.
```yml | .autorestic.yml
locations:
my-location:
from: /data
to: my-backend
hooks:
before:
- echo "Hello"
- echo "Human"
after:
- echo "kthxbye"
```
> :ToCPrevNext

6
docs/next.config.js Normal file
View File

@ -0,0 +1,6 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
})
module.exports = withNextra()

14
docs/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"scripts": {
"build": "NEXT_TELEMETRY_DISABLED=1 next build",
"dev": "NEXT_TELEMETRY_DISABLED=1 next"
},
"dependencies": {
"next": "^13.5.3",
"nextra": "^2.13.1",
"nextra-theme-docs": "^2.13.1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"packageManager": "pnpm@8.8.0"
}

10
docs/pages/_meta.json Normal file
View File

@ -0,0 +1,10 @@
{
"index": "Home",
"quick": "Quick Start",
"installation": "Installation",
"config": "Configuration",
"location": "Locations",
"backend": "Backend",
"cli": "CLI",
"migration": "Migration"
}

View File

@ -0,0 +1,6 @@
{
"index": "Overview",
"available": "Available backends",
"options": "Options",
"env": "Environment"
}

View File

@ -4,6 +4,8 @@ In theory [all the restic backends](https://restic.readthedocs.io/en/stable/030_
Those tested are the following:
> You can also [specify the `env` variables in a config file](/backend/env) to separate them from the config file.
## Local
```yaml
@ -19,11 +21,18 @@ backends:
backends:
name-of-backend:
type: b2
path: 'myAccount:myBucket/my/path'
B2_ACCOUNT_ID: backblaze_account_id
B2_ACCOUNT_KEY: backblaze_account_key
path: 'bucket_name'
# Or With a path
# path: 'bucket_name:/some/path'
env:
B2_ACCOUNT_ID: 'backblaze_keyID'
B2_ACCOUNT_KEY: 'backblaze_applicationKey'
```
#### API Keys gotcha
If you use a _File name prefix_ when making the application key, do not include a leading slash. Make sure to include this prefix in the path (e.g. `path: 'bucket_name:my/path'`).
## S3 / Minio
```yaml
@ -33,8 +42,9 @@ backends:
path: s3.amazonaws.com/bucket_name
# Minio
# path: http://localhost:9000/bucket_name
AWS_ACCESS_KEY_ID: my_key
AWS_SECRET_ACCESS_KEY: my_secret
env:
AWS_ACCESS_KEY_ID: my_key
AWS_SECRET_ACCESS_KEY: my_secret
```
## SFTP
@ -57,6 +67,19 @@ backends:
name-of-backend:
type: rest
path: http://localhost:8000/repo_name
# Or authenticated
path: https://user:pass@host:6969/path
```
> :ToCPrevNext
Optionally you can set user and password separately
```yaml
backends:
rest:
type: rest
path: http://localhost:6969/path
key: ...
rest:
user: user
password: pass
```

65
docs/pages/backend/env.md Normal file
View File

@ -0,0 +1,65 @@
# Environment
> ⚠ Available since version `v1.4.0`
Sometimes it's favorable not having the encryption keys in the config files.
For that `autorestic` allows passing the env variables to backend password as `ENV` variables, or through an env file.
You can also pass whatever `env` variable to restic by prefixing it with `AUTORESTIC_[BACKEND NAME]_`.
> Env variables and file overwrite the config file in the following order:
>
> Env Variables > Env File (`.autorestic.env`) > Config file (`.autorestic.yaml`)
## Env file
Alternatively `autorestic` can load an env file, located next to `.autorestic.yml` called `.autorestic.env`.
```
AUTORESTIC_FOO_RESTIC_PASSWORD=secret123
```
### Example with repository password
The syntax for the `ENV` variables is as follows: `AUTORESTIC_[BACKEND NAME]_RESTIC_PASSWORD`.
```yaml | autorestic.yaml
backend:
foo:
type: ...
path: ...
key: secret123 # => AUTORESTIC_FOO_RESTIC_PASSWORD=secret123
```
This means we could remove `key: secret123` from `.autorestic.yaml` and execute as follows:
```bash
AUTORESTIC_FOO_RESTIC_PASSWORD=secret123 autorestic backup ...
```
### Example with Backblaze B2
```yaml | autorestic.yaml
backends:
bb:
type: b2
path: myBucket
key: myPassword
env:
B2_ACCOUNT_ID: 123
B2_ACCOUNT_KEY: 456
```
You could create an `.autorestic.env` or pass the following `ENV` variables to autorestic:
```
AUTORESTIC_BB_RESTIC_PASSWORD=myPassword
AUTORESTIC_BB_B2_ACCOUNT_ID=123
AUTORESTIC_BB_B2_ACCOUNT_KEY=456
```
```yaml | autorestic.yaml
backends:
bb:
type: b2
path: myBucket
```

View File

@ -1,8 +1,12 @@
# 💽 Backends
Backends are the ouputs of the backup process. Each location needs at least one.
Backends are the outputs of the backup process. Each location needs at least one.
Note: names of backends MUST be lower case!
```yaml | .autorestic.yml
version: 2
backends:
name-of-backend:
type: local
@ -12,5 +16,3 @@ backends:
## Types
We restic supports multiple types of backends. See the [full list](/backend/available) for details.
> :ToCPrevNext

View File

@ -0,0 +1,17 @@
# Options
> For more detail see the [location docs](/location/options) for options, as they are the same.
```yaml
backend:
foo:
type: ...
path: ...
options:
backup:
tag:
- foo
- bar
```
In this example, whenever `autorestic` runs `restic backup` it will append a `--tag abc --tag` to the native command.

View File

@ -0,0 +1,3 @@
{
"general": "General"
}

23
docs/pages/cli/backup.md Normal file
View File

@ -0,0 +1,23 @@
# Backup
```bash
autorestic backup [-l, --location] [-a, --all]
```
Performs a backup of all locations if the `-a` flag is passed. To only backup some locations pass one or more `-l` or `--location` flags.
```bash
# All
autorestic backup -a
# Some
autorestic backup -l foo -l bar
```
## Specific location
`autorestic` also allows selecting specific backends for a location with the `location@backend` syntax.
```bash
autorestic backup -l location@backend
```

9
docs/pages/cli/check.md Normal file
View File

@ -0,0 +1,9 @@
# Check
```bash
autorestic check
```
Checks locations and backends are configured properly and initializes them if they are not already.
This is mostly an internal command, but useful to verify if a backend is configured correctly.

View File

@ -0,0 +1,15 @@
# Completion
```bash
autorestic completion [bash|zsh|fish|powershell]
```
Autorestic can generate shell completions automatically to make the experience even easier.
Supported shells are
- bash
- zsh
- fish
- powershell
To see how to install run `autorestic help completion` and follow the instructions for your specific shell

11
docs/pages/cli/cron.md Normal file
View File

@ -0,0 +1,11 @@
# Cron
```bash
autorestic cron [--lean]
```
This command is mostly intended to be triggered by an automated system like systemd or crontab.
It will run cron jobs as [specified in the cron section](/location/cron) of a specific location.
The `--lean` flag will omit output like _skipping location x: not due yet_. This can be useful if you are dumping the output of the cron job to a log file and don't want to be overwhelmed by the output log.

13
docs/pages/cli/exec.md Normal file
View File

@ -0,0 +1,13 @@
# Exec
```bash
autorestic exec [-b, --backend] [-a, --all] <command> -- [native options]
```
This is a very handy command which enables you to run any native restic command on desired backends. Generally you will want to include the verbose flag `-v, --verbose` to see the output. An example would be listing all the snapshots of all your backends:
```bash
autorestic exec -av -- snapshots
```
With `exec` you can basically run every cli command that you would be able to run with the restic cli. It only pre-fills path, key, etc.

11
docs/pages/cli/forget.md Normal file
View File

@ -0,0 +1,11 @@
# Forget
```bash
autorestic forget [-l, --location] [-a, --all] [--dry-run] [--prune]
```
This will prune and remove old data form the backends according to the [keep policy you have specified for the location](/location/options/forget).
The `--dry-run` flag will do a dry run showing what would have been deleted, but won't touch the actual data.
The `--prune` flag will also [prune the data](https://restic.readthedocs.io/en/latest/060_forget.html#removing-backup-snapshots). This is a costly operation that can take longer, however it will free up the actual space.

36
docs/pages/cli/general.md Normal file
View File

@ -0,0 +1,36 @@
# General
## `-c, --config`
Specify the config file to be used (must use .yml as an extension).
If omitted `autorestic` will search for for a `.autorestic.yml` in the current directory and your home directory.
```bash
autorestic -c /path/to/my/config.yml
```
## `--ci`
Run the CLI in CI Mode, which means there will be no interactivity, no colors and automatically sets the `--verbose` flag.
This can be useful when you want to run cron e.g. as all the output will be saved.
```bash
autorestic --ci backup -a
```
## `-v, --verbose`
Verbose mode will show the output of the native restic commands that are otherwise not printed out. Useful for debugging or logging in automated tasks.
```bash
autorestic --verbose backup -a
```
## `--restic-bin`
With `--restic-bin` you can specify to run a specific restic binary. This can be useful if you want to [create a custom binary with root access that can be executed by any user](https://restic.readthedocs.io/en/stable/080_examples.html#full-backup-without-root).
```bash
autorestic --restic-bin /some/path/to/my/custom/restic/binary
```

View File

@ -14,5 +14,3 @@ autorestic info
```bash
autorestic -c path/to/some/config.yml info
```
> :ToCPrevNext

View File

@ -5,5 +5,3 @@ Installs both restic and autorestic to `/usr/local/bin`.
```bash
autorestic install
```
> :ToCPrevNext

17
docs/pages/cli/restore.md Normal file
View File

@ -0,0 +1,17 @@
# Restore
```bash
autorestic restore [-l, --location] [--from backend] [--to <out dir>] [-f, --force] [snapshot]
```
This will restore the location to the selected target. If for one location there are more than one backends specified autorestic will take the first one. If no specific snapshot is specified `autorestic` will use `latest`.
If you are sure you can pass the `-f, --force` flag and the data will be overwritten in the destination. However note that this will overwrite all the data existent in the backup, not only the 1 file that is missing e.g.
## Example
```bash
autorestic restore -l home --from hdd --to /path/where/to/restore
```
This will restore the location `home` to the `/path/where/to/restore` folder and taking the data from the backend `hdd`

View File

@ -0,0 +1,7 @@
# Uninstall
Uninstalls both restic and autorestic from `/usr/local/bin`.
```bash
autorestic uninstall
```

32
docs/pages/cli/unlock.md Normal file
View File

@ -0,0 +1,32 @@
# Unlock
In case autorestic throws the error message `an instance is already running. exiting`, but there is no instance running you can unlock the lock.
To verify that there is no instance running you can use `ps aux | grep autorestic`.
Example with no instance running:
```bash
> ps aux | grep autorestic
root 39260 0.0 0.0 6976 2696 pts/11 S+ 19:41 0:00 grep autorestic
```
Example with an instance running:
```bash
> ps aux | grep autorestic
root 29465 0.0 0.0 1162068 7380 pts/7 Sl+ 19:28 0:00 autorestic --ci backup -a
root 39260 0.0 0.0 6976 2696 pts/11 S+ 19:41 0:00 grep autorestic
```
**If an instance is running you should not unlock as it could lead to data loss!**
```bash
autorestic unlock
```
Use the `--force` to prevent the confirmation prompt if an instance is running.
```bash
autorestic unlock --force
```

View File

@ -0,0 +1,9 @@
# Upgrade
Autorestic can upgrade itself! Super handy right? Simply run autorestic upgrade and we will check for you if there are updates for restic and autorestic and install them if necessary.
```bash
autorestic upgrade
```
Updates both restic and autorestic automagically.

17
docs/pages/community.md Normal file
View File

@ -0,0 +1,17 @@
# 🏘 Community
## Software
A list of community driven projects. (No official affiliation)
- SystemD Units: <https://gitlab.com/py_crash/autorestic-systemd-units>
- Docker image: <https://github.com/pascaliske/docker-autorestic>
- Ansible Role: <https://github.com/adsanz/ansible-restic-role>
- Ansible Role: <https://github.com/ItsNotGoodName/ansible-role-autorestic>
- Ansible Role: <https://github.com/FuzzyMistborn/ansible-role-autorestic>
- Ansible Role: <https://0xacab.org/varac-projects/ansible-role-autorestic>
- Ansible Role: <https://github.com/dbrennand/ansible-role-autorestic>
## Writing
- [restic: excellent resource for local and cloud backup](https://notes.nicfab.eu/en/posts/restic/)

88
docs/pages/config.md Normal file
View File

@ -0,0 +1,88 @@
# 🎛 Config File
## Path
By default autorestic searches for a `.autorestic.yml` file in the current directory, your home folder and your XDG config folder (`~/.config/` by default):
- `./.autorestic.yml`
- `~/.autorestic.yml`
- `~/.config/autorestic/.autorestic.yml`
You can also specify a custom file with the `-c path/to/some/config.yml`
> **⚠️ WARNING ⚠️**
>
> Note that the data is automatically encrypted on the server. The key will be generated and added to your config file. Every backend will have a separate key. **You should keep a copy of the keys or config file somewhere in case your server dies**. Otherwise DATA IS LOST!
## Example configuration
```yaml | .autorestic.yml
version: 2
locations:
home:
from: /home/me
to: remote
important:
from: /path/to/important/stuff
to:
- remote
- hdd
backends:
remote:
type: b2
path: 'myBucket:backup/home'
env:
B2_ACCOUNT_ID: account_id
B2_ACCOUNT_KEY: account_key
hdd:
type: local
path: /mnt/my_external_storage
```
## Aliases
A handy tool for more advanced configurations is to use yaml aliases.
These must be specified under the global `extras` key in the `.autorestic.yml` config file.
Aliases allow to reuse snippets of config throughout the same file.
The following example shows how the locations `a` and `b` share the same hooks and forget policies.
```yaml | .autorestic.yml
version: 2
extras:
hooks: &foo
prevalidate:
- echo "Wake up!"
before:
- echo "Hello"
after:
- echo "kthxbye"
policies: &bar
keep-daily: 14
keep-weekly: 52
backends:
# ...
locations:
a:
from: /data/a
to: some
hooks:
<<: *foo
options:
forget:
<<: *bar
b:
from: data/b
to: some
hooks:
<<: *foo
options:
forget:
<<: *bar
```

View File

@ -0,0 +1,19 @@
# 🙋‍♀️🙋‍♂️ Contributors
This amazing people helped the project!
- @agateblue - Docs, Pruning, S3.
- @g-a-c - Update/Install bugs.
- @jjromannet - Bug fixes.
- @fariszr - Docker image improvements.
- @david-boles - Docs.
- @SebDanielsson - Brew.
- @n194 - AUR Package.
- @olofvndrhr - Healthchecks example.
- @jin-park-dev - Typos.
- @sumnerboy12 - Typos.
- @FuzzyMistborn - Typos.
- @ChanceM - Typos.
- @TheForcer - Typos.
- @themorlan - Typos.
- @somebox - Typos.

28
docs/pages/docker.md Normal file
View File

@ -0,0 +1,28 @@
# 🐳 Docker
The docker image is build with rclone and restic already included. It's ment more as a utility image.
## Remote hosts
For remote backups (S3, B2, GCS, etc.) it's quite easy, as you only need to mount the config file and the data to backup.
```bash
docker run --rm \\
-v $(pwd):/data \\
cupcakearmy/autorestic \\
autorestic backup -va -c /data/.autorestic.yaml
```
## Rclone
For rclone you will have to also mount the rclone config file to `/root/.config/rclone/rclone.conf`.
To check where it is located you can run the following command: `rclone config file`.
**Example**
```bash
docker run \\
-v /home/user/.config/rclone/rclone.conf:/root/.config/rclone/rclone.conf:ro \\
...
```

38
docs/pages/examples.md Normal file
View File

@ -0,0 +1,38 @@
# 🐣 Examples
## List all the snapshots for all the backends
```bash
autorestic exec -av -- snapshots
```
## Unlock a locked repository
This can come in handy if a backup process crashed or if it was accidentally cancelled. Then the repository would still be locked without an actual process using it. Only do this if you know what you are doing and are sure no other process is actually reading/writing to the repository of course.
```bash
autorestic exec -b my-backend -- unlock
```
## Use hooks to integrate with [healthchecks](https://healthchecks.io/)
> Thanks to @olofvndrhr for providing it ❤️
```yaml
extras:
healthchecks: &healthchecks
hooks:
before:
- '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'
failure:
- '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'
success:
- 'curl -m 10 --retry 5 -X POST -H "Content-Type: text/plain" --data "Backup successful for location: ${AUTORESTIC_LOCATION}" https://<healthchecks-url>/ping/<uid>'
locations:
something:
<<: *healthchecks
from: /somewhere
to:
- somewhere-else
```

View File

@ -1,16 +1,10 @@
# `autorestic`
# autorestic
High backup level CLI utility for [restic](https://restic.net/).
Autorestic is a wrapper around the amazing [restic](https://restic.net/). While being amazing the restic cli can be a bit overwhelming and difficult to manage if you have many different location that you want to backup to multiple locations. This utility is aimed at making this easier 🙂
<!-- ![Sketch](./docs/Sketch.png) -->
## ✈️ Roadmap
~~I would like to make the official `1.0` release in the coming months. Until then please feel free to file issues or feature requests so that the tool is as flexible as possible :)~~
As of version `0.18` crons are supported wich where the last feature missing for a `1.0`. Will test this for a few weeks and then it's time for the first "real" release! 🎉 Also we now have waaay better docs 📒
> If you are coming from `0.x` see the [upgrade guide](/upgrade).
## 🌈 Features
@ -19,9 +13,8 @@ As of version `0.18` crons are supported wich where the last feature missing for
- Backup locations to multiple backends
- Snapshot policies and pruning
- Fully encrypted
- Pre/After hooks
- Before/after backup hooks
- Exclude pattern/files
- Cron jobs for automatic backup
- Backup & Restore docker volumes
> :ToCPrevNext
- Generated completions for `[bash|zsh|fish|powershell]`

View File

@ -0,0 +1,33 @@
# 🛳 Installation
Linux & macOS. Windows is not supported. If you have problems installing please open an issue :)
Autorestic requires `bash`, `wget` and `bzip2` to be installed. For most systems these should be already installed.
```bash
wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash
```
## Alternatives
### Docker
There is an official docker image over at [cupcakearmy/autorestic](https://hub.docker.com/r/cupcakearmy/autorestic).
For some examples see [here](/docker).
### Manual
You can download the right binary from the release page and simply copy it to `/usr/local/bin` or whatever path you prefer. Autoupdates will still work.
### Brew
If you are on macOS you can install through brew: `brew install autorestic`.
### Fedora
Fedora users can install the [autorestic](https://src.fedoraproject.org/rpms/autorestic/) package with `dnf install autorestic`.
### AUR
If you are on Arch there is an [AUR Package](https://aur.archlinux.org/packages/autorestic-bin/)

View File

@ -0,0 +1,7 @@
{
"index": "Overview",
"hooks": "Hooks",
"options": "Options",
"cron": "Cronjobs",
"docker": "Docker volumes"
}

View File

@ -0,0 +1,53 @@
# Cron
Often it is useful to trigger backups automatically. For this, we can specify a `cron` attribute to each location.
```yaml | .autorestic.yml
locations:
my-location:
from: /data
to: my-backend
cron: '0 3 * * 0' # Every Sunday at 3:00
```
Here is an awesome website with [some examples](https://crontab.guru/examples.html) and an [explorer](https://crontab.guru/).
## Installing the cron
**This has to be done only once, regardless of how many cron jobs you have in your config file.**
To actually enable cron jobs you need something to call `autorestic cron` on a timed schedule.
Note that the schedule has nothing to do with the `cron` attribute in each location.
My advice would be to trigger the command every 5min, but if you have a cronjob that runs only once a week, it's probably enough to schedule it once a day.
### Crontab
Here is an example using crontab, but systemd would do too.
First, open your crontab in edit mode
```bash
crontab -e
```
Then paste this at the bottom of the file and save it. Note that in this specific example the config file is located at one of the default locations (e.g. `~/.autorestic.yml`). If your config is somewhere else you'll need to specify it using the `-c` option.
```bash
# This is required, as it otherwise cannot find restic as a command.
PATH="/usr/local/bin:/usr/bin:/bin"
# Example running every 5 minutes
*/5 * * * * autorestic -c /path/to/my/.autorestic.yml --ci cron
```
> The `--ci` option is not required, but recommended
To debug a cron job you can use
```bash
*/5 * * * * autorestic -c /path/to/my/.autorestic.yml --ci cron > /tmp/autorestic.log 2>&1
```
Now you can add as many `cron` attributes as you wish in the config file ⏱
> Also note that manually triggered backups with `autorestic backup` will not influence the cron timeline, they are intentionally not linked.

View File

@ -0,0 +1,37 @@
# Docker
autorestic supports docker volumes directly, without needing them to be mounted to the host filesystem.
```yaml | docker-compose.yml
version: '3.8'
volumes:
data:
name: my-data
services:
api:
image: alpine
volumes:
- data:/foo/bar
```
```yaml | .autorestic.yml
locations:
foo:
from: my-data
type: volume
# ...
```
Now you can backup and restore as always.
```bash
autorestic backup -l hello
```
```bash
autorestic restore -l hello
```
The volume has to exists whenever backing up or restoring.

View File

@ -0,0 +1,85 @@
# Hooks
If you want to perform some commands before and/or after a backup, you can use hooks.
They consist of a list of commands that will be executed in the same directory as the target `from`.
The following hooks groups are supported, none are required:
- `prevalidate`
- `before`
- `after`
- `failure`
- `success`
The difference between `prevalidate` and `before` hooks are that `prevalidate` is run before checking the backup location is valid, including checking that the `from` directories exist. This can be useful, for example, to mount the source filesystem that contains the directories listed in `from`.
```yml | .autorestic.yml
locations:
my-location:
from: /data
to: my-backend
hooks:
prevalidate:
- echo "Checks"
before:
- echo "One"
- echo "Two"
- echo "Three"
after:
- echo "Bye"
failure:
- echo "Something went wrong"
success:
- echo "Well done!"
```
## Flowchart
1. `prevalidate` hook
2. Check backup location
3. `before` hook
4. Run backup
5. `after` hook
6. - `success` hook if no errors were found
- `failure` hook if at least one error was encountered
If either the `prevalidate` or `before` hook encounters errors then the backup and `after` hooks will be skipped and only the `failed` hooks will run.
## Environment variables
All hooks are exposed to the `AUTORESTIC_LOCATION` environment variable, which contains the location name.
The `after` and `success` hooks have access to additional information with the following syntax:
```bash
AUTORESTIC_[TYPE]_[I]
AUTORESTIC_[TYPE]_[BACKEND_NAME]
```
Every type of metadata is appended with both the name of the backend associated with and the number in which the backends where executed.
### Available Metadata Types
- `SNAPSHOT_ID`
- `PARENT_SNAPSHOT_ID`
- `FILES_ADDED`
- `FILES_CHANGED`
- `FILES_UNMODIFIED`
- `DIRS_ADDED`
- `DIRS_CHANGED`
- `DIRS_UNMODIFIED`
- `ADDED_SIZE`
- `PROCESSED_FILES`
- `PROCESSED_SIZE`
- `PROCESSED_DURATION`
#### Example
Assuming you have a location `bar` that backs up to a single backend named `foo` you could expect the following env variables:
```bash
AUTORESTIC_LOCATION=bar
AUTORESTIC_FILES_ADDED_0=42
AUTORESTIC_FILES_ADDED_FOO=42
```

View File

@ -3,10 +3,18 @@
Locations can be seen as the input to the backup process. Generally this is simply a folder.
The paths can be relative from the config file. A location can have multiple backends, so that the data is secured across multiple servers.
Note: names of locations MUST be lower case!
```yaml | .autorestic.yml
version: 2
locations:
my-location-name:
from: path/to/backup
# Or multiple
# from:
# - /a
# - /b
to:
- name-of-backend
- also-backup-to-this-backend
@ -14,7 +22,7 @@ locations:
## `from`
This is the source of the location.
This is the source of the location. Can be an `array` for multiple sources.
#### How are paths resolved?
@ -22,6 +30,4 @@ Paths can be absolute or relative. If relative they are resolved relative to the
## `to`
This is einther a single backend or an array of backends. The backends have to be configured in the same config file.
> :ToCPrevNext
This is either a single backend or an array of backends. The backends have to be configured in the same config file.

View File

@ -0,0 +1,3 @@
{
"index": "Overview"
}

View File

@ -0,0 +1,31 @@
# Copy
Instead of specifying multiple `to` backends for a given `location` you can also use the `copy` option. Instead of recalculating the backup multiple times, you can copy the freshly copied snapshot from one backend to the other, avoiding recomputation.
###### Example
```yaml | .autorestic.yml
locations:
my-location:
from: /data
to:
- a #Fast
- b #Fast
- c #Slow
```
Becomes
```yaml | .autorestic.yml
locations:
my-location:
from: /data
to:
- a
- b
copy:
a:
- c
```
Instead of backing up to each backend separately, you can choose that the snapshot created to `a` will be copied over to `c`, avoiding heavy computation on `c`.

View File

@ -1,6 +1,6 @@
# Excluding files
If you want to exclude certain files or folders it done easily by specifiyng the right flags in the location you desire to filter.
If you want to exclude certain files or folders it done easily by specifying the right flags in the location you desire to filter.
The flags are taken straight from the [restic cli exclude rules](https://restic.readthedocs.io/en/latest/040_backup.html#excluding-files) so you can use any flag used there.
@ -16,5 +16,3 @@ locations:
- '*.abc'
exclude-file: .gitignore
```
> :ToCPrevNext

View File

@ -0,0 +1,55 @@
# Forget/Prune Policies
Autorestic supports declaring snapshot policies for location to avoid keeping old snapshot around if you don't need them.
This is based on [Restic's snapshots policies](https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy), and can be enabled for each location as shown below:
> **Note** This is a full example, of course you also can specify only one of them
```yaml | .autorestic.yml
version: 2
locations:
etc:
from: /etc
to: local
options:
forget:
keep-last: 5 # always keep at least 5 snapshots
keep-hourly: 3 # keep 3 last hourly snapshots
keep-daily: 4 # keep 4 last daily snapshots
keep-weekly: 1 # keep 1 last weekly snapshots
keep-monthly: 12 # keep 12 last monthly snapshots
keep-yearly: 7 # keep 7 last yearly snapshots
keep-within: '14d' # keep snapshots from the last 14 days
```
## Globally
You can specify global forget policies that would be applied to all locations:
```yaml | .autorestic.yml
version: 2
global:
forget:
keep-daily: 30
keep-weekly: 52
```
## Automatically forget after backup
You can also configure `autorestic` to automatically run the forget command for you after every backup. You can do that by specifying the `forget` option.
```yaml | .autorestic.yml
version: 2
locations:
etc:
from: /etc
to: local
forget: prune # Or only "yes" if you don't want to prune
options:
forget:
keep-last: 5
```

View File

@ -0,0 +1,65 @@
# Options
For the `backup` and `forget` commands you can pass any native flags to `restic`. In addition you can specify flags for every command with `all`.
If flags don't start with `-` they will get prefixed with `--`.
Flags without arguments can be set to `true`. They will be handled accordingly.
> It is also possible to set options for an [entire backend](/backend/options) or globally (see below).
```yaml
locations:
foo:
# ...
options:
all:
some-flag: 123
# Equivalent to
--some-flag: 123
backup:
boolean-flag: true
tag:
- foo
- bar
```
## Example
In this example, whenever `autorestic` runs `restic backup` it will append a `--tag foo --tag bar` to the native command.
```yaml
locations:
foo:
path: ...
to: ...
options:
backup:
tag:
- foo
- bar
```
## Priority
Options can be set globally, on the backends or on the locations.
The priority is as follows: `location > backend > global`.
## Global Options
It is possible to specify global flags that will be run every time restic is invoked. To do so specify them under `global` in your config file.
```yaml
global:
all:
cache-dir: ~/restic
backup:
tag:
- foo
backends:
# ...
locations:
# ...
```

4
docs/pages/migration.md Normal file
View File

@ -0,0 +1,4 @@
# Migration
- [From 0.x to 1.0](/migration/0.x_1.0)
- [From 1.4 to 1.5](/migration/1.4_1.5)

View File

@ -0,0 +1,24 @@
# From `0.x` to `1.0`
Most of the config file is remained compatible, however to clean up the backends custom environment variables were moved from the root object to an `env` object.
```yaml
# Before
remote:
type: b2
path: bucket:path/to/backup
key: some random encryption key
B2_ACCOUNT_ID: id
B2_ACCOUNT_KEY: key
# After
remote:
type: b2
path: bucket:path/to/backup
key: some random encryption key
env:
B2_ACCOUNT_ID: id
B2_ACCOUNT_KEY: key
```
Other than the config file there is a new `-v, --verbose` flag which shows the output of native commands, which are now hidden by default.

View File

@ -0,0 +1,66 @@
# Migration from `1.4` to `1.5`
## ⚠️ Important notes
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.
## Config files
- The config file now required to have a version number. This has to be added with `version: 2` at the root.
- Hooks now optionally support `dir: /some/dir` in the [options object](https://pkg.go.dev/github.com/cupcakearmy/autorestic/internal#Hooks).
- Docker volumes don't get prefixed with `volume:` anymore, rather you have to set the `type: volume` in the [location config](https://pkg.go.dev/github.com/cupcakearmy/autorestic/internal#Hooks).
See detailed instructions below.
## Config Version
```yaml
version: 2 # Added
backends:
# ...
```
## Hooks
Since `1.5` multiple sources for a location are possible.
For this reason, while before hooks where executed in the folder of the source, now they are executed in the directory of the config `.autorestic.yaml`.
You can overwrite this behavior with the new `dir` option in the hook section of the config.
```yaml
locations:
l1:
# ...
from: /foo/bar
hooks:
dir: /foo/bar
before: pwd
```
## Docker volumes
The syntax with docker volumes has changed and needs to be adjusted.
```yaml
# Before
locations:
foo:
from: volume:my-data
```
```yaml
# After
locations:
foo:
from: my-data
type: volume
```
## Tagging
Autorestic changed the way backups are referenced. Before we took the paths as the identifying information. Now autorestic uses native restic tags to reference them. This means that old backups are not referenced. You can the old snapshots manually. An example can be shown below.
```bash
autorestic exec -va -- tag --add ar:location:LOCATION_NAME # Only if you have only one location
```

Some files were not shown because too many files have changed in this diff Show More