-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
3,022 additions
and
753 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "rustic_server" | ||
version = "0.1.0" | ||
version = "0.1.1-dev" | ||
authors = ["Alexander Weiss <[email protected]>"] | ||
categories = ["command-line-utilities"] | ||
edition = "2021" | ||
|
@@ -11,26 +11,91 @@ repository = "https://github.com/rustic-rs/rustic_server" | |
description = """ | ||
rustic server - a REST server built in rust to use with rustic and restic. | ||
""" | ||
# cargo-binstall support | ||
# https://github.com/cargo-bins/cargo-binstall/blob/HEAD/SUPPORT.md | ||
[package.metadata.binstall] | ||
pkg-url = "{ repo }/releases/download/v{ version }/{ repo }-v{ version }-{ target }{ archive-suffix }" | ||
bin-dir = "{ bin }-{ target }/{ bin }{ binary-ext }" | ||
pkg-fmt = "tar.gz" | ||
|
||
[package.metadata.binstall.signing] | ||
algorithm = "minisign" | ||
pubkey = "RWSWSCEJEEacVeCy0va71hlrVtiW8YzMzOyJeso0Bfy/ZXq5OryWi/8T" | ||
|
||
[dependencies] | ||
anyhow = "1.0.75" | ||
async-trait = "0.1" | ||
# FIXME: Add "headers" feature to Axum? | ||
axum = { version = "0.7.3", features = ["tracing", "multipart", "http2"] } | ||
axum-auth = "0.7.0" | ||
axum-extra = { version = "0.9.1", features = ["typed-header", "query", "async-read-body"] } | ||
axum-extra = { version = "0.9.1", features = ["typed-header", "query", "async-read-body", "typed-routing"] } | ||
axum-macros = "0.4.0" | ||
axum-range = "0.4" | ||
axum-server = { version = "0.6.0", features = ["tls-rustls"] } | ||
clap = { version = "4.4.2", features = ["derive"] } | ||
enum_dispatch = "0.3.12" | ||
futures-util = "0.3.28" | ||
clap = { version = "4.4", features = ["derive"] } | ||
# enum_dispatch = "0.3.12" | ||
futures = "0.3" | ||
futures-util = "0.3" | ||
htpasswd-verify = "0.3" | ||
http-body-util = "0.1.0" | ||
http-range = "0.1" | ||
serde = "1" | ||
once_cell = "1.17" | ||
pin-project = "1.1" | ||
rand = "0.8.5" | ||
serde = { version = "1", default-features = false, features = ["derive"] } | ||
serde_derive = "1" | ||
thiserror = "1.0.48" | ||
tokio = { version = "1", features = ["full"] } | ||
tokio-util = { version = "0.7.8", features = ["io-util"] } | ||
tokio-util = { version = "0.7.8", features = ["io", "io-util"] } | ||
toml = "0.8.8" | ||
tracing = "0.1" | ||
tracing-subscriber = { version = "0.3", features = ["env-filter"] } | ||
walkdir = "2" | ||
|
||
# see: https://nnethercote.github.io/perf-book/build-configuration.html | ||
[profile.dev] | ||
opt-level = 0 | ||
debug = true | ||
rpath = false | ||
lto = false | ||
debug-assertions = true | ||
codegen-units = 4 | ||
|
||
# compile dependencies with optimizations in dev mode | ||
# see: https://doc.rust-lang.org/stable/cargo/reference/profiles.html#overrides | ||
[profile.dev.package."*"] | ||
opt-level = 3 | ||
debug = true | ||
|
||
[profile.release] | ||
opt-level = 3 | ||
debug = false # true for profiling | ||
rpath = false | ||
lto = "fat" | ||
debug-assertions = false | ||
codegen-units = 1 | ||
strip = true | ||
panic = "abort" | ||
|
||
[profile.test] | ||
opt-level = 1 | ||
debug = true | ||
rpath = false | ||
lto = false | ||
debug-assertions = true | ||
codegen-units = 4 | ||
|
||
[profile.bench] | ||
opt-level = 3 | ||
debug = true # true for profiling | ||
rpath = false | ||
lto = true | ||
debug-assertions = false | ||
codegen-units = 1 | ||
|
||
[dev-dependencies] | ||
base64 = "0.21.2" | ||
# reqwest = "0.11.18" | ||
# serial_test = "*" | ||
serde_json = "*" | ||
tower = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# `rustic_server` configuration | ||
|
||
This folder contains a few configuration files as an example. | ||
|
||
`rustic_server` has a few configuration files: | ||
|
||
- access control list (acl.toml) | ||
- server configuration (rustic_server.toml) | ||
- basic http credential authentication (.htaccess) | ||
|
||
See also the rustic configuration, described in: | ||
https://github.com/rustic-rs/rustic/tree/main/config | ||
|
||
## `acl.toml` | ||
|
||
This file may have any name, but requires valid toml formatting. | ||
|
||
Format: | ||
|
||
``` | ||
[<repository_name>] | ||
<user> <access_type> | ||
... more users | ||
... more repositories | ||
``` | ||
|
||
The `access_type` can have values: | ||
|
||
- "Read" --> allows read only access | ||
- "Append" --> allows addition of new files, including initializing a new repo | ||
- "Modify" --> allows write-access, including delete of a repo | ||
|
||
Todo: Describe "default" tag in the file. | ||
|
||
## `rustic_server.toml` | ||
|
||
This file may have any name, but requires valid toml formatting. | ||
|
||
File format: | ||
|
||
``` | ||
[server] | ||
host_dns_name = <ip_address> | <dns hostname> | ||
port = <port number> | ||
[repos] | ||
storage_path = <local file system path containing repos> | ||
[authorization] | ||
auth_path = <path to .htaccdss file, including filename> | ||
use_auth = <skip authorization if false> | ||
[accesscontrol] | ||
acl_path = <path to the acl file, including filename> | ||
private_repo = <skip access control if false> | ||
append_only = <limit to append, regardless of the ACL file content> | ||
``` | ||
|
||
On top of some additional configuration items, the content of this file points | ||
to the `acl.toml`, and `.htaccess` files. | ||
|
||
## `.htaccess` | ||
|
||
This is a vanilla `Apache` `.htacces` file. | ||
|
||
# Configure `rustic_server` from the command line | ||
|
||
It is also possible to configure the server from the command line, and skip the | ||
configuration file. | ||
|
||
To see all options, use: | ||
|
||
``` | ||
rustic_server --help | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Adapt to your own configuration | ||
[global] | ||
log-level = "Info" | ||
log-file = "~/rustic.log" | ||
|
||
[repository] | ||
repository = "rest:http://test:test_pw@localhost:8000/test_repo" | ||
password = "test_pw" | ||
|
||
[backup] | ||
|
||
[[backup.sources]] | ||
source = "~/your_path/rustic_server/test_data" | ||
# git-ignore = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[server] | ||
host_dns_name = "127.0.0.1" | ||
port = 8000 | ||
|
||
[repos] | ||
storage_path = "./test_data/test_repos/" | ||
|
||
[authorization] | ||
auth_path = "/test_data/test_repo/htaccess" | ||
use_auth = true | ||
|
||
[accesscontrol] | ||
acl_path = "/test_data/test_repo/acl.toml" | ||
private_repo = true | ||
append_only = false |
Oops, something went wrong.