Merge branch 'lx-perf-improvements' into netapp-stream-body

This commit is contained in:
Alex Auvolat 2022-08-29 16:45:05 +02:00
commit 1921f4f7e6
No known key found for this signature in database
GPG key ID: 0E496D15096376BE
13 changed files with 116 additions and 83 deletions

View file

@ -14,7 +14,7 @@ steps:
- name: build - name: build
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr clippy.amd64 --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr clippy.amd64 --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- name: unit + func tests - name: unit + func tests
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
@ -34,7 +34,7 @@ steps:
- name: integration tests - name: integration tests
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr clippy.amd64 --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr clippy.amd64 --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- nix-shell --attr integration --run ./script/test-smoke.sh || (cat /tmp/garage.log; false) - nix-shell --attr integration --run ./script/test-smoke.sh || (cat /tmp/garage.log; false)
trigger: trigger:
@ -57,7 +57,7 @@ steps:
- name: build - name: build
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr pkgs.amd64.release --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr pkgs.amd64.release --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage" - nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage"
- name: integration - name: integration
@ -72,6 +72,7 @@ steps:
from_secret: garagehq_aws_access_key_id from_secret: garagehq_aws_access_key_id
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: garagehq_aws_secret_access_key from_secret: garagehq_aws_secret_access_key
TARGET: "x86_64-unknown-linux-musl"
commands: commands:
- nix-shell --attr release --run "to_s3" - nix-shell --attr release --run "to_s3"
@ -107,7 +108,7 @@ steps:
- name: build - name: build
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr pkgs.i386.release --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr pkgs.i386.release --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage" - nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage"
- name: integration - name: integration
@ -122,6 +123,7 @@ steps:
from_secret: garagehq_aws_access_key_id from_secret: garagehq_aws_access_key_id
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: garagehq_aws_secret_access_key from_secret: garagehq_aws_secret_access_key
TARGET: "i686-unknown-linux-musl"
commands: commands:
- nix-shell --attr release --run "to_s3" - nix-shell --attr release --run "to_s3"
@ -156,7 +158,7 @@ steps:
- name: build - name: build
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr pkgs.arm64.release --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr pkgs.arm64.release --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage" - nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage"
- name: push static binary - name: push static binary
@ -166,6 +168,7 @@ steps:
from_secret: garagehq_aws_access_key_id from_secret: garagehq_aws_access_key_id
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: garagehq_aws_secret_access_key from_secret: garagehq_aws_secret_access_key
TARGET: "aarch64-unknown-linux-musl"
commands: commands:
- nix-shell --attr release --run "to_s3" - nix-shell --attr release --run "to_s3"
@ -200,7 +203,7 @@ steps:
- name: build - name: build
image: nixpkgs/nix:nixos-22.05 image: nixpkgs/nix:nixos-22.05
commands: commands:
- nix-build --no-build-output --attr pkgs.arm.release --argstr git_version $DRONE_COMMIT - nix-build --no-build-output --attr pkgs.arm.release --argstr git_version ${DRONE_TAG:-$DRONE_COMMIT}
- nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage" - nix-shell --attr rust --run "./script/not-dynamic.sh result/bin/garage"
- name: push static binary - name: push static binary
@ -210,6 +213,7 @@ steps:
from_secret: garagehq_aws_access_key_id from_secret: garagehq_aws_access_key_id
AWS_SECRET_ACCESS_KEY: AWS_SECRET_ACCESS_KEY:
from_secret: garagehq_aws_secret_access_key from_secret: garagehq_aws_secret_access_key
TARGET: "armv6l-unknown-linux-musleabihf"
commands: commands:
- nix-shell --attr release --run "to_s3" - nix-shell --attr release --run "to_s3"
@ -265,6 +269,6 @@ trigger:
--- ---
kind: signature kind: signature
hmac: 8495114848396ebb492831fc9bd37b353e1a4add9d72c0a123d109490a5b0db0 hmac: fa1f98f327abf88486c0c54984287285a4b951efa3776af9dd33b4d782b50815
... ...

2
Cargo.lock generated
View file

