-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(backend)!: Add backend to config and use rustic_backend
#977
Changes from 6 commits
1683847
9cdf754
cea65ca
4eeb8d8
10b7c1c
1ec83f6
e9e8e52
bc49b67
78343aa
9096ee1
c3d74a6
8af0ca4
aa56949
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ rustdoc-args = ["--document-private-items", "--generate-link-to-definition"] | |
|
||
[dependencies] | ||
abscissa_core = { workspace = true } | ||
rustic_backend = { workspace = true } | ||
rustic_core = { workspace = true } | ||
|
||
# errors | ||
|
@@ -64,6 +65,7 @@ log = { workspace = true } | |
# serialization | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
serde_path_to_error = { workspace = true } | ||
serde_with = { workspace = true } | ||
|
||
# other dependencies | ||
|
@@ -85,24 +87,30 @@ humantime = { workspace = true } | |
indicatif = { workspace = true } | ||
itertools = { workspace = true } | ||
jemallocator-global = { version = "0.3.2", optional = true } | ||
mimalloc = { version = "0.1.39", default_features = false, optional = true } | ||
mimalloc = { version = "0.1.39", default-features = false, optional = true } | ||
rhai = { workspace = true } | ||
simplelog = { workspace = true } | ||
|
||
[dev-dependencies] | ||
abscissa_core = { workspace = true, features = ["testing"] } | ||
aho-corasick = { workspace = true } | ||
dircmp = { workspace = true } | ||
insta = { version = "1.34.0", features = ["toml"] } | ||
once_cell = { workspace = true } | ||
pretty_assertions = { workspace = true } | ||
rstest = { workspace = true } | ||
rustic_testing = { path = "crates/rustic_testing" } | ||
tempfile = { workspace = true } | ||
toml = { workspace = true } | ||
toml = { workspace = true, features = ["parse", "preserve_order"] } | ||
toml_edit = { workspace = true, features = ["serde"] } | ||
|
||
[target.'cfg(not(windows))'.dependencies] | ||
libc = "0.2.150" | ||
[workspace.dependencies] | ||
rustic_core = { version = "0.1.2", features = ["cli"] } | ||
rustic_core = { path = "../rustic_core/crates/core", features = ["cli"] } | ||
rustic_backend = { path = "../rustic_core/crates/backends" } | ||
# rustic_core = { version = "0.1.2", features = ["cli"] } | ||
|
||
abscissa_core = { version = "0.7.0", default-features = false, features = ["application"] } | ||
|
||
# logging | ||
|
@@ -117,6 +125,8 @@ anyhow = "1" | |
serde = { version = "1", features = ["serde_derive"] } | ||
serde_with = { version = "3.4", features = ["base64"] } | ||
serde_json = "1" | ||
serde_path_to_error = "0.1.14" | ||
toml_edit = { version = "0.21.0", features = ["serde"] } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: remove, we have |
||
|
||
# other dependencies | ||
aho-corasick = "1.1.2" | ||
|
@@ -146,7 +156,7 @@ quickcheck = "1" | |
quickcheck_macros = "1" | ||
tempfile = "3.8" | ||
pretty_assertions = "1.4" | ||
toml = "0.8" | ||
toml = { version = "0.8", features = ["parse", "preserve_order"] } | ||
dircmp = "0.2" | ||
|
||
# cargo-binstall support | ||
|
@@ -201,6 +211,11 @@ lto = true | |
debug-assertions = false | ||
codegen-units = 1 | ||
|
||
# Faster insta testing runs | ||
[profile.dev.package] | ||
insta = { opt-level = 3 } | ||
similar = { opt-level = 3 } | ||
|
||
# Allows quick RPM file generation, if "cargo-generate-rpm" is installed: | ||
# cargo build --release; cargo generate-rpm | ||
# will result in a file like target/generate-rpm/rustic-rs-0.6.1-1.x86_64.rpm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,32 @@ | |
# If the config file is named "copy_example.toml", run "rustic -P copy_example copy" to copy all snapshots. | ||
# See "rustic copy --help" for options how to select or filter snapshots to copy. | ||
|
||
# [repository] specified the source repository | ||
[repository] | ||
# [backend] specifies the backend for a repository | ||
[backend] | ||
repository = "/tmp/repo" | ||
|
||
# [repository] specifies the options for a repository | ||
[repository] | ||
password = "test" | ||
|
||
# you can specify multiple targets | ||
[[copy.targets]] | ||
repository = "/tmp/repo2" | ||
# you can specify multiple copy targets | ||
[[copy]] | ||
# First copy target | ||
[copy.options] | ||
# Optional, but one of the three password options must be set | ||
# either on CLI, in the config file or in the environment variables | ||
password = "test" | ||
no-cache = true | ||
|
||
[[copy.targets]] | ||
repository = "rclone:ovh:backup" | ||
repo-hot = "clone:ovh:backup-hot" | ||
[copy.backend] | ||
repository = "/tmp/repo2" | ||
|
||
[[copy]] | ||
# Second copy target | ||
[copy.options] | ||
password-file = "/root/key-rustic-ovh" | ||
cache-dir = "/var/lib/cache/rustic" # explicitly specify cache dir for remote repository | ||
|
||
[copy.backend] | ||
repository = "rclone|ovh:backup" | ||
repo-hot = "rclone|ovh:backup-hot" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @aawsome I think the naming is a bit off now, so we need to check what is best.
Also it may be confusing to have |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,22 @@ dry-run = false | |
# This is only an example how to set an rclone env variable. Default: No variables are defined. | ||
RCLONE_XXX = "true" | ||
|
||
# Repository options: These options define which backend to use and which password to use. | ||
[repository] | ||
# Backend options: These options define which backend to use. | ||
[backend] | ||
repository = "/repo/rustic" # Must be set | ||
repo-hot = "/my/hot/repo" # Default: not set | ||
# one of the three password options must be set | ||
|
||
# Additional backend options - depending on backend. These can be only set in the config file. | ||
[backend.options] | ||
post-create-command = "par2create -qq -n1 -r5 %file" # Only local backend; Default: not set | ||
post-delete-command = "sh -c \"rm -f %file*.par2\"" # Only local backend; Default: not set | ||
retry = "default" # Only rest/rclone backend; Allowed values: "false"/"off", "default" or number of retries | ||
timeout = "10min" # Only rest/rclone backend | ||
|
||
# Repository options: These options define which repository settings and passwords to use. | ||
[repository] | ||
# Optional, but one of the three password options must be set | ||
# either on CLI, in the config file or in environment variables | ||
password = "mySecretPassword" | ||
password-file = "/my/password.txt" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also don't really like the differentiation now: [backend]
repository = ""
repo-hot = ""
[backend.options]
[repository] Maybe we find some better naming there which makes it more clear? |
||
password-command = "my_command.sh" | ||
|
@@ -36,13 +47,6 @@ warm-up = false | |
warm-up-command = "warmup.sh %id" # Default: not set | ||
warm-up-wait = "10min" # Default: not set | ||
|
||
# Additional repository options - depending on backend. These can be only set in the config file. | ||
[repository.options] | ||
post-create-command = "par2create -qq -n1 -r5 %file" # Only local backend; Default: not set | ||
post-delete-command = "sh -c \"rm -f %file*.par2\"" # Only local backend; Default: not set | ||
retry = "default" # Only rest/rclone backend; Allowed values: "false"/"off", "default" or number of retries | ||
timeout = "10min" # Only rest/rclone backend | ||
|
||
# Snapshot-filter options: These options apply to all commands that use snapshot filters | ||
[snapshot-filter] | ||
filter-host = ["host2", "host2"] # Default: no host filter | ||
|
@@ -148,12 +152,14 @@ keep-withing-quarter-yearly = "0 year" | |
keep-withing-half-yearly = "1 year" | ||
keep-within-yearly = "10 years" | ||
|
||
# Multiple targets are available for the copy command. Each specify a repository with exactly identical options as in | ||
# the [repository] section. | ||
[[copy.targets]] | ||
repository = "/repo/rustic" # Must be set | ||
repo-hot = "/my/hot/repo" # Default: not set | ||
# one of the three password options must be set | ||
# Multiple targets are available for the copy command. | ||
# Each specify a repository with exactly identical options as in | ||
# the [repository] and [backend] section. | ||
[[copy]] | ||
# First copy target | ||
[copy.options] | ||
# Optional, but one of the three password options must be set | ||
# either on CLI, in the config file or in the environment variables | ||
password = "mySecretPassword" | ||
password-file = "/my/password.txt" | ||
password-command = "my_command.sh" | ||
|
@@ -164,6 +170,12 @@ warm-up = false | |
warm-up-command = "warmup.sh %id" # Default: not set | ||
warm-up-wait = "10min" # Default: not set | ||
|
||
[[copy.targets]] | ||
[copy.backend] | ||
repository = "/repo/rustic" # Must be set | ||
repo-hot = "/my/hot/repo" # Default: not set | ||
|
||
[[copy]] | ||
# Second copy target | ||
[copy.backend] | ||
repository = "/repo/rustic2" # Must be set | ||
# ... |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,7 @@ | ||||||||||||||||
[repository] | ||||||||||||||||
# Backend options: These options define which backend to use. | ||||||||||||||||
[backend] | ||||||||||||||||
repository = "/tmp/repo" | ||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||
# Repository options: These options define which repository settings and passwords to use. | ||||||||||||||||
[repository] | ||||||||||||||||
password = "test" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Nice, but didn't really get it to work, could be nice for user facing errors though regarding misconfiguration.