Skip to content

Commit

Permalink
Feature/axum (#45)
Browse files Browse the repository at this point in the history
Branch feature/axum seemed not to work.
* Changed web.rs to resolve conflicting path definitions
* Added a command line option to create the .htaccess files

---------

Co-authored-by: raimond visser <[email protected]>
Co-authored-by: simonsan <[email protected]>
  • Loading branch information
3 people authored Nov 9, 2024
1 parent e982c5b commit 7b8a249
Show file tree
Hide file tree
Showing 14 changed files with 490 additions and 95 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
# Test data created may accidentally be included
/tests/test_data/test_repos/repo_remove_me
/tests/test_data/test_repos/repo_remove_me_2
tests/fixtures/test_data/rustic_server.toml #often updated with content that should not be archived
/tmp_test_data
126 changes: 121 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["rustic-rs Maintainers"]
categories = ["command-line-utilities"]
edition = "2021"
homepage = "https://rustic.cli.rs/"
keywords = ["backup", "restic", "deduplication", "encryption", "cli", "server"]
keywords = ["backup", "restic", "deduplication", "encryption", "server"]
license = "AGPL-3.0-or-later"
repository = "https://github.com/rustic-rs/rustic_server"
rust-version = "1.70.0"
Expand All @@ -28,28 +28,28 @@ anyhow = "1.0.79"
async-trait = "0.1"
# FIXME: Add "headers" feature to Axum?
axum = { version = "0.7.4", features = ["tracing", "multipart", "http2"] }
axum-auth = "0.7.0"
axum-extra = { version = "0.9.2", features = ["typed-header", "query", "async-read-body", "typed-routing"] }
axum-macros = "0.4.1"
axum-auth = "0.7"
axum-extra = { version = "0.9", features = ["typed-header", "query", "async-read-body", "typed-routing"] }
axum-macros = "0.4"
axum-range = "0.4"
axum-server = { version = "0.6.0", features = ["tls-rustls"] }
axum-server = { version = "0.6", features = ["tls-rustls"] }
clap = { version = "4.4", features = ["derive"] }
displaydoc = "0.2.4"
# enum_dispatch = "0.3.12"
displaydoc = "0.2"
futures = "0.3"
futures-util = "0.3"
htpasswd-verify = "0.3"
http-body-util = "0.1.0"
http-body-util = "0.1"
http-range = "0.1"
inquire = "0.7"
pin-project = "1.1"
rand = "0.8.5"
serde = { version = "1", default-features = false, features = ["derive"] }
serde_derive = "1"
strum = { version = "0.25.0", features = ["derive"] }
thiserror = "1.0.56"
rand = "0.8"
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_derive = "1.0"
strum = { version = "0.26", features = ["derive"] }
thiserror = "1.0"
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7.10", features = ["io", "io-util"] }
toml = "0.8.8"
tokio-util = { version = "0.7", features = ["io", "io-util"] }
toml = "0.8"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
walkdir = "2"
Expand Down
82 changes: 51 additions & 31 deletions config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,56 @@ This folder contains a few configuration files as an example.
See also the rustic configuration, described in:
https://github.com/rustic-rs/rustic/tree/main/config

## `acl.toml`
# Server config file `rustic_server.toml`

This file may have any name, but requires valid toml formatting.
This file may have any name, but requires valid toml formatting, as shown below.
A path to this file can be entered on the command line when starting the server.

Format:
File format:

```
[server]
host_dns_name = <ip_address> | <dns hostname>
port = <port number>
common_root_path = <absolute path to your repo>
[repos]
# Absolute file path will be: /common_root_path>/<repo_folder>
# if <common_root_path> is empty, an absolute path to a folder is expected here
storage_path = <repo_folder>
[authorization]
# Absolute file path will be: /common_root_path>/<auth filename>
# if <common_root_path> is empty, an absolute path to a file is expected here
auth_path = <auth filename>
use_auth = <skip authorization if false>
[access_control]
# Absolute file will be: /common_root_path>/<acl filename>
# if <common_root_path> is empty, an absolute path to a file is expected here
acl_path = <acl filename>
private_repo = <skip access control if false>
append_only = <limit to append, regardless of the ACL file content>
```

# Access control list file `acl.toml`

Using the server configuration file, this file may have any name, but requires
valid toml formatting, as shown below.

A **path** to this file can be entered on the command line when starting the
server.

File format:

```
[<repository_name>]
<user> <access_type>
... more users
... more repositories
[<other_repository>]
<user> <access_type>
... more users
```

The `access_type` can have values:
Expand All @@ -33,41 +71,23 @@ The `access_type` can have values:

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>
# user credential file `.htaccess`

[access_control]
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>
```
This file is formatted as a vanilla `Apache` `.htacces` file.

On top of some additional configuration items, the content of this file points
to the `acl.toml`, and `.htaccess` files.
Using the server configuration file, this file may have any name, but requires
valid formatting.

## `.htaccess`
A **path** to this file can be entered on the command line when starting the
server. In that case the file name has to be `.htaccess`.

This is a vanilla `Apache` `.htacces` file.
The server binary allows this file to be created from the command line. Execute
`rustic_server --help` for details.

# Configure `rustic_server` from the command line

It is also possible to configure the server from the command line, and skip the
configuration file.
server configuration file.

To see all options, use:

Expand Down
Loading

0 comments on commit 7b8a249

Please sign in to comment.