@ -1212,7 +1212,6 @@ dependencies = [
"futures-util", "futures-util",
"garage_util 0.7.0", "garage_util 0.7.0",
"gethostname", "gethostname",
"git-version",
"hex", "hex",
"hyper", "hyper",
"k8s-openapi", "k8s-openapi",
@ -1314,6 +1313,7 @@ dependencies = [
"err-derive 0.3.1", "err-derive 0.3.1",
"futures", "futures",
"garage_db", "garage_db",
"git-version",
"hex", "hex",
"http", "http",
"hyper", "hyper",

View file

@ -1683,7 +1683,6 @@ in
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "futures_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.21" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "futures_util" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures-util."0.3.21" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "garage_util" else null } = rustPackages."unknown".garage_util."0.7.0" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "garage_util" else null } = rustPackages."unknown".garage_util."0.7.0" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "gethostname" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".gethostname."0.2.3" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "gethostname" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".gethostname."0.2.3" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "git_version" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".git-version."0.3.5" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.18" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_web" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.18" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_rpc" then "k8s_openapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".k8s-openapi."0.13.1" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_rpc" then "k8s_openapi" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".k8s-openapi."0.13.1" { inherit profileName; };
@ -1796,6 +1795,7 @@ in
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "err_derive" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "err_derive" else null } = buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "futures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.21" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "futures" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.21" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "garage_db" else null } = rustPackages."unknown".garage_db."0.8.0" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "garage_db" else null } = rustPackages."unknown".garage_db."0.8.0" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "git_version" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".git-version."0.3.5" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "hex" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.6" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "http" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.6" { inherit profileName; };
${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.18" { inherit profileName; }; ${ if rootFeatures' ? "garage" || rootFeatures' ? "garage_api" || rootFeatures' ? "garage_block" || rootFeatures' ? "garage_model" || rootFeatures' ? "garage_rpc" || rootFeatures' ? "garage_table" || rootFeatures' ? "garage_util" || rootFeatures' ? "garage_web" || rootFeatures' ? "k2v-client" then "hyper" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".hyper."0.14.18" { inherit profileName; };
@ -2945,7 +2945,7 @@ in
url = https://git.deuxfleurs.fr/lx/netapp; url = https://git.deuxfleurs.fr/lx/netapp;
name = "netapp"; name = "netapp";
version = "0.5.0"; version = "0.5.0";
rev = "fed0542313824df295a7e322a9aebe8ba62f97b9"; rev = "74e57016f63b6052cf6d539812859c3a46138eee";
ref = "stream-body";}; ref = "stream-body";};
features = builtins.concatLists [ features = builtins.concatLists [
[ "default" ] [ "default" ]
@ -4020,7 +4020,7 @@ in
]; ];
dependencies = { dependencies = {
${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.121" { inherit profileName; }; ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "libc" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.121" { inherit profileName; };
${ if hostPlatform.parsed.kernel.name == "dragonfly" || hostPlatform.parsed.kernel.name == "freebsd" || hostPlatform.parsed.kernel.name == "illumos" || hostPlatform.parsed.kernel.name == "netbsd" || hostPlatform.parsed.kernel.name == "openbsd" || hostPlatform.parsed.kernel.name == "solaris" || hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.10.0" { inherit profileName; }; ${ if hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "dragonfly" || hostPlatform.parsed.kernel.name == "freebsd" || hostPlatform.parsed.kernel.name == "illumos" || hostPlatform.parsed.kernel.name == "netbsd" || hostPlatform.parsed.kernel.name == "openbsd" || hostPlatform.parsed.kernel.name == "solaris" then "once_cell" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".once_cell."1.10.0" { inherit profileName; };
${ if hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" || (hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l") && (hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "linux") then "spin" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".spin."0.5.2" { inherit profileName; }; ${ if hostPlatform.parsed.cpu.name == "i686" || hostPlatform.parsed.cpu.name == "x86_64" || (hostPlatform.parsed.cpu.name == "aarch64" || hostPlatform.parsed.cpu.name == "armv6l" || hostPlatform.parsed.cpu.name == "armv7l") && (hostPlatform.parsed.kernel.name == "android" || hostPlatform.parsed.kernel.name == "fuchsia" || hostPlatform.parsed.kernel.name == "linux") then "spin" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".spin."0.5.2" { inherit profileName; };
untrusted = rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; }; untrusted = rustPackages."registry+https://github.com/rust-lang/crates.io-index".untrusted."0.7.1" { inherit profileName; };
${ if hostPlatform.parsed.cpu.name == "wasm32" && hostPlatform.parsed.vendor.name == "unknown" && hostPlatform.parsed.kernel.name == "unknown" && hostPlatform.parsed.abi.name == "" then "web_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.56" { inherit profileName; }; ${ if hostPlatform.parsed.cpu.name == "wasm32" && hostPlatform.parsed.vendor.name == "unknown" && hostPlatform.parsed.kernel.name == "unknown" && hostPlatform.parsed.abi.name == "" then "web_sys" else null } = rustPackages."registry+https://github.com/rust-lang/crates.io-index".web-sys."0.3.56" { inherit profileName; };

View file

@ -9,8 +9,8 @@ let
pkgs = import pkgsSrc { }; pkgs = import pkgsSrc { };
compile = import ./nix/compile.nix; compile = import ./nix/compile.nix;
build_debug_and_release = (target: { build_debug_and_release = (target: {
debug = (compile { inherit target; release = false; }).workspace.garage { compileMode = "build"; }; debug = (compile { inherit target git_version; release = false; }).workspace.garage { compileMode = "build"; };
release = (compile { inherit target; release = true; }).workspace.garage { compileMode = "build"; }; release = (compile { inherit target git_version; release = true; }).workspace.garage { compileMode = "build"; };
}); });
test = (rustPkgs: pkgs.symlinkJoin { test = (rustPkgs: pkgs.symlinkJoin {
name ="garage-tests"; name ="garage-tests";
@ -25,9 +25,9 @@ in {
arm = build_debug_and_release "armv6l-unknown-linux-musleabihf"; arm = build_debug_and_release "armv6l-unknown-linux-musleabihf";
}; };
test = { test = {
amd64 = test (compile { target = "x86_64-unknown-linux-musl"; }); amd64 = test (compile { inherit git_version; target = "x86_64-unknown-linux-musl"; });
}; };
clippy = { clippy = {
amd64 = (compile { compiler = "clippy"; }).workspace.garage { compileMode = "build"; } ; amd64 = (compile { inherit git_version; compiler = "clippy"; }).workspace.garage { compileMode = "build"; } ;
}; };
} }

View file

@ -280,3 +280,25 @@ Traefik's caching middleware is only available on [entreprise version](https://d
[http.middlewares] [http.middlewares]
[http.middlewares.gzip_compress.compress] [http.middlewares.gzip_compress.compress]
``` ```
## Caddy
Your Caddy configuration can be as simple as:
```caddy
s3.garage.tld, *.s3.garage.tld {
reverse_proxy localhost:3900 192.168.1.2:3900 example.tld:3900
}
*.web.garage.tld {
reverse_proxy localhost:3902 192.168.1.2:3900 example.tld:3900
}
admin.garage.tld {
reverse_proxy localhost:3903
}
```
But at the same time, the `reverse_proxy` is very flexible.
For a production deployment, you should [read its documentation](https://caddyserver.com/docs/caddyfile/directives/reverse_proxy) as it supports features like DNS discovery of upstreams, load balancing with checks, streaming parameters, etc.

View file

@ -129,16 +129,7 @@ let
(pkgs.rustBuilder.rustLib.makeOverride { (pkgs.rustBuilder.rustLib.makeOverride {
name = "garage_rpc"; name = "garage_rpc";
overrideAttrs = drv: overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); };
(if git_version != null then {
/* [3] */ preConfigure = ''
${drv.preConfigure or ""}
export GIT_VERSION="${git_version}"
'';
} else {})
// {
/* [1] */ setBuildEnv = (buildEnv drv);
};
overrideArgs = old: { overrideArgs = old: {
/* [4] */ features = if release then [ "kubernetes-discovery" ] else []; /* [4] */ features = if release then [ "kubernetes-discovery" ] else [];
}; };
@ -151,7 +142,15 @@ let
(pkgs.rustBuilder.rustLib.makeOverride { (pkgs.rustBuilder.rustLib.makeOverride {
name = "garage_util"; name = "garage_util";
overrideAttrs = drv: { /* [1] */ setBuildEnv = (buildEnv drv); }; overrideAttrs = drv:
(if git_version != null then {
/* [3] */ preConfigure = ''
${drv.preConfigure or ""}
export GIT_VERSION="${git_version}"
'';
} else {})
//
{ /* [1] */ setBuildEnv = (buildEnv drv); };
}) })
(pkgs.rustBuilder.rustLib.makeOverride { (pkgs.rustBuilder.rustLib.makeOverride {

View file

@ -1,64 +1,65 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use garage_util::version;
use structopt::StructOpt; use structopt::StructOpt;
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub enum Command { pub enum Command {
/// Run Garage server /// Run Garage server
#[structopt(name = "server")] #[structopt(name = "server", version = version::garage())]
Server, Server,
/// Get network status /// Get network status
#[structopt(name = "status")] #[structopt(name = "status", version = version::garage())]
Status, Status,
/// Operations on individual Garage nodes /// Operations on individual Garage nodes
#[structopt(name = "node")] #[structopt(name = "node", version = version::garage())]
Node(NodeOperation), Node(NodeOperation),
/// Operations on the assignation of node roles in the cluster layout /// Operations on the assignation of node roles in the cluster layout
#[structopt(name = "layout")] #[structopt(name = "layout", version = version::garage())]
Layout(LayoutOperation), Layout(LayoutOperation),
/// Operations on buckets /// Operations on buckets
#[structopt(name = "bucket")] #[structopt(name = "bucket", version = version::garage())]
Bucket(BucketOperation), Bucket(BucketOperation),
/// Operations on S3 access keys /// Operations on S3 access keys
#[structopt(name = "key")] #[structopt(name = "key", version = version::garage())]
Key(KeyOperation), Key(KeyOperation),
/// Run migrations from previous Garage version /// Run migrations from previous Garage version
/// (DO NOT USE WITHOUT READING FULL DOCUMENTATION) /// (DO NOT USE WITHOUT READING FULL DOCUMENTATION)
#[structopt(name = "migrate")] #[structopt(name = "migrate", version = version::garage())]
Migrate(MigrateOpt), Migrate(MigrateOpt),
/// Start repair of node data on remote node /// Start repair of node data on remote node
#[structopt(name = "repair")] #[structopt(name = "repair", version = version::garage())]
Repair(RepairOpt), Repair(RepairOpt),
/// Offline reparation of node data (these repairs must be run offline /// Offline reparation of node data (these repairs must be run offline
/// directly on the server node) /// directly on the server node)
#[structopt(name = "offline-repair")] #[structopt(name = "offline-repair", version = version::garage())]
OfflineRepair(OfflineRepairOpt), OfflineRepair(OfflineRepairOpt),
/// Gather node statistics /// Gather node statistics
#[structopt(name = "stats")] #[structopt(name = "stats", version = version::garage())]
Stats(StatsOpt), Stats(StatsOpt),
/// Manage background workers /// Manage background workers
#[structopt(name = "worker")] #[structopt(name = "worker", version = version::garage())]
Worker(WorkerOpt), Worker(WorkerOpt),
} }
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub enum NodeOperation { pub enum NodeOperation {
/// Print identifier (public key) of this Garage node /// Print identifier (public key) of this Garage node
#[structopt(name = "id")] #[structopt(name = "id", version = version::garage())]
NodeId(NodeIdOpt), NodeId(NodeIdOpt),
/// Connect to Garage node that is currently isolated from the system /// Connect to Garage node that is currently isolated from the system
#[structopt(name = "connect")] #[structopt(name = "connect", version = version::garage())]
Connect(ConnectNodeOpt), Connect(ConnectNodeOpt),
} }
@ -79,23 +80,23 @@ pub struct ConnectNodeOpt {
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub enum LayoutOperation { pub enum LayoutOperation {
/// Assign role to Garage node /// Assign role to Garage node
#[structopt(name = "assign")] #[structopt(name = "assign", version = version::garage())]
Assign(AssignRoleOpt), Assign(AssignRoleOpt),
/// Remove role from Garage cluster node /// Remove role from Garage cluster node
#[structopt(name = "remove")] #[structopt(name = "remove", version = version::garage())]
Remove(RemoveRoleOpt), Remove(RemoveRoleOpt),
/// Show roles currently assigned to nodes and changes staged for commit /// Show roles currently assigned to nodes and changes staged for commit
#[structopt(name = "show")] #[structopt(name = "show", version = version::garage())]
Show, Show,
/// Apply staged changes to cluster layout /// Apply staged changes to cluster layout
#[structopt(name = "apply")] #[structopt(name = "apply", version = version::garage())]
Apply(ApplyLayoutOpt), Apply(ApplyLayoutOpt),
/// Revert staged changes to cluster layout /// Revert staged changes to cluster layout
#[structopt(name = "revert")] #[structopt(name = "revert", version = version::garage())]
Revert(RevertLayoutOpt), Revert(RevertLayoutOpt),
} }
@ -150,43 +151,43 @@ pub struct RevertLayoutOpt {
#[derive(Serialize, Deserialize, StructOpt, Debug)] #[derive(Serialize, Deserialize, StructOpt, Debug)]
pub enum BucketOperation { pub enum BucketOperation {
/// List buckets /// List buckets
#[structopt(name = "list")] #[structopt(name = "list", version = version::garage())]
List, List,
/// Get bucket info /// Get bucket info
#[structopt(name = "info")] #[structopt(name = "info", version = version::garage())]
Info(BucketOpt), Info(BucketOpt),
/// Create bucket /// Create bucket
#[structopt(name = "create")] #[structopt(name = "create", version = version::garage())]
Create(BucketOpt), Create(BucketOpt),
/// Delete bucket /// Delete bucket
#[structopt(name = "delete")] #[structopt(name = "delete", version = version::garage())]
Delete(DeleteBucketOpt), Delete(DeleteBucketOpt),
/// Alias bucket under new name /// Alias bucket under new name
#[structopt(name = "alias")] #[structopt(name = "alias", version = version::garage())]
Alias(AliasBucketOpt), Alias(AliasBucketOpt),
/// Remove bucket alias /// Remove bucket alias
#[structopt(name = "unalias")] #[structopt(name = "unalias", version = version::garage())]
Unalias(UnaliasBucketOpt), Unalias(UnaliasBucketOpt),
/// Allow key to read or write to bucket /// Allow key to read or write to bucket
#[structopt(name = "allow")] #[structopt(name = "allow", version = version::garage())]
Allow(PermBucketOpt), Allow(PermBucketOpt),
/// Deny key from reading or writing to bucket /// Deny key from reading or writing to bucket
#[structopt(name = "deny")] #[structopt(name = "deny", version = version::garage())]
Deny(PermBucketOpt), Deny(PermBucketOpt),
/// Expose as website or not /// Expose as website or not
#[structopt(name = "website")] #[structopt(name = "website", version = version::garage())]
Website(WebsiteOpt), Website(WebsiteOpt),
/// Set the quotas for this bucket /// Set the quotas for this bucket
#[structopt(name = "set-quotas")] #[structopt(name = "set-quotas", version = version::garage())]
SetQuotas(SetQuotasOpt), SetQuotas(SetQuotasOpt),
} }
@ -292,35 +293,35 @@ pub struct SetQuotasOpt {
#[derive(Serialize, Deserialize, StructOpt, Debug)] #[derive(Serialize, Deserialize, StructOpt, Debug)]
pub enum KeyOperation { pub enum KeyOperation {
/// List keys /// List keys
#[structopt(name = "list")] #[structopt(name = "list", version = version::garage())]
List, List,
/// Get key info /// Get key info
#[structopt(name = "info")] #[structopt(name = "info", version = version::garage())]
Info(KeyOpt), Info(KeyOpt),
/// Create new key /// Create new key
#[structopt(name = "new")] #[structopt(name = "new", version = version::garage())]
New(KeyNewOpt), New(KeyNewOpt),
/// Rename key /// Rename key
#[structopt(name = "rename")] #[structopt(name = "rename", version = version::garage())]
Rename(KeyRenameOpt), Rename(KeyRenameOpt),
/// Delete key /// Delete key
#[structopt(name = "delete")] #[structopt(name = "delete", version = version::garage())]
Delete(KeyDeleteOpt), Delete(KeyDeleteOpt),
/// Set permission flags for key /// Set permission flags for key
#[structopt(name = "allow")] #[structopt(name = "allow", version = version::garage())]
Allow(KeyPermOpt), Allow(KeyPermOpt),
/// Unset permission flags for key /// Unset permission flags for key
#[structopt(name = "deny")] #[structopt(name = "deny", version = version::garage())]
Deny(KeyPermOpt), Deny(KeyPermOpt),
/// Import key /// Import key
#[structopt(name = "import")] #[structopt(name = "import", version = version::garage())]
Import(KeyImportOpt), Import(KeyImportOpt),
} }
@ -392,7 +393,7 @@ pub struct MigrateOpt {
#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] #[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)]
pub enum MigrateWhat { pub enum MigrateWhat {
/// Migrate buckets and permissions from v0.5.0 /// Migrate buckets and permissions from v0.5.0
#[structopt(name = "buckets050")] #[structopt(name = "buckets050", version = version::garage())]
Buckets050, Buckets050,
} }
@ -413,19 +414,19 @@ pub struct RepairOpt {
#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] #[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)]
pub enum RepairWhat { pub enum RepairWhat {
/// Only do a full sync of metadata tables /// Only do a full sync of metadata tables
#[structopt(name = "tables")] #[structopt(name = "tables", version = version::garage())]
Tables, Tables,
/// Only repair (resync/rebalance) the set of stored blocks /// Only repair (resync/rebalance) the set of stored blocks
#[structopt(name = "blocks")] #[structopt(name = "blocks", version = version::garage())]
Blocks, Blocks,
/// Only redo the propagation of object deletions to the version table (slow) /// Only redo the propagation of object deletions to the version table (slow)
#[structopt(name = "versions")] #[structopt(name = "versions", version = version::garage())]
Versions, Versions,
/// Only redo the propagation of version deletions to the block ref table (extremely slow) /// Only redo the propagation of version deletions to the block ref table (extremely slow)
#[structopt(name = "block_refs")] #[structopt(name = "block_refs", version = version::garage())]
BlockRefs, BlockRefs,
/// Verify integrity of all blocks on disc (extremely slow, i/o intensive) /// Verify integrity of all blocks on disc (extremely slow, i/o intensive)
#[structopt(name = "scrub")] #[structopt(name = "scrub", version = version::garage())]
Scrub { Scrub {
#[structopt(subcommand)] #[structopt(subcommand)]
cmd: ScrubCmd, cmd: ScrubCmd,
@ -435,19 +436,19 @@ pub enum RepairWhat {
#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] #[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)]
pub enum ScrubCmd { pub enum ScrubCmd {
/// Start scrub /// Start scrub
#[structopt(name = "start")] #[structopt(name = "start", version = version::garage())]
Start, Start,
/// Pause scrub (it will resume automatically after 24 hours) /// Pause scrub (it will resume automatically after 24 hours)
#[structopt(name = "pause")] #[structopt(name = "pause", version = version::garage())]
Pause, Pause,
/// Resume paused scrub /// Resume paused scrub
#[structopt(name = "resume")] #[structopt(name = "resume", version = version::garage())]
Resume, Resume,
/// Cancel scrub in progress /// Cancel scrub in progress
#[structopt(name = "cancel")] #[structopt(name = "cancel", version = version::garage())]
Cancel, Cancel,
/// Set tranquility level for in-progress and future scrubs /// Set tranquility level for in-progress and future scrubs
#[structopt(name = "set-tranquility")] #[structopt(name = "set-tranquility", version = version::garage())]
SetTranquility { SetTranquility {
#[structopt()] #[structopt()]
tranquility: u32, tranquility: u32,
@ -468,10 +469,10 @@ pub struct OfflineRepairOpt {
pub enum OfflineRepairWhat { pub enum OfflineRepairWhat {
/// Repair K2V item counters /// Repair K2V item counters
#[cfg(feature = "k2v")] #[cfg(feature = "k2v")]
#[structopt(name = "k2v_item_counters")] #[structopt(name = "k2v_item_counters", version = version::garage())]
K2VItemCounters, K2VItemCounters,
/// Repair object counters /// Repair object counters
#[structopt(name = "object_counters")] #[structopt(name = "object_counters", version = version::garage())]
ObjectCounters, ObjectCounters,
} }
@ -495,7 +496,7 @@ pub struct WorkerOpt {
#[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)] #[derive(Serialize, Deserialize, StructOpt, Debug, Eq, PartialEq, Clone)]
pub enum WorkerCmd { pub enum WorkerCmd {
/// List all workers on Garage node /// List all workers on Garage node
#[structopt(name = "list")] #[structopt(name = "list", version = version::garage())]
List { List {
#[structopt(flatten)] #[structopt(flatten)]
opt: WorkerListOpt, opt: WorkerListOpt,

View file

@ -22,6 +22,7 @@ use garage_util::error::*;
use garage_rpc::system::*; use garage_rpc::system::*;
use garage_rpc::*; use garage_rpc::*;
use garage_util::version;
use garage_model::helper::error::Error as HelperError; use garage_model::helper::error::Error as HelperError;
@ -29,7 +30,7 @@ use admin::*;
use cli::*; use cli::*;
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
#[structopt(name = "garage")] #[structopt(name = "garage", version = version::garage(), about = "S3-compatible object store for self-hosted geo-distributed deployments")]
struct Opt { struct Opt {
/// Host to connect to for admin operations, in the format: /// Host to connect to for admin operations, in the format:
/// <public-key>@<ip>:<port> /// <public-key>@<ip>:<port>

View file

@ -19,7 +19,6 @@ garage_util = { version = "0.7.0", path = "../util" }
arc-swap = "1.0" arc-swap = "1.0"
bytes = "1.0" bytes = "1.0"
gethostname = "0.2" gethostname = "0.2"
git-version = "0.3.4"
hex = "0.4" hex = "0.4"
tracing = "0.1.30" tracing = "0.1.30"
rand = "0.8" rand = "0.8"

View file

@ -27,6 +27,7 @@ use garage_util::data::*;
use garage_util::error::*; use garage_util::error::*;
use garage_util::persister::Persister; use garage_util::persister::Persister;
use garage_util::time::*; use garage_util::time::*;
use garage_util::version;
use crate::consul::*; use crate::consul::*;
#[cfg(feature = "kubernetes-discovery")] #[cfg(feature = "kubernetes-discovery")]
@ -320,11 +321,7 @@ impl System {
// also available through RPC) ---- // also available through RPC) ----
pub fn garage_version(&self) -> &'static str { pub fn garage_version(&self) -> &'static str {
option_env!("GIT_VERSION").unwrap_or(git_version::git_version!( version::garage()
prefix = "git:",
cargo_prefix = "cargo:",
fallback = "unknown"
))
} }
pub fn get_known_nodes(&self) -> Vec<KnownNodeInfo> { pub fn get_known_nodes(&self) -> Vec<KnownNodeInfo> {

View file

@ -26,6 +26,7 @@ hex = "0.4"
tracing = "0.1.30" tracing = "0.1.30"
rand = "0.8" rand = "0.8"
sha2 = "0.10" sha2 = "0.10"
git-version = "0.3.4"
chrono = "0.4" chrono = "0.4"
rmp-serde = "0.15" rmp-serde = "0.15"
@ -44,5 +45,6 @@ hyper = "0.14"
opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] } opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] }
[features] [features]
k2v = [] k2v = []

View file

@ -15,3 +15,4 @@ pub mod persister;
pub mod time; pub mod time;
pub mod token_bucket; pub mod token_bucket;
pub mod tranquilizer; pub mod tranquilizer;
pub mod version;

7
src/util/version.rs Normal file
View file

@ -0,0 +1,7 @@
pub fn garage() -> &'static str {
option_env!("GIT_VERSION").unwrap_or(git_version::git_version!(
prefix = "git:",
cargo_prefix = "cargo:",
fallback = "unknown"
))
}