Compare commits

...

220 Commits

Author SHA1 Message Date
Alex Auvolat 7b119c0b4f bump version number to v2.3.0 2026-04-16 18:34:27 +02:00
Alex Auvolat 02d5e67698 db: avoid iterating bounded from empty slice (fix #1401) (#1408)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1408
Co-authored-by: Alex Auvolat <lx@deuxfleurs.fr>
Co-committed-by: Alex Auvolat <lx@deuxfleurs.fr>
2026-04-16 16:33:28 +00:00
maximilien 854280e957 Merge pull request 'helm: Conditionally skip CRD management RBAC rule' (#1248) from boris.m/garage:feat/drop-crd-management-rbac-rule into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1248
Reviewed-by: maximilien <git@mricher.fr>
2026-04-16 16:22:17 +00:00
B Marinov 9ea2b1d628 helm: Conditionally skip CRD management RBAC rule
Remove rule permitting changes to CRDs when garage.kubernetesSkipCrd is  set to true.
2026-04-16 16:22:17 +00:00
maximilien 7b7548a4f7 Merge pull request 'Fix helm existing configmap volume ref in workload' (#1388) from PhilleZi/garage:fix-helm-existing-configmap into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1388
Reviewed-by: maximilien <git@mricher.fr>
2026-04-16 16:20:27 +00:00
Philip Zingmark a2e410f8b6 Fix helm existing configmap volume ref in workload 2026-04-16 16:20:01 +00:00
Alex 690729ccdb Merge pull request 'fix: bound known_addrs growth and add TCP connect timeout' (#1345) from rajsinghtech/garage:fix/peering-stale-addr-reconnection into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1345
2026-04-15 11:42:38 +00:00
Alex Auvolat ff743453b6 garage_net: make pruning logic simpler and add test 2026-04-15 11:42:38 +00:00
Raj Singh f34a7db48a fix: bound known_addrs growth
known_addrs in PeerInfoInternal is append-only — addresses accumulate
via add_addr() and PeerList gossip but are never removed. In dynamic
environments (k8s pod restarts, DHCP, NAT traversal), this list grows
unboundedly with stale addresses.

Combined with sequential iteration in try_connect() and no TCP connect
timeout in netapp.rs, each unreachable address blocks reconnection for
the kernel's TCP SYN timeout (75-130s on Linux). With 10+ stale
addresses, worst-case reconnection exceeds 750s — a full outage for
replication_factor=3 clusters.

This commit contains the two following changes:

1. Address failure tracking and pruning (peering.rs): Track consecutive
   connection failures per address in PeerInfoInternal. After 3 failures,
   prune from known_addrs. Reset count when address is re-advertised via
   gossip or incoming connection. Prevents unbounded list growth.

2. Shuffle before connecting (peering.rs): Randomize address order in
   try_connect() so the valid address (often appended last) gets a fair
   chance instead of always trying stale addresses first.
2026-04-15 11:42:38 +00:00
Raj Singh 3a355b1617 fix: add TCP connect timeout
known_addrs in PeerInfoInternal is append-only — addresses accumulate
via add_addr() and PeerList gossip but are never removed. In dynamic
environments (k8s pod restarts, DHCP, NAT traversal), this list grows
unboundedly with stale addresses.

Combined with sequential iteration in try_connect() and no TCP connect
timeout in netapp.rs, each unreachable address blocks reconnection for
the kernel's TCP SYN timeout (75-130s on Linux). With 10+ stale
addresses, worst-case reconnection exceeds 750s — a full outage for
replication_factor=3 clusters.

This patches includes a first change to fix this issue:

1. TCP connect timeout (netapp.rs): Wrap TcpStream::connect() in
   tokio::time::timeout(10s). Caps per-address attempt from 75-130s
   to 10s, reducing worst-case 10-addr reconnection from ~750s to ~100s.
2026-04-15 11:42:38 +00:00
Alex 0b5e82a18b Merge pull request 'Cherry-pick #1396 for main-v2' (#1404) from fix-starvation into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1404
2026-04-15 10:35:22 +00:00
Gauthier Zirnhelt 2798667345 Fix the LifecycleWorker being uncooperative (#1396)
## Summary

This PR ensures that the `LifecycleWorker` yields at least once to the Tokio scheduler in between each batch of 100 objects.

## Problem being solved

I'm administrating a Garage cluster which has been experiencing timeouts on all endpoints while the lifecycle worker is running at midnight UTC : `Ping timeout` error messages and even requests eventually failing due to `Could not reach quorum ...`.

I have found that this happens while the lifecycle worker is working on a big bucket (containing millions of objects) with a lifecycle rule that applies to very few objects.
The `process_object()` function does not hit any `await`:
- `last_bucket` is always the same, so the `bucket_table` is not read asynchronously
- no transaction is made on the `object_table` because my lifecycle rule (almost) never applies to any object

The first commit in this PR adds an executable which reproduces the problem that I've been experiencing in a self-contained way : the lifecycle worker starves the Tokio scheduler so much that no other task is able to run (or very rarely).
To run it : `cargo run -p garage_model --bin lifecycle-starvation-test`.
This commit can be dropped post-review, as it's only useful to demonstrate the starvation.

The error messages completely stopped after adding the extra yield to the nodes of my cluster.
The duration of the lifecycle worker task does not appear to have changed at all from what I can see (looking at the timestamps produced either by the self-contained binary or by each of my nodes with the `Lifecycle worker finished` message).

## Note

An other potential fix would have been to force the `WorkerProcessor` to yield before re-enqueuing a busy task, but this would have affected all Garage workers even though it's only the `LifecycleWorker` being uncooperative.

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1396
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: Gauthier Zirnhelt <gauthier.zirnhelt@insimo.fr>
Co-committed-by: Gauthier Zirnhelt <gauthier.zirnhelt@insimo.fr>
2026-04-15 12:13:18 +02:00
Alex b1660f0cba Merge pull request 'document known issues' (#1379) from doc-known-issues into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1379
2026-04-15 10:11:39 +00:00
Alex Auvolat dfb20ba87f doc: write details of known issues 2026-04-15 10:11:39 +00:00
maximilien 7279cb9113 Add comment on tags 2026-04-15 10:11:39 +00:00
Alex Auvolat 56cb89d153 wip: list known issues in documentation 2026-04-15 10:11:39 +00:00
Armael 6fd9bba0cb WebsiteConfiguration: do not emit empty XML attributes for absent values (#1391)
This fixes a regression wrt garage-v1, likely caused by the version upgrade of quick_xml.

Currently, garage-v2 will emit empty ErrorDocument/IndexDocument/RedirectAllRequestsTo attributes in the response of GetBucketWebsite if there are no corresponding values.
This is somewhat wrong; at least, the S3 documentation for RedirectAllRequestsTo (https://docs.aws.amazon.com/AmazonS3/latest/API/API_RedirectAllRequestsTo.html) writes that it has a required HostName field. So emitting an empty RedirectAllRequestsTo is invalid.

This PR skips emitting XML attributes for these parameters if they contain no value.

Co-authored-by: Armaël Guéneau <armael.gueneau@ens-lyon.org>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1391
Co-authored-by: Armael <armael@noreply.localhost>
Co-committed-by: Armael <armael@noreply.localhost>
2026-04-13 13:59:32 +00:00
Jul Lang f9605fae78 fix typo (#1402)
found by [typos](https://github.com/crate-ci/typos)

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1402
Co-authored-by: Jul Lang <jullanggit@proton.me>
Co-committed-by: Jul Lang <jullanggit@proton.me>
2026-04-13 12:12:57 +00:00
Armael 9969c3e599 Fix: correctly parse CORS website configuration with no rules (#1392)
This is a port of #1320 on top of the main-v2 branch.

Co-authored-by: Armaël Guéneau <armael.gueneau@ens-lyon.org>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1392
Co-authored-by: Armael <armael@noreply.localhost>
Co-committed-by: Armael <armael@noreply.localhost>
2026-03-22 17:09:16 +00:00
Alex a69a8d3b21 Merge pull request 'force uri encoding before check signature' (#1382) from gwenlg/garage:signature_doesnt_match_1155 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1382
Reviewed-by: Alex <lx@deuxfleurs.fr>
2026-03-22 10:59:43 +00:00
Gwen Lg 3a97b13e2f wip: add percent_decode before uri_encode for check signature
this avoid error when request uri is not encoded for signature
2026-03-22 10:59:43 +00:00
Gwen Lg 4efaea60bb tests: check request signatures with 'badly-encoded' uri
test related to issue #1155 and #1255
2026-03-22 10:59:43 +00:00
Gwen Lg 06e9756729 test: some error rework 2026-03-22 10:59:43 +00:00
trinity-1686a 8341b7f914 log api error in one self-sufficient line (fix #1381) (#1390)
this makes it more easy to correlate an error with the request that caused it. This can be helpful during debugging, or when setting up some sort of automation based on log content

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1390
Reviewed-by: Alex <lx@deuxfleurs.fr>
Reviewed-by: maximilien <git@mricher.fr>
Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-committed-by: trinity-1686a <trinity@deuxfleurs.fr>
2026-03-20 20:22:34 +00:00
MrSnowy 96b986a0a0 Add completions sub-command for generating shell completions (#1386)
Made a quick pr to add a sub-command called completions for generating shell completions, was going pretty crazy that this wasn't a thing :P.

Tried my best to do everything properly, let me know if I need to change something, I tested it and it works perfectly.

Co-authored-by: MrSnowy <snow@mrsnowy.dev>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1386
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: MrSnowy <mrsnowy@noreply.localhost>
Co-committed-by: MrSnowy <mrsnowy@noreply.localhost>
2026-03-17 18:17:51 +00:00
trinity-1686a 60244b60dd don't panic on missing checksum (fix #1387) (#1389)
fix https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1387

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1389
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: trinity-1686a <trinity-1686a@noreply.localhost>
Co-committed-by: trinity-1686a <trinity-1686a@noreply.localhost>
2026-03-17 18:16:37 +00:00
Alex 9848ec7f4e Merge pull request 'add missing admin API endpoints for admin UI' (#1376) from admin-json-statistics into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1376
2026-03-17 17:44:29 +00:00
Alex Auvolat b81eae3f65 admin api: don't fail in getclusterstatistics when counting total objects/bytes 2026-03-17 17:44:29 +00:00
Alex Auvolat 6131318c80 admin api: don't gather all bucket statistics if too many buckets 2026-03-17 17:44:29 +00:00
Alex Auvolat 4566020360 admin api: convert new fields to Option<T> 2026-03-17 17:44:29 +00:00
Alex Auvolat de10dc43d5 admin api: return total buckets, objects and bytes in GetClusterStatistics 2026-03-17 17:44:29 +00:00
Alex Auvolat 8abd0fee86 admin api: add fixme comments for cleanup for v3 release 2026-03-17 17:44:29 +00:00
Alex Auvolat af5f68a34d admin api: allow updating website routing rules 2026-03-17 17:44:29 +00:00
Alex Auvolat 19e5f83164 admin api: update cors and lifecycle rules in UpdateBucket 2026-03-17 17:44:29 +00:00
Alex Auvolat 64087172ff admin api: expose routing rules, cors rules and lifecycle rules 2026-03-17 17:44:29 +00:00
Alex Auvolat 6c0bb1c9b6 refactoring: move xml definitions for bucket cors/lifecycle/website config
move these defnitions to garage_api_common so that they can also be used
in admin api
2026-03-17 17:44:29 +00:00
Alex Auvolat 124a9eb521 admin api: export node statistics as structured json 2026-03-17 17:44:29 +00:00
Alex Auvolat 03e6020c6b admin api: report avilable space numerically in GetClusterStatistics 2026-03-17 17:44:29 +00:00
milouz1985 836657565e s3: fix DeleteObjects XML parsing with pretty-printed bodies (#1374)
## Summary

This PR fixes S3 `DeleteObjects` XML parsing when the request body is pretty-printed (contains indentation/newlines as whitespace text nodes).

Although PR #1324 already tried to address this, parsing could still fail with:

`InvalidRequest: Bad request: Invalid delete XML query`

because non-element nodes were validated but not actually skipped in the parsing loop.

## What changed

- In `src/api/s3/delete.rs`:
  - Properly skip non-element whitespace text nodes while iterating over `<Delete>` children.
  - Keep rejecting non-whitespace stray text content.
  - Parse the root `<Delete>` element more robustly by selecting the first element child.

## Tests added

New unit tests in `src/api/s3/delete.rs`:

- `parse_delete_objects_xml_with_formatting`
  - pretty-printed valid XML is accepted.
- `parse_delete_objects_xml_accepts_compact_valid_xml`
  - compact valid XML is accepted.
- `parse_delete_objects_xml_rejects_non_whitespace_text_node`
  - compact XML with stray text is rejected.
- `parse_delete_objects_xml_rejects_pretty_print_with_stray_text`
  - pretty-printed XML with stray text is rejected.

## Validation

Executed:

```bash
cargo test -p garage_api_s3 parse_delete_objects_xml -- --nocapture
```

Result: all parser tests pass.
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1374
Co-authored-by: milouz1985 <francois.hoyez@gmail.com>
Co-committed-by: milouz1985 <francois.hoyez@gmail.com>
2026-03-15 10:40:50 +00:00
trinity-1686a 76592723de don't send empty 404 on GetBucketCORS/GetBucketLifecycle (#1378)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1378
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-committed-by: trinity-1686a <trinity@deuxfleurs.fr>
2026-03-10 09:41:08 +00:00
Ira Iva d2f033641e Suppress log noise from /metrics and /health endpoints [#1292]. Change log level for 'netapp: incomming connection ...' message [#1310] (#1361)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1361
Co-authored-by: Ira Iva <xatikopro@gmail.com>
Co-committed-by: Ira Iva <xatikopro@gmail.com>
2026-03-03 15:52:53 +00:00
Roman Ivanov 2cfd92e0c3 Use error NoSuchAccessKey in get info request processing (#1293) (#1356)
Fix for https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1293

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1356
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: Roman Ivanov <xatikopro@gmail.com>
Co-committed-by: Roman Ivanov <xatikopro@gmail.com>
2026-02-27 18:11:57 +00:00
Quentin Dufour f796df8c34 Support streaming of gzip content involving multiple Content-Encoding headers (#1369)
## Problem

`hugo deploy` is broken with Garage on recent hugo versions when using gzip matchers

## Why?

We don't support multi-value headers correctly, in this case this specific headers combination:

```
Content-Encoding: gzip
Content-Encoding: aws-chunked
```

is interpreted as:

```
Content-Encoding: gzip
```

instead of:

```
Content-Encoding: gzip,aws-chunked
```

It fails both 1. the signature check and 2. the streaming check.

## Proposed fix

 - Taking into account multi-value headers when building Canonical Request (validated with hugo deploy + AWS SDK v2)
 - Taking into account multi-value headers (both comma separated and HeaderEntry separated) when removing `aws-chunked` (validated with hugo deploy + AWS SDK v2)

## Full explanation

Currently, `hugo deploy` on version `hugo v0.152.2` or more recent uses AWS SDK v2 only and supports for sending gzipped content.
That's configured with a matcher like that:

```yaml
deployment:
  matchers:
    - pattern: "^.+\\.(woff2|woff|svg|ttf|otf|eot|js|css)$"
      cacheControl: "max-age=31536000, no-transform, public"
      gzip: true  # <-------- here
```

Also, with SDK v2, hugo is streaming all of its files.
Thus, it sends that kind of requests:

```python
Request {
  method: PUT,
  uri: /sebou/pagefind/pagefind.js?x-id=PutObject,
  version: HTTP/1.1,
  headers: {
    "host": "localhost",
    "user-agent": "aws-sdk-go-v2/1.39.2 ua/2.1 os/linux lang/go#1.25.6 md/GOOS#linux md/GOARCH#amd64 api/s3#1.84.0 ft/s3-transfer m/E,G,Z,g",
    "content-length": "10026",
    "accept-encoding": "identity",
    "amz-sdk-invocation-id": "aed6df34-a67c-4bab-b63b-2b3777b751a0",
    "amz-sdk-request": "attempt=1; max=3",
    "authorization": "AWS4-HMAC-SHA256 Credential=GKxxxxx/20260227/garage/s3/aws4_request, SignedHeaders=accept-encoding;amz-sdk-invocation-id;amz-sdk-request;cache-control;content-encoding;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-meta-md5chksum;x-amz-trailer, Signature=76cd9b77f693ca89c2e6dd2a4dc55f83d4a82eca0f563d9d095ff96076f7b057",
    "cache-control": "max-age=31536000, no-transform, public",
    "content-encoding": "gzip",                                           # <---- see here 1st instance of Content-Encoding
    "content-encoding": "aws-chunked",                                    # <---- 2nd instance of Content-Encoding
    "content-type": "text/javascript",
    "via": "2.0 Caddy",
    "x-amz-content-sha256": "STREAMING-UNSIGNED-PAYLOAD-TRAILER",
    "x-amz-date": "20260227T132212Z",
    "x-amz-decoded-content-length": "9982",
    "x-amz-meta-md5chksum": "aad88ac0bf704e91584b8d9ad9796670",
    "x-amz-trailer": "x-amz-checksum-crc32",
    "x-forwarded-for": "::1",
    "x-forwarded-host": "localhost",
    "x-forwarded-proto": "https"
  },
  body: Body(Streaming)
}
```

But our canonical request function only calls `HeaderMap.get()` that returns only the 1st value and not `HeaderMap.get_all()` that returns all the values for a header.
Leading to the following invalid `CanonicalRequest` value:

```python
PUT
/sebou/pagefind/pagefind.js
x-id=PutObject
accept-encoding:identity
amz-sdk-invocation-id:aed6df34-a67c-4bab-b63b-2b3777b751a0
amz-sdk-request:attempt=1; max=3
cache-control:max-age=31536000, no-transform, public
content-encoding:gzip                                                             # <----- see here, we kept only gzip and dropped aws-chunked
content-length:10026
content-type:text/javascript
host:localhost
x-amz-content-sha256:STREAMING-UNSIGNED-PAYLOAD-TRAILER
x-amz-date:20260227T132212Z
x-amz-decoded-content-length:9982
x-amz-meta-md5chksum:aad88ac0bf704e91584b8d9ad9796670
x-amz-trailer:x-amz-checksum-crc32

accept-encoding;amz-sdk-invocation-id;amz-sdk-request;cache-control;content-encoding;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-decoded-content-length;x-amz-meta-md5chksum;x-amz-trailer
```

Amazon is crystal clear that, instead of dropping the other values, we should concatenate them with a comma:

![20260227_17h26m20s_grim](/attachments/e3edf7bf-7dff-43d7-80d9-cf276ae94ed5)

https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv-create-signed-request.html#create-canonical-request
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1369
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: Quentin Dufour <quentin@deuxfleurs.fr>
Co-committed-by: Quentin Dufour <quentin@deuxfleurs.fr>
2026-02-27 18:02:31 +00:00
trinity-1686a 668dfea4e2 fix silent write errors (#1360)
same as #1358 for garage-v2

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1360
Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-committed-by: trinity-1686a <trinity@deuxfleurs.fr>
2026-02-24 14:40:11 +00:00
maximilien 7f61bbbebb Merge pull request 'helm: add priorityClassName support' (#1357) from blue.lion4023/garage:helm-add-priority-class-name into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1357
Reviewed-by: maximilien <git@mricher.fr>
2026-02-21 08:23:14 +00:00
blue.lion4023 8105ca888d helm: add priorityClassName support to pod spec 2026-02-20 21:36:08 +00:00
Alex d0166fe938 Merge pull request 'Upgrade quick-xml crate to 0.39' (#1319) from gwenlg/garage:quick_xml_upgrade into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1319
Reviewed-by: Alex <lx@deuxfleurs.fr>
2026-02-20 21:29:26 +00:00
Gwen Lg 290a7f5ab6 fix: VersioningConfiguration xml reference
empty element handling is set as expanded and be consistant.
2026-02-20 21:29:26 +00:00
Gwen Lg 2576626240 fix: configure xmk serializer to expand empty elements 2026-02-20 21:29:26 +00:00
Gwen Lg 6591044c2e fix: set quote level to full for xml serialization
also remove use of intermediate String
2026-02-20 21:29:26 +00:00
Gwen Lg 1ae4e5d438 fix: mark to skip serialization of Option when None
mark with `skip_serializing_if = "Option::is_none"`
2026-02-20 21:29:26 +00:00
Gwen Lg d80096de92 fixup: fix xml attibute xmlns serialization
rename var with "@xmlns"
2026-02-20 21:29:26 +00:00
Gwen Lg 674c2c1cb1 chore: update quick-xml dep
rework associated error, and fixup error for XML serialization.
Should be InternalError/INTERNAL_SERVER_ERROR not MalformedXML/BAD_REQUEST
2026-02-20 21:29:26 +00:00
Gwen Lg 3c5018bd6b refactor: use str trim result to parse xml
- use `trim` method of `str` instead of manual implementation with `trim_matches(char::is_whitespace)`
- use result of `trim` for xml parsing instead of use the `str` before trim.
2026-02-20 21:29:26 +00:00
Gwen Lg 93cd71eb72 test: add unprettify_xml helper and use it
this replace previous cleanup which remove space between `element` and `attribute` name in xml
2026-02-20 21:29:26 +00:00
Gwen Lg 507be60890 test: use assert_eq instead of assert to improve failed output 2026-02-20 21:29:26 +00:00
Gwen Lg 780f389973 test: replace some unwrap with expect in tests
this add more information in case of failure
2026-02-20 21:29:26 +00:00
rajsinghtech 69cd230568 fix: enable TCP keepalive on RPC connections (#1348)
Garage RPC connections have no TCP keepalive enabled. When a connection dies silently (proxy pod restart, NAT timeout, network partition), it's only detected by application-level pings after ~60s (4 failed pings x 15s interval). During this window, the node appears connected but all RPC calls to it fail.

Enable TCP keepalive on both outgoing and incoming RPC connections via socket2:
- Idle time before first probe: 30s (TCP_KEEPALIVE_TIME)
- Probe interval after first: 10s (TCP_KEEPALIVE_INTERVAL)

A helper set_keepalive() function avoids duplicating the socket2 setup. Incoming connection keepalive failures are logged as warnings but don't reject the connection.

Companion to #1345 (stale address pruning + connect timeout). Together they address both halves of the reconnection problem: faster detection (this PR) and faster recovery.

Co-authored-by: Raj Singh <raj@tailscale.com>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1348
Reviewed-by: maximilien <git@mricher.fr>
Co-authored-by: rajsinghtech <rajsinghtech@noreply.localhost>
Co-committed-by: rajsinghtech <rajsinghtech@noreply.localhost>
2026-02-20 21:28:29 +00:00
Malte Swart 55370d9b4d consul: support token auth for catalog api requests, too (#1353)
Even when using the catalog an dedicated token for authentication
might be needed.

**Approach**: Support the token header even with client certs was the simplist approach and somebody might need/want to use it.

**Background**: I want to run garage via Nomad but within containers (with host volumes). Nomad generates consul tokens (but at least not at the moment client certs). I need to use the catalog as with the services API garage tries to use the host/node IPs (instead of the actual service IPs).

**Tests**: I deployed this version and it works well.

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1353
Reviewed-by: Alex <lx@deuxfleurs.fr>
Co-authored-by: Malte Swart <mswart@devtation.de>
Co-committed-by: Malte Swart <mswart@devtation.de>
2026-02-20 21:27:59 +00:00
Roman Ivanov ce1ea79bf1 Implement error 409 BucketAlreadyOwnedByYou (#1352)
Fix for Deuxfleurs/garage#1322

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1352
Co-authored-by: Roman Ivanov <xatikopro@gmail.com>
Co-committed-by: Roman Ivanov <xatikopro@gmail.com>
2026-02-18 11:20:24 +00:00
Alex 2803c73045 Merge pull request 'code maintenance with help clippy' (#1314) from gwenlg/garage:code_maintenance_part2 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1314
Reviewed-by: Alex <lx@deuxfleurs.fr>
2026-02-17 18:38:44 +00:00
Gwen Lg 9b3e4716bf refactor: rework uri_encode to limit allocation
add add some related tests.

catched from clippy lint `format_collect`
message: use of `format!` to build up a string from an iterator
  --> src/api/common/encoding.rs:12:17
   |
12 |                   let value = format!("{}", c)
   |  _____________________________^
13 | |                     .bytes()
14 | |                     .map(|b| format!("%{:02X}", b))
15 | |                     .collect::<String>();
   | |________________________________________^
   |
help: call `fold` instead
  --> src/api/common/encoding.rs:14:7
   |
14 |                     .map(|b| format!("%{:02X}", b))
   |                      ^^^
help: ... and use the `write!` macro here
  --> src/api/common/encoding.rs:14:15
   |
14 |                     .map(|b| format!("%{:02X}", b))
   |                              ^^^^^^^^^^^^^^^^^^^^^
   = note: this can be written more efficiently by appending to a `String` directly
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#format_collect
2026-02-17 18:38:44 +00:00
Gwen Lg 83f8bdbacd refactor: remove unnecessarily wrap value into a Result
this simplify code and remove some unwrap.
warning: this function's return value is unnecessarily wrapped by `Result`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_wraps
2026-02-17 18:38:44 +00:00
Gwen Lg b060a7e0f1 fix: remove func call from alternative value.
this avoid useless allocation or non-trivial work, if the default value
is not needed/used.

add a line in Cargo.toml to easly enable or_fun_call lint
help: https://rust-lang.github.io/rust-clippy/master/index.html?search=or_fun_call
2026-02-17 18:38:44 +00:00
Gwen Lg f6414210fa refactor: rework bucket value get, relateted to or_func_call
this avoid bucket_website_config value compute if not needed
2026-02-17 18:38:44 +00:00
Gwen Lg bbb62dfa85 refactor: use u64::midpoint instead of manual implementation
warning: manual implementation of `midpoint` which can overflow
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#manual_midpoint
2026-02-17 18:38:44 +00:00
Gwen Lg f59a8b7f62 style: corrects the use of ';' to improve readability
- remove unnecessary semicolon
and enable lint warning: unnecessary semicolon
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_semicolon
- add `;` to the last statement for consitent formatting
and enable lint `clippy::semicolon_if_nothing_returned`
warning: consider adding a `;` to the last statement for consistent formatting
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#semicolon_if_nothing_returned
2026-02-17 18:38:44 +00:00
Gwen Lg 08fd6e659f docs: add missing backticks in documentation
this improve readability of documentation.
enable associated clippy lint `doc_markdown`
2026-02-17 18:38:44 +00:00
Gwen Lg 6cde00073f chore: enable workspace configuration of lints in Cargo.toml
and use workspace configuration in each package.
This allow to customize clippy and rust lint configuration for project.
No particular configuration in this commit.
2026-02-17 18:38:44 +00:00
Gwen Lg 0043ad08fa docs: remove obsolete mention of cargo2nix tool (#1350)
fix issue #1333

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1350
Co-authored-by: Gwen Lg <me@gwenlg.fr>
Co-committed-by: Gwen Lg <me@gwenlg.fr>
2026-02-17 18:16:04 +00:00
Maximilien Richer 0c70c87391 Add FOSDEM 2026 talk (#1344)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1344
Co-authored-by: Maximilien Richer <me@mricher.fr>
Co-committed-by: Maximilien Richer <me@mricher.fr>
2026-02-15 15:17:27 +00:00
trinity-1686a b0840ab256 emit headers on Not Modified per RFC-9110, fix #1330 (#1340)
also fix a small information disclosure where a client with valid token, but no encryption keys, can use Not Modified has an oracle to know if etag matches or not

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1340
Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-committed-by: trinity-1686a <trinity@deuxfleurs.fr>
2026-02-15 11:00:31 +00:00
Alex Auvolat 7ad0f96222 release builds: set lto="thin" and strip="debuginfo" (#1342)
- thin LTO is much much faster to compile, this will help when making
  release builds
- strip="debuginfo" allows to still have symbols when unwinding stack
  traces, which are usefull to have in user's bug reports. Binary size
  is increased from 23M to 27M, so a reasonable increase

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1342
Co-authored-by: Alex Auvolat <lx@deuxfleurs.fr>
Co-committed-by: Alex Auvolat <lx@deuxfleurs.fr>
2026-02-15 08:58:57 +00:00
trinity-1686a c373222e3a run push CI only on main branch (#1343)
currently, ci runs twice for people pushing directly to this repository (e.g. https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1340, you can see both woodpecker/{pr,pull}/debug)
that's a waste of resources, we'll do twice exactly the same thing.
i propose we only run push ci on `main-*` branches, so that creating a PR doesn't create two jobs

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1343
Co-authored-by: trinity-1686a <trinity@deuxfleurs.fr>
Co-committed-by: trinity-1686a <trinity@deuxfleurs.fr>
2026-02-15 08:57:52 +00:00
Alex c73268fd77 Merge pull request 'chore: update nom dependency to 0.8' (#1341) from gwenlg/garage:nom_upgrade into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1341
Reviewed-by: Alex <lx@deuxfleurs.fr>
2026-02-14 19:25:49 +00:00
Gwen Lg c82015f6cf chore: update nom dependency to 0.8
update syntax with :
- add explicit call of `parse` method
- add ref slice management for `tag` fn
2026-02-14 19:25:49 +00:00
Alex 3af9e8d3d2 Merge pull request 'Make initial setup easier' (#1329) from easy-bootstrap into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1329
2026-02-14 18:26:43 +00:00
Alex Auvolat 1d588282bf print path to configuration file in startup logs 2026-02-14 19:25:47 +01:00
Alex Auvolat f7ec4b1338 update quick start guide 2026-02-14 19:25:47 +01:00
Alex Auvolat 00cbc5c31d relax requirements on imported access keys to allow easier transition from other S3 storage providers (fix #1262) 2026-02-14 19:23:44 +01:00
Alex Auvolat 95aa3bc795 bootstrap: add --default-access-key and --default-bucket flags 2026-02-14 19:23:44 +01:00
Alex Auvolat 53ace58e44 bootstrap: add --single-node flag that creates a single-node layout 2026-02-14 19:23:44 +01:00
Alex c22c4ff2e5 Merge pull request 'style: replace wildcard import of garage model in website' (#1334) from gwenlg/garage:avoid_import_conflict into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1334
2026-02-14 18:21:31 +00:00
Gwen Lg 6f511fc149 style: replace wildcard import of garage model in website
this avoid rust-analyzer indicate invalid field error on `Redirect` for
`replace_prefix` and `replace_full` because of a conflict between struct :
`api::s3::website::Redirect` and `model::bucket_table::Redirect`
2026-02-14 18:21:31 +00:00
Alex 70b8ebc8b6 Merge pull request 'Document how to use Apache as a reverse proxy' (#1331) from jasonaowen/garage:cookbook-reverse-proxy-apache into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1331
2026-02-14 18:08:08 +00:00
Alex 02db2d5f9d Merge pull request 'fix path missmatch between config and docker in quickstart doc' (#1339) from 1686a/doc-incoherent-path into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1339
Reviewed-by: maximilien <git@mricher.fr>
2026-02-14 17:53:36 +00:00
trinity-1686a cc749a6290 fix path missmatch between config and docker in quickstart doc 2026-02-14 11:19:28 +01:00
Jason Owen 9f969ef43e Document how to use Apache as a reverse proxy
Replace the TODO in the reverse proxy cookbook entry with instructions
on how to configure Apache httpd as a reverse proxy for Garage.
2026-02-12 00:21:40 -08:00
Alex 4989be7853 Merge pull request 'update almost all dependencies to the last version' (#1316) from gwenlg/garage:maintenance_deps into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1316
2026-02-10 19:16:49 +00:00
Gwen Lg 8ce4415edb chore: update k8s related dependencies
- k8s-openapi, kube and schemars
2026-02-10 19:16:49 +00:00
Gwen Lg 75c28faa5b chore: update tokio and hyper-rustls dependencies 2026-02-10 19:16:49 +00:00
Gwen Lg 8644511ebc chore: update aws dependencies
aws-sigv4, aws-smithy-runtime, aws-sdk-config, aws-sdk-s3
2026-02-10 19:16:49 +00:00
Gwen Lg e5627bbd6b chore: update reqwest dependency to 0.13 2026-02-10 19:16:49 +00:00
Gwen Lg 3aeb6d88af update fjall dep to 2.11 2026-02-10 19:16:49 +00:00
Gwen Lg 6f44631973 chore: update various dependencies than don't need code changes
and run cargo update
2026-02-10 19:16:49 +00:00
Gwen Lg 566a0b44c0 chore: update bytesize dependency to 2.3
include code update to follow display management change.
2026-02-10 19:16:49 +00:00
Gwen Lg 934c4c31f1 chore: update dependency rand to 0.9 2026-02-10 19:16:49 +00:00
Gwen Lg be8e4c9dcf chore: remove patch version of deps in Cargo.toml
as cargo can update a crate to last patch version anyway, it's can be
confusing.
2026-02-10 19:16:49 +00:00
Alex 1b20713421 Merge pull request 'adapt code to unsafety of env::set_var fn' (#1317) from gwenlg/garage:env_set_var into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1317
2026-02-10 19:12:52 +00:00
Gwen Lg 473b66ca5b fix: mark unsafety of std::env::set_var
and document the function.
2026-02-10 18:46:55 +01:00
Gwen Lg 5c8a31708e refactor: manualy build tokio runtime for k2v-cli 2026-02-10 18:46:55 +01:00
Gwen Lg ca1211d927 refactor: manualy build tokio runtime for garage
to allow do some initialization before
2026-02-10 18:46:55 +01:00
bytechunk b012431df0 S3 api DeleteObject fix invalid XML (#1324)
linked to #1323

Do only check element nodes when validating XML content (skip text
nodes).

If text nodes are skipped then the validation fails when providing
formatted XML content as body of the request.

Co-authored-by: frederic vroman <fred@lesmouths.net>
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1324
Co-authored-by: bytechunk <bytechunk.a52b055@track-it.pw>
Co-committed-by: bytechunk <bytechunk.a52b055@track-it.pw>
2026-02-09 13:05:58 +00:00
Gwen Lg 6e98f5e74e upgrade heed to version 0.22 (#1318)
- migration from `ByteSlice` to `Bytes` heed type.
- not sure about the impact of only one `read_txn` for the entire function `list_trees`, whereas before `open_database` call uses their own access controller.

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1318
Co-authored-by: Gwen Lg <me@gwenlg.fr>
Co-committed-by: Gwen Lg <me@gwenlg.fr>
2026-02-07 13:22:46 +00:00
Gwen Lg c7d6eb631f chore: update cmd parameter name in shell.nix
should fix the warning :
WARN[0000] Flag --customPlatform is deprecated. Use: --custom-platform
2026-01-29 22:14:34 +00:00
Gwen Lg 5eb381a22a refactor: use OnceLock for Instance in test
... instead of unsafe `static mut` as it's not safe.
Change terminate to apply on `&self` and use a Mutex for Instance interior mutability.
2026-01-29 20:50:05 +01:00
Gwen Lg 3b6daa7d0f refactor: rework init_tracing to avoid unused variable
... when feature `telemetry-otlp` is not enabled
move feature management into tracing_setup module to make the server code cleaner.
2026-01-29 20:50:05 +01:00
Gwen Lg 7d05d9d520 chore: set aws_s3 BehaviorVersion to latest in tests common client
ok because this code shouldn't be reliant on extremely specific behavior characteristics.
And this avoid use of deprecated version.
2026-01-29 20:50:05 +01:00
Gwen Lg f0b443652a ci: add lints check with clippy in debug workflow 2026-01-29 20:50:04 +01:00
Gwen Lg cd5cd37ecc style: improve lisibility of db_path code
split suffix get from match self and path construction
2026-01-29 20:49:28 +01:00
Gwen Lg e5f87fb51e refactor: use let Some instead of is_some + unwrap
lint message: called `unwrap` on `config.k2v_api` after checking its variant with `is_some`
lint message: called `unwrap` on `config.admin.trace_sink` after checking its variant with `is_some`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap
2026-01-29 20:49:28 +01:00
Gwen Lg b0ee7dd3c9 chore: localy disable some lints
- clippy::nonminimal_bool disabled for check_size_filter function
clippy message: this boolean expression can be simplified
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#nonminimal_bool
- clippy::large_enum_variant for `DecryptStreamState` and `State`
- clippy::too_many_arguments for `put_block_and_meta` and
  `test_read_encrypted`
- clippy::deref_addrof for specific unsafe code
- clippy::doc_overindented_list_items and clippy::doc_lazy_continuation
2026-01-29 20:49:28 +01:00
Gwen Lg 4a0be692b3 docs: various fixes in Rust code documentation
- add backticks on struct doc comments
lint message: unclosed HTML tag `M`
- add a blanck line for proper doc formating
lint message: doc list item without indentation
help: if this is supposed to be its own paragraph, add a blank line
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#doc_lazy_continuation
- fix hyperlink in doc + one url invalid
lint message: this URL is not a hyperlink
note: bare URLs are not automatically turned into clickable links
- ajust space in doc
lint message: doc list item overindented
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#doc_overindented_list_items
2026-01-29 20:49:28 +01:00
Gwen Lg a5d047b5ae style: use if else instead of then_some + unwrap_or
create dedicated fn for `deleted` printing to improve lisibility an
deduplicate code.

clippy message: this method chain can be written more clearly with `if .. else ..`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#obfuscated_if_else
2026-01-29 20:49:28 +01:00
Gwen Lg 24e11e99ee style: some small fixes
- remove invalid struct pattern
lint message: struct pattern is not needed for a unit variant
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unneeded_struct_pattern
- remove call to default() on unit struct
lint message: use of `default` to create a unit struct
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#default_constructed_unit_structs
- replace if/else by direct affectation
lint message: this if-then-else expression assigns a bool literal
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_bool_assign
- replace assert_eq on unit by `unwrap` + let typed binding
2026-01-29 20:49:28 +01:00
Gwen Lg bddd23136b refactor: reduce number of arguments by use struct
- create and use HandleInfo and DestInfo to reduce number of arguments
lint message: warning: this function has too many arguments (9/7)
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#too_many_arguments
2026-01-29 20:49:28 +01:00
Gwen Lg a426b00e87 style: collapse nested if block
lint message: this `if` statement can be collapsed
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#collapsible_if
2026-01-29 20:49:28 +01:00
Gwen Lg 8772db8228 refactor: rename method to avoid confusion
- rename SqliteDb::new to `_::open` as it's not return Self
lint message: methods called `new` usually return `Self`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#new_ret_no_self
- rename method `add` to `add_calgorithm`
The semantics of this has nothing to do with an `add` operation in the sense of the `Add` trait.
And method `add` can be confused for the standard trait method std::ops::Add::add
lint https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#should_implement_trait
2026-01-29 20:49:28 +01:00
Gwen Lg 5307b3f762 chore: remove unnecessary cast usize
lint message: casting to the same type is unnecessary (`u64` -> `u64`)
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unnecessary_cast

+ disable `clippy::unnecessary_cast` for update_disk_usage
where the size of the input values depends on the platform
2026-01-29 20:49:28 +01:00
Gwen Lg 6dbcdcd784 style: improve use of std api
- replace get(0) by first()
lint message: accessing first element with `objs.get(0)`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#get_first
- use io::Error::other method available since Rust 1.87
lint message: this can be `std::io::Error::other(_)`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#io_other_error
- implement From<_> instead of Into<_>
lint message: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true
help: `impl From<Local> for Foreign` is allowed by the orphan rules, for more information see
            https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#from_over_into
- use next_back instead of rev + next
lint message: manual backwards iteration
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#manual_next_back
- use saturating_sub instead of manual implement it
lint message: manual arithmetic check found
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#implicit_saturating_sub
- add Default implementation for Checksummer
use derived Default ans use it in new, as new set all value to None
lint message: you should consider adding a `Default` implementation for `Checksummer`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#new_without_default
- use `any` instead of `find` + `is_some`
lint message: called `is_some()` after searching an `Iterator` with `find`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#search_is_some
- replace `and_then` + `Some(_)` with `map`
lint message: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#bind_instead_of_map
- replace `skip_while` + `next` with `find`
lint message: called `skip_while(<p>).next()` on an `Iterator`
help: this is more succinctly expressed by calling `.find(!<p>)` instead
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#skip_while_next
- use `matches!` instead of manual implementation
lint message: match expression looks like `matches!` macro
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#match_like_matches_macro
- use `keys` and `values methods insteads of iterating and ignoring either the keys or values.
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#iter_kv_map
2026-01-29 20:49:28 +01:00
Gwen Lg f2f6669bf0 style: clean use for question_mark
- remove useless `Ok` enclosing with `?`
lint message: enclosing `Ok` and `?` operator are unneeded
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_question_mark
- use question mark instead of manual implementation
lint message: this `match` expression can be replaced with `?`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#question_mark
2026-01-29 20:49:28 +01:00
Gwen Lg 21db7a4d4b chore: remove various useless code
- call expect directly on Result
lint message: called `ok().expect()` on a `Result` value
help: you can call `expect()` directly on the `Result`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ok_expect
- use assign operation instead of manual implementation
lint message: manual implementation of an assign operation
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#assign_op_pattern
- remove useless call to format
lint message: useless use of `format!`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_format
- remove useless `?Sized`
lint message: `?Sized` bound is ignored because of a `Sized` requirement
note: ...because `Deserialize` has the bound `Sized`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_maybe_sized
- use is_some instead of pattern maching with Some(_)
lint message: redundant pattern matching, consider using `is_some()`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#redundant_pattern_matching
- remove unneeded unit return type
lint message: unneeded unit return type
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unused_unit
- remove redundant closure
lint message: redundant closure
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#redundant_closure
- use derive Default instead of manual implementation
lint message: this `impl` can be derived
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#derivable_impls
- remove unneeded `return` statement
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_return
- remove empty string from println call
lint message: empty string literal in `println!`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#println_empty_string
- remove clone() on type than implement Copy
lint message: using `clone` on type `Option<ChecksumValue>` which implements the `Copy` trait
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#clone_on_copy
- remove useless let binding
lint message: this let-binding has unit value
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#let_unit_value
- remove useless len comparison to zero, already test of empty
lint message: length comparison to zero
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#len_zero
- remove useless `as_deref` call
lint message: derefed type is same as origin
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_option_as_deref
- remove useless conversion of the same type
lint message: useless conversion to the same type: `replication_mode::ReplicationFactor`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_conversion
- remove useless bool_comparison
lint message: equality checks against false can be replaced by a negation
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#bool_comparison
- remove useless to_string
lint message: unnecessary use of `to_string`
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#unnecessary_to_owned

Signed-off-by: Gwen Lg <me@gwenlg.fr>
2026-01-29 20:49:28 +01:00
Gwen Lg ea9597819c refactor: clean perf related
- use array instead of vec when it's useless
clippy lint message: useless use of `vec!` help: you can use an array directly.
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_vec
- call as_bytes before slicing
lint message: calling `as_bytes` after slicing a string
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#sliced_string_as_bytes

Signed-off-by: Gwen Lg <me@gwenlg.fr>
2026-01-29 20:49:28 +01:00
Gwen Lg 141b3f24f1 chore: clean relative to references and borrows
- lint message: the borrowed expression implements the required traits
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrows_for_generic_args
- lint message: this expression creates a reference which is immediately dereferenced by the compiler
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrow
- lint message: you don't need to add `&` to all patterns
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#match_ref_pat
- remove useless taken reference
lint message: needlessly taken reference of left operand
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#op_ref
- use &Path instead of &PathBuf as fn parameters
lint message: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ptr_arg
2026-01-29 20:49:28 +01:00
Gwen Lg 209263eb93 style: adjust specified lifetime in code
- include the lifetime instead of hide it
lint message: hiding a lifetime that's elided elsewhere is confusing
help: the same lifetime is referred to in inconsistent ways, making the signature confusing
- remove useless lifetime
lint message: the following explicit lifetimes could be elided: 'a
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_lifetimes
2026-01-29 20:49:28 +01:00
Gwen Lg 295c850380 chore: add taplo.toml and resave Cargo.toml
Signed-off-by: Gwen Lg <me@gwenlg.fr>
2026-01-29 20:49:28 +01:00
Gwen Lg 33d37b24bd fix: remove duplicate net feature of tokio
Signed-off-by: Gwen Lg <me@gwenlg.fr>
2026-01-29 20:49:28 +01:00
Gwen Lg 46f6967934 chore: update arc-swap to v1.1 as 1.0 is yanked 2026-01-29 20:49:28 +01:00
Gwen Lg c0b574361e ci: add typos step in debug workflow
use typos package than can be not up-to-date.
add `typos` in the list of packages of the shell used for all CI jobs
2026-01-29 14:53:27 +01:00
Gwen Lg f2e00781bb chore: add exceptions in typos conf file
- `PN` use in some tex file
- `substituters` which is an offcial word of Nix vocabulary
2026-01-29 14:53:27 +01:00
Gwen Lg 32da94cbbe chore: rename strat into strategy to improve redability
`strat` is reported as error by typos
2026-01-29 14:53:27 +01:00
Gwen Lg 014bebfa1f chore: improve code readability by rename pn var in part_number 2026-01-29 14:53:27 +01:00
Gwen Lg e9fbde3adf chore: fix typos in variant Abandoned in enum PeerConnState 2026-01-29 14:53:27 +01:00
Gwen Lg 1d1cfb0e29 chore: fix typos in various files
yml, json, tex, sh
2026-01-29 14:53:27 +01:00
Gwen Lg e331f88c85 chore: fix typos in rust code comment or error message 2026-01-29 14:53:27 +01:00
Gwen Lg 4650fbd49c chore: fix typos of rust type name in markdown
=> `CustomResourceDefinition` and `metadata_fsync`
2026-01-27 21:17:15 +01:00
Gwen Lg 43ed68c558 chore: a large number of typo corrections in markdown files 2026-01-27 21:17:15 +01:00
Gwen Lg d1bc921ec2 chore: add 'typos.toml' configuration file 2026-01-27 21:17:15 +01:00
Thijs Broersen ef36e4c8b2 fix: helm configmap quoted block_size 2026-01-25 13:15:20 +01:00
Alex Auvolat 582b168b6a bump version to v2.2.0 2026-01-24 12:32:22 +01:00
Alex Auvolat c821d4974a Update cargo dependencies (#1295)
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1295
Co-authored-by: Alex Auvolat <lx@deuxfleurs.fr>
Co-committed-by: Alex Auvolat <lx@deuxfleurs.fr>
2026-01-24 11:23:15 +00:00
Alex eb1b621a5a Merge pull request 'Sync main-v2 with main-v1' (#1296) from merge-v1 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1296
2026-01-24 10:37:44 +00:00
Alex Auvolat 0c32294485 pin crane version in flake 2026-01-24 10:36:19 +01:00
Alex Auvolat 21500545bb fix python/boto3 2026-01-24 10:12:04 +01:00
Alex Auvolat a525d0e36a small doc updates 2026-01-24 09:56:22 +01:00
Alex Auvolat 29e869ac88 reenable S3 checksumming in test scripts 2026-01-24 09:56:14 +01:00
Alex Auvolat cd641a9ed2 Merge branch 'main-v1' into merge-v1 2026-01-24 09:56:02 +01:00
Dryusdan 68876f0b08 Add Pleroma documentation (#1294)
I have successfully setup my Pleroma instance with GarageHQ and would share this in the documentation.

The part with the loop is totally optionnal, but, as I said, in case of old link in Pleroma database I prefer run it.

Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1294
Co-authored-by: Dryusdan <contact@dryusdan.fr>
Co-committed-by: Dryusdan <contact@dryusdan.fr>
2026-01-24 08:25:32 +00:00
Alex ba1f30d393 Merge pull request 'Document feature flags in the cookbook and in --version' (#1286) from jasonaowen/garage:document-feature-flags into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1286
Reviewed-by: trinity-1686a <trinity-1686a@noreply.localhost>
2026-01-20 10:48:08 +00:00
Alex 9018ed9b97 Merge pull request 'Fixes #1268 Arch Linux package in Extra now' (#1284) from kuba86/garage:arch-package-extra-1268 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1284
Reviewed-by: trinity-1686a <trinity-1686a@noreply.localhost>
2026-01-20 10:47:48 +00:00
kuba86 13ded6dd35 Fixes #1268
Update Arch Linux installation instructions in binary-packages guide
2026-01-20 11:45:00 +01:00
Alex 4d96719d96 Merge pull request 'Fix presigned post when bucket is absent from fields' (#1290) from joeanderson/garage:fix/presigned-post-bucket into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1290
Reviewed-by: trinity-1686a <trinity-1686a@noreply.localhost>
2026-01-20 10:39:46 +00:00
joeanderson 77ef3c85ea Merge branch 'main-v2' into fix/presigned-post-bucket 2026-01-18 15:38:28 +00:00
Joe Anderson 79c7126b67 Allow bucket to be missing from presigned post params 2026-01-18 15:08:59 +00:00
Jason Owen 77b6233496 Document remaining features in cookbook & version
Add the remaining feature flags to the cookbook and the version
information.
2026-01-13 22:42:43 -08:00
Jason Owen 547fe30a05 Sort feature flags
Put the features flags into alphabetical order in both the cookbook and
the version information, so that it is easier to document additional
feature flags.
2026-01-13 22:21:38 -08:00
Jason Owen bff5068efc Refer to git.deuxfleurs.fr as Forgejo not Gitea
The version control site was migrated from Gitea to Forgejo some time
ago, and Forgejo has declared a hard fork from Gitea[1]. Update the
documentation and links to refer to the site as a Forgejo instance
instead of a Gitea instance.

[1] https://forgejo.org/2024-02-forking-forward/
2026-01-13 20:35:56 -08:00
Alex 60eee993b4 Merge pull request 'Fix typo in error message' (#1283) from rmoff/garage:main-v2 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1283
2026-01-12 21:17:46 +00:00
rmoff d30bb2acb1 Fix typo in error message 2026-01-12 17:32:02 +00:00
maximilien 730c613807 Merge pull request 'notes about synology hyperbackup' (#1281) from lowcarbdev/garage:hyperbackup-docs into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1281
2026-01-08 18:34:57 +00:00
maximilien 9e356347c6 hyperbackup docs: minor spelling fixes 2026-01-08 18:34:32 +00:00
lowcarbdev 1d3c0511b1 notes about synology hyperbackup 2026-01-07 22:50:45 -07:00
Alex f50b342c00 Merge pull request 'Adding consul discovery for WAN federated consul servers' (#1252) from jamin/garage:feature/consul_wan_discovery_v2 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1252
2026-01-07 08:22:05 +00:00
Alex Auvolat cf22e7b71d reintroduce warning when invalid node id is present in consul 2026-01-06 14:35:51 +01:00
Alex Auvolat dc8d93698b small documentation fixes and simplify config struct 2026-01-06 14:33:20 +01:00
Alex 006e78ccea Merge pull request 'Added a loop to go through bootstrap_peers and make their output TOML friendly, instead of the Go default.' (#1238) from magsol/garage:main-v2 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1238
2026-01-06 09:36:18 +00:00
Alex 276e55ae8b Merge pull request 'helm: Trim extra newline when common labels not set' (#1242) from boris.m/garage:fix/helm-common-labels-templating into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1242
2026-01-06 09:25:44 +00:00
Alex ab6d9633ac Merge pull request 'openapi: work around issue for flattenned untagged enum (fix #1249)' (#1278) from fix-openapi-enum into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1278
2026-01-06 09:21:20 +00:00
Alex Auvolat cf2f058f60 openapi: work around issue for flattenned untagged enum (fix #1249) 2026-01-06 10:11:12 +01:00
maximilien 02677af546 Merge pull request 'Adding ente documentation' (#826) from tcheronneau/garage:main into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/826
2025-12-22 01:23:22 +00:00
maximilien fced78c283 doc: ente doc fixes from comments 2025-12-22 02:18:19 +01:00
maximilien d211c1e291 ente: add more details on bucket configuration
add more configuration with details for options

Signed-off-by: maximilien <maximilien@deuxfleurs.fr>
2025-12-22 02:18:18 +01:00
Thomas 318ef40c4e Adding ente documentation 2025-12-22 02:18:15 +01:00
maximilien c9c50b741e Merge pull request 'cookbook: update arch install repo' (#1272) from update-arch-doc into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1272
2025-12-21 21:15:38 +00:00
nmstoker a0a2c1db88 Update doc/book/cookbook/binary-packages.md
Correct the Arch Linux link as garage is now available in the official repos under extra, and no longer in AUR.
2025-12-21 22:14:25 +01:00
maximilien c685a2cbaf Merge pull request 'Update doc/book/cookbook/binary-packages.md' (#1269) from nmstoker/garage:main-v1 into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1269
2025-12-21 21:12:15 +00:00
maximilien 04d549acc7 Merge pull request 'Add conda-forge to binary packages' (#1270) from Cosmos2020/garage:cosmos2020-patch-1 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1270
2025-12-21 21:11:46 +00:00
maximilien a9cd3f3426 Merge pull request 'feat: add service annotations to main-v2' (#1271) from add-helm-svc-annotation into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1271
2025-12-21 21:11:22 +00:00
Pierre Mavro 8f7e92b6a7 feat: add service annotations 2025-12-21 22:02:36 +01:00
maximilien 969f42a970 Merge pull request 'feat: add service annotations' (#1264) from deimosfr/garage:feat/add_helm_svc_annotations into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1264
Reviewed-by: maximilien <git@mricher.fr>
2025-12-21 21:00:00 +00:00
Cosmos2020 c2d54b4136 doc/book/cookbook/binary-packages.md aktualisiert 2025-12-21 17:13:16 +00:00
nmstoker 424d4f8d4d Update doc/book/cookbook/binary-packages.md
Correct the Arch Linux link as garage is now available in the official repos under extra, and no longer in AUR.
2025-12-20 13:16:38 +00:00
JaminMartin 2f7a649870 doc: added documentation for WAN service discovery 2025-12-19 11:26:24 +13:00
JaminMartin c4836916b0 feat: testing wan consul discovery 2025-12-19 10:24:11 +13:00
Pierre Mavro bf5290036f feat: add service annotations 2025-12-18 18:12:22 +01:00
Alex 4efc8bac07 Merge pull request 'Add the parameter, which replaces . This is to accommodate different storage media such as HDD and NVMe.' (#1251) from perrynzhou/garage:dev into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1251
Reviewed-by: Alex <lx@deuxfleurs.fr>
2025-12-17 10:05:49 +00:00
perrynzhou f3dcc39903 Merge branch 'main-v1' into dev 2025-12-17 10:05:19 +00:00
Alex b830bdd1dd Merge pull request 'Document workaround for Cloudflare proxy signature error when using rclone' (#1256) from kuba86/garage:document-workaround-for-cloudflare-proxy-when-using-rclone into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1256
2025-12-17 10:03:50 +00:00
maximilien 161b185464 Merge pull request 'docs: fix typo in doc/book/cookbook/kubernetes.md' (#1263) from fix-typo into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1263
2025-12-17 07:47:24 +00:00
maximilien 8f0d10b0b1 docs: fix typo in doc/book/cookbook/kubernetes.md 2025-12-17 08:19:20 +01:00
maximilien 43e02920c2 Merge pull request 'docs: fix typo in doc/book/cookbook/kubernetes.md' (#1259) from simonpasquier/garage:fix-typo into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1259
Reviewed-by: maximilien <me@mricher.fr>
2025-12-17 07:09:59 +00:00
Simon Pasquier dcc2fe4ac5 docs: fix typo in doc/book/cookbook/kubernetes.md 2025-12-16 10:16:44 +01:00
maximilien 6bac369ee2 Merge pull request 'cookbook/reverse-proxy: remove Buypass Go SSL' (#1258) from ElementW/garage:main-v2 into main-v2
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1258
2025-12-15 09:54:28 +00:00
Céleste Wouters 96d303b05e cookbook/reverse-proxy: remove Buypass Go SSL
Buypass Go SSL has stopped providing SSL/TLS certificates, including
from their ACME API endpoints, as of October 2025, and the service is to
be completely phased out by April 2026:
https://community.buypass.com/t/y4y130p

Remove them from the docs as an ACME-capable provider.
2025-12-15 02:03:24 +01:00
kuba86 3a1dce59f7 Document workaround for Cloudflare proxy signature error when using rclone 2025-12-13 17:19:32 +01:00
perrynzhou@gmail.com e3a5ec6ef6 rename put_blocks_max_parallel to block_max_concurrent_writes_per_request and update configuration.md 2025-12-12 07:09:38 +08:00
perrynzhou@gmail.com 4d124e1c76 Add the parameter, which replaces . This is to accommodate different storage media such as HDD and NVMe. 2025-12-10 06:43:51 +08:00
B Marinov 6fd2cf7966 Trim space when common labels is empty 2025-12-05 21:25:02 +01:00
Shannon Quinn 6aecd9718f Added a loop to go through bootstrap_peers and make their output TOML friendly, instead of the Go default. 2025-11-25 15:33:47 -05:00
Alex d769a7be5d Merge pull request 'Update rust toolchain to 1.91.0' (#1233) from toolchain-update into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1233
2025-11-25 09:58:17 +00:00
Alex Auvolat 511cf0c6ec disable awscli checksumming in ci scripts
required because garage.deuxfleurs.fr is still running v1.x
2025-11-24 18:37:34 +01:00
Alex Auvolat 95693d45b2 run cargo fmt as a nix derivation 2025-11-24 18:09:53 +01:00
Alex Auvolat ca296477f3 disable checksums in aws cli (todo: revert in main-v2) 2025-11-24 17:58:57 +01:00
Alex Auvolat ca3b4a050d update nixos image used in woodpecker ci 2025-11-24 17:35:51 +01:00
Alex Auvolat a057ab23ea Update rust toolchain 2025-11-24 11:09:46 +01:00
Alex 58bc65b9a8 Merge pull request 'migrate to this error, garage-v1' (#1218) from thiserror into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1218
Reviewed-by: Alex <lx@deuxfleurs.fr>
2025-11-12 08:05:32 +00:00
trinity-1686a ac851d6dee fmt 2025-11-01 18:04:54 +01:00
trinity-1686a eac2aa6fe4 Merge pull request 'fix: default config path changed for alpine binary' (#1204) from berndsen-io/garage:fix-alpine-docs into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1204
Reviewed-by: trinity-1686a <trinity@deuxfleurs.fr>
2025-11-01 16:43:32 +00:00
trinity-1686a 1e0201ada2 Merge pull request 'Update link to signature v2.' (#1211) from teo-tsirpanis/garage:sigv2-docs into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1211
Reviewed-by: trinity-1686a <trinity@deuxfleurs.fr>
2025-11-01 16:43:05 +00:00
trinity-1686a 82297371bf migrate to this error
it doesn't generate a bazillion warning at compile time
2025-11-01 17:20:39 +01:00
teo-tsirpanis 174f4f01a8 Update link to signature v2. 2025-10-26 15:54:08 +00:00
fgberry 1aac7b4875 chore: spacing 2025-10-24 11:25:33 +02:00
fgberry b43c58cbe5 fix: default config path changed for alpine binary 2025-10-24 11:22:32 +02:00
Alex 9481ac428e Merge pull request 'sigv4: don't enforce x-amz-content-sha256 to be in signed headers list (fix #770)' (#1195) from fix-770 into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1195
2025-10-14 09:34:35 +00:00
Alex Auvolat 1c29d04cc5 sigv4: don't enforce x-amz-content-sha256 to be in signed headers list (fix #770)
From the following page:
https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html

> In both cases, because the x-amz-content-sha256 header value is already
> part of your HashedPayload, you are not required to include the
> x-amz-content-sha256 header as a canonical header.
2025-10-14 11:18:25 +02:00
Alex b48a8eaa1f Merge pull request 'properly handle precondition time equal to object time' (#1193) from precondition-ms into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1193
2025-10-10 19:41:06 +00:00
trinity-1686a 42fd8583bd properly handle precondition time equal to object time 2025-10-08 17:54:22 +02:00
Alex 236af3a958 Merge pull request 'Garage v1.3.0' (#1166) from rel-v1.3.0 into main-v1
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/1166
2025-09-14 21:26:21 +00:00
Alex Auvolat 4b1fdbef55 bump version to v1.3.0 2025-09-14 21:36:33 +02:00
Alex Auvolat 0f1b488be0 fix rust warnings 2025-09-14 21:25:37 +02:00
243 changed files with 7427 additions and 3917 deletions
+25 -14
View File
@@ -2,42 +2,53 @@ labels:
nix: "enabled"
when:
event:
- push
- tag
- pull_request
- deployment
- cron
- manual
- event:
- tag
- pull_request
- deployment
- cron
- manual
- event: push
branch: main-*
steps:
- name: check formatting
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr devShell --run "cargo fmt -- --check"
- nix-build -j4 --attr flakePackages.fmt
- name: check typos
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr ci --run typos
- name: check lints with clippy
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.clippy
- name: build
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.dev
- name: unit + func tests (lmdb)
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.tests-lmdb
- name: unit + func tests (sqlite)
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.tests-sqlite
- name: unit + func tests (fjall)
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.tests-fjall
- name: integration tests
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build -j4 --attr flakePackages.dev
- nix-shell --attr ci --run ./script/test-smoke.sh || (cat /tmp/garage.log; false)
+2 -2
View File
@@ -11,7 +11,7 @@ depends_on:
steps:
- name: refresh-index
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
environment:
AWS_ACCESS_KEY_ID:
from_secret: garagehq_aws_access_key_id
@@ -22,7 +22,7 @@ steps:
- nix-shell --attr ci --run "refresh_index"
- name: multiarch-docker
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
environment:
DOCKER_AUTH:
from_secret: docker_auth
+7 -7
View File
@@ -19,17 +19,17 @@ matrix:
steps:
- name: build
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-build --attr releasePackages.${ARCH} --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
- name: check is static binary
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr ci --run "./script/not-dynamic.sh result/bin/garage"
- name: integration tests
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr ci --run ./script/test-smoke.sh || (cat /tmp/garage.log; false)
when:
@@ -39,7 +39,7 @@ steps:
ARCH: i386
- name: upgrade tests from v1.0.0
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr ci --run "./script/test-upgrade.sh v1.0.0 x86_64-unknown-linux-musl" || (cat /tmp/garage.log; false)
when:
@@ -47,7 +47,7 @@ steps:
ARCH: amd64
- name: upgrade tests from v0.8.4
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
commands:
- nix-shell --attr ci --run "./script/test-upgrade.sh v0.8.4 x86_64-unknown-linux-musl" || (cat /tmp/garage.log; false)
when:
@@ -55,7 +55,7 @@ steps:
ARCH: amd64
- name: push static binary
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
environment:
TARGET: "${TARGET}"
AWS_ACCESS_KEY_ID:
@@ -66,7 +66,7 @@ steps:
- nix-shell --attr ci --run "to_s3"
- name: docker build and publish
image: nixpkgs/nix:nixos-22.05
image: nixpkgs/nix:nixos-24.05
environment:
DOCKER_PLATFORM: "linux/${ARCH}"
CONTAINER_NAME: "dxflrs/${ARCH}_garage"
Generated
+1765 -1092
View File
File diff suppressed because it is too large Load Diff
+102 -66
View File
@@ -24,135 +24,171 @@ default-members = ["src/garage"]
# Internal Garage crates
format_table = { version = "0.1.1", path = "src/format-table" }
garage_api_common = { version = "2.1.0", path = "src/api/common" }
garage_api_admin = { version = "2.1.0", path = "src/api/admin" }
garage_api_s3 = { version = "2.1.0", path = "src/api/s3" }
garage_api_k2v = { version = "2.1.0", path = "src/api/k2v" }
garage_block = { version = "2.1.0", path = "src/block" }
garage_db = { version = "2.1.0", path = "src/db", default-features = false }
garage_model = { version = "2.1.0", path = "src/model", default-features = false }
garage_net = { version = "2.1.0", path = "src/net" }
garage_rpc = { version = "2.1.0", path = "src/rpc" }
garage_table = { version = "2.1.0", path = "src/table" }
garage_util = { version = "2.1.0", path = "src/util" }
garage_web = { version = "2.1.0", path = "src/web" }
garage_api_common = { version = "2.3.0", path = "src/api/common" }
garage_api_admin = { version = "2.3.0", path = "src/api/admin" }
garage_api_s3 = { version = "2.3.0", path = "src/api/s3" }
garage_api_k2v = { version = "2.3.0", path = "src/api/k2v" }
garage_block = { version = "2.3.0", path = "src/block" }
garage_db = { version = "2.3.0", path = "src/db", default-features = false }
garage_model = { version = "2.3.0", path = "src/model", default-features = false }
garage_net = { version = "2.3.0", path = "src/net" }
garage_rpc = { version = "2.3.0", path = "src/rpc" }
garage_table = { version = "2.3.0", path = "src/table" }
garage_util = { version = "2.3.0", path = "src/util" }
garage_web = { version = "2.3.0", path = "src/web" }
k2v-client = { version = "0.0.4", path = "src/k2v-client" }
# External crates from crates.io
arc-swap = "1.0"
arc-swap = "1.8"
argon2 = "0.5"
async-trait = "0.1.7"
async-trait = "0.1"
backtrace = "0.3"
base64 = "0.21"
base64 = "0.22"
blake2 = "0.10"
bytes = "1.0"
bytesize = "1.1"
bytes = "1.11"
bytesize = "2.3"
cfg-if = "1.0"
chrono = { version = "0.4", features = ["serde"] }
crc-fast = "1.6"
crc-fast = "1.9"
crypto-common = "0.1"
gethostname = "0.4"
git-version = "0.3.4"
gethostname = "1.1"
git-version = "0.3"
hex = "0.4"
hexdump = "0.1"
hmac = "0.12"
itertools = "0.12"
ipnet = "2.9.0"
lazy_static = "1.4"
itertools = "0.14"
ipnet = "2.11"
lazy_static = "1.5"
md-5 = "0.10"
mktemp = "0.5"
nix = { version = "0.29", default-features = false, features = ["fs"] }
nom = "7.1"
nix = { version = "0.31", default-features = false, features = ["fs"] }
nom = "8.0"
parking_lot = "0.12"
parse_duration = "2.1"
paste = "1.0"
pin-project = "1.0.12"
pnet_datalink = "0.34"
rand = "0.8"
pin-project = "1.1"
pnet_datalink = "0.35"
rand = "0.9"
sha1 = "0.10"
sha2 = "0.10"
timeago = { version = "0.4", default-features = false }
timeago = { version = "0.5", default-features = false }
xxhash-rust = { version = "0.8", default-features = false, features = ["xxh3"] }
aes-gcm = { version = "0.10", features = ["aes", "stream"] }
sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" }
kuska-handshake = { version = "0.2.0", features = ["default", "async_std"] }
clap = { version = "4.1", features = ["derive", "env"] }
clap = { version = "4.5", features = ["derive", "env"] }
pretty_env_logger = "0.5"
structopt = { version = "0.3", default-features = false }
syslog-tracing = "0.3"
tracing = "0.1"
tracing-journald = "0.3.1"
tracing-journald = "0.3"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
heed = { version = "0.11", default-features = false, features = ["lmdb"] }
rusqlite = "0.37"
heed = { version = "0.22", default-features = false, features = [] }
rusqlite = { version = "0.38", features = ["fallible_uint"] }
r2d2 = "0.8"
r2d2_sqlite = "0.31"
fjall = "2.4"
r2d2_sqlite = "0.32"
fjall = "2.11"
async-compression = { version = "0.4", features = ["tokio", "zstd"] }
zstd = { version = "0.13", default-features = false }
quick-xml = { version = "0.26", features = [ "serialize" ] }
rmp-serde = "1.1.2"
quick-xml = { version = "0.39", features = ["serialize"] }
rmp-serde = "1.3"
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_bytes = "0.11"
serde_json = "1.0"
toml = { version = "0.8", default-features = false, features = ["parse"] }
utoipa = { version = "5.3.1", features = ["chrono"] }
toml = { version = "0.9", default-features = false, features = ["parse", "serde"] }
utoipa = { version = "5.4", features = ["chrono"] }
# newer version requires rust edition 2021
k8s-openapi = { version = "0.21", features = ["v1_24"] }
kube = { version = "0.88", default-features = false, features = ["runtime", "derive", "client", "rustls-tls"] }
schemars = "0.8"
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls-manual-roots", "json"] }
k8s-openapi = { version = "0.27", features = ["v1_35"] }
kube = { version = "3.0", default-features = false, features = [
"runtime",
"derive",
"client",
"rustls-tls",
] }
schemars = "1.2"
reqwest = { version = "0.13", default-features = false, features = [
"rustls",
"json",
] }
form_urlencoded = "1.0.0"
http = "1.0"
form_urlencoded = "1.2"
http = "1.4"
httpdate = "1.0"
http-range = "0.1"
http-body-util = "0.1"
hyper = { version = "1.0", default-features = false }
hyper-util = { version = "0.1", features = [ "full" ] }
multer = "3.0"
percent-encoding = "2.2"
roxmltree = "0.19"
url = "2.3"
hyper = { version = "1.8", default-features = false }
hyper-util = { version = "0.1", features = ["full"] }
multer = "3.1"
percent-encoding = "2.3"
roxmltree = "0.21"
url = "2.5"
futures = "0.3"
futures-util = "0.3"
tokio = { version = "1.0", default-features = false, features = ["net", "rt", "rt-multi-thread", "io-util", "net", "time", "macros", "sync", "signal", "fs"] }
tokio = { version = "1.49", default-features = false, features = [
"rt",
"rt-multi-thread",
"io-util",
"net",
"time",
"macros",
"sync",
"signal",
"fs",
] }
tokio-util = { version = "0.7", features = ["compat", "io"] }
tokio-stream = { version = "0.1", features = ["net"] }
socket2 = { version = "0.6", features = ["all"] }
opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] }
opentelemetry = { version = "0.17", features = ["rt-tokio", "metrics", "trace"] }
opentelemetry-prometheus = "0.10"
opentelemetry-otlp = "0.10"
opentelemetry-contrib = "0.9"
prometheus = "0.13"
# used by the k2v-client crate only
aws-sigv4 = { version = "1.1", default-features = false }
hyper-rustls = { version = "0.26", default-features = false, features = ["http1", "http2", "ring", "rustls-native-certs"] }
aws-sigv4 = { version = "1.3", default-features = false }
hyper-rustls = { version = "0.27", default-features = false, features = [
"http1",
"http2",
"ring",
"rustls-native-certs",
] }
log = "0.4"
thiserror = "2.0"
# ---- used only as build / dev dependencies ----
assert-json-diff = "2.0"
rustc_version = "0.4.0"
rustc_version = "0.4"
static_init = "1.0"
aws-smithy-runtime = { version = "1.8", default-features = false, features = ["tls-rustls"] }
aws-sdk-config = { version = "1.62", default-features = false }
aws-sdk-s3 = { version = "1.79", default-features = false, features = ["rt-tokio"] }
[profile.dev]
#lto = "thin" # disabled for now, adds 2-4 min to each CI build
lto = "off"
aws-smithy-runtime = { version = "1.9", default-features = false, features = [
"tls-rustls",
] }
aws-sdk-config = { version = "1.99", default-features = false }
aws-sdk-s3 = { version = "1.121", default-features = false, features = [
"rt-tokio",
] }
[profile.release]
lto = true
codegen-units = 1
lto = "thin"
codegen-units = 16
opt-level = 3
strip = true
strip = "debuginfo"
[workspace.lints.clippy]
# pedantic lints configuration
doc_markdown = "warn"
format_collect = "warn"
manual_midpoint = "warn"
semicolon_if_nothing_returned = "warn"
unnecessary_semicolon = "warn"
unnecessary_wraps = "warn"
# nursery lints configuration
# or_fun_call = "warn" # enable it to help detect non trivial code used in `_or` method
+4 -4
View File
@@ -3,10 +3,10 @@ info:
version: v0.8.0
title: Garage Administration API v0+garage-v0.8.0
description: |
Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
*Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
paths:
Administrate your Garage cluster programmatically, including status, layout, keys, buckets, and maintenance tasks.
*Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionally, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
paths:
/status:
get:
tags:
+5 -5
View File
@@ -3,10 +3,10 @@ info:
version: v0.9.0
title: Garage Administration API v0+garage-v0.9.0
description: |
Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
*Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
paths:
Administrate your Garage cluster programmatically, including status, layout, keys, buckets, and maintenance tasks.
*Disclaimer: The API is not stable yet, hence its v0 tag. The API can change at any time, and changes can include breaking backward compatibility. Read the changelog and upgrade your scripts before upgrading. Additionally, this specification is very early stage and can contain bugs, especially on error return codes/types that are not tested yet. Do not expect a well finished and polished product!*
paths:
/health:
get:
tags:
@@ -440,7 +440,7 @@ paths:
- "false"
example: "true"
required: false
description: "Wether or not the secret key should be returned in the response"
description: "Whether or not the secret key should be returned in the response"
responses:
'500':
description: "The server can not handle your request. Check your connectivity with the rest of the cluster."
+516 -55
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "Garage administration API",
"description": "Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.\n\n*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
"description": "Administrate your Garage cluster programmatically, including status, layout, keys, buckets, and maintenance tasks.\n\n*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionally, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
"contact": {
"name": "The Garage team",
"url": "https://garagehq.deuxfleurs.fr/",
@@ -12,7 +12,7 @@
"name": "AGPL-3.0",
"identifier": "AGPL-3.0"
},
"version": "v2.1.0"
"version": "v2.3.0"
},
"servers": [
{
@@ -103,7 +103,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AddBucketAliasRequest"
"$ref": "#/components/schemas/BucketAliasEnum"
}
}
},
@@ -1409,7 +1409,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RemoveBucketAliasRequest"
"$ref": "#/components/schemas/BucketAliasEnum"
}
}
},
@@ -1722,24 +1722,6 @@
},
"components": {
"schemas": {
"AddBucketAliasRequest": {
"allOf": [
{
"$ref": "#/components/schemas/BucketAliasEnum"
},
{
"type": "object",
"required": [
"bucketId"
],
"properties": {
"bucketId": {
"type": "string"
}
}
}
]
},
"AddBucketAliasResponse": {
"$ref": "#/components/schemas/GetBucketInfoResponse"
},
@@ -1957,9 +1939,13 @@
{
"type": "object",
"required": [
"bucketId",
"globalAlias"
],
"properties": {
"bucketId": {
"type": "string"
},
"globalAlias": {
"type": "string"
}
@@ -1968,6 +1954,7 @@
{
"type": "object",
"required": [
"bucketId",
"localAlias",
"accessKeyId"
],
@@ -1975,6 +1962,9 @@
"accessKeyId": {
"type": "string"
},
"bucketId": {
"type": "string"
},
"localAlias": {
"type": "string"
}
@@ -2350,6 +2340,16 @@
"format": "int64",
"description": "Total number of bytes used by objects in this bucket"
},
"corsRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/cors.Rule"
},
"description": "CORS rules for this bucket"
},
"created": {
"type": "string",
"format": "date-time",
@@ -2373,6 +2373,16 @@
},
"description": "List of access keys that have permissions granted on this bucket"
},
"lifecycleRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/lifecycle.Rule"
},
"description": "Object lifecycle rules for this bucket"
},
"objects": {
"type": "integer",
"format": "int64",
@@ -2404,7 +2414,7 @@
},
"websiteAccess": {
"type": "boolean",
"description": "Whether website acces is enabled for this bucket"
"description": "Whether website access is enabled for this bucket"
},
"websiteConfig": {
"oneOf": [
@@ -2433,6 +2443,15 @@
},
"indexDocument": {
"type": "string"
},
"routingRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/website.RoutingRule"
}
}
}
},
@@ -2451,7 +2470,7 @@
"properties": {
"connectedNodes": {
"type": "integer",
"description": "the nubmer of nodes this Garage node currently has an open connection to",
"description": "the number of nodes this Garage node currently has an open connection to",
"minimum": 0
},
"knownNodes": {
@@ -2591,8 +2610,61 @@
"freeform"
],
"properties": {
"bucketCount": {
"type": [
"integer",
"null"
],
"format": "int64",
"description": "number of buckets in the cluster",
"minimum": 0
},
"dataAvail": {
"type": [
"integer",
"null"
],
"format": "int64",
"description": "available storage space for object data in the entire cluster, in bytes",
"minimum": 0
},
"freeform": {
"type": "string"
"type": "string",
"description": "cluster statistics as a free-form string, kept for compatibility with nodes\nrunning older v2.x versions of garage"
},
"incompleteAvailInfo": {
"type": [
"boolean",
"null"
],
"description": "true if the available storage space statistics are imprecise due to missing\ninformation of disconnected nodes. When this is the case, the actual\nspace available in the cluster might be lower than the reported values."
},
"metadataAvail": {
"type": [
"integer",
"null"
],
"format": "int64",
"description": "available storage space for object metadata in the entire cluster, in bytes",
"minimum": 0
},
"totalObjectBytes": {
"type": [
"integer",
"null"
],
"format": "int64",
"description": "total size of objects stored in all buckets, before compression, deduplication and\nreplication (this is NOT equivalent to actual disk usage in the cluster)",
"minimum": 0
},
"totalObjectCount": {
"type": [
"integer",
"null"
],
"format": "int64",
"description": "total number of objects stored in all buckets",
"minimum": 0
}
}
},
@@ -3065,7 +3137,8 @@
],
"properties": {
"dbEngine": {
"type": "string"
"type": "string",
"description": "database engine used for metadata"
},
"garageFeatures": {
"type": [
@@ -3074,16 +3147,26 @@
],
"items": {
"type": "string"
}
},
"description": "build-time features enabled for this garage release"
},
"garageVersion": {
"type": "string"
"type": "string",
"description": "garage version running on this node"
},
"hostname": {
"type": [
"string",
"null"
],
"description": "hostname of this node"
},
"nodeId": {
"type": "string"
},
"rustVersion": {
"type": "string"
"type": "string",
"description": "rustc version with which this garage release was compiled"
}
}
},
@@ -3093,8 +3176,30 @@
"freeform"
],
"properties": {
"blockManagerStats": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/NodeBlockManagerStats",
"description": "block manager statistics"
}
]
},
"freeform": {
"type": "string"
"type": "string",
"description": "node statistics as a free-form string, kept for compatibility with nodes\nrunning older v2.x versions of garage"
},
"tableStats": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/NodeTableStats"
},
"description": "metadata table statistics"
}
}
},
@@ -3395,7 +3500,8 @@
],
"properties": {
"dbEngine": {
"type": "string"
"type": "string",
"description": "database engine used for metadata"
},
"garageFeatures": {
"type": [
@@ -3404,16 +3510,26 @@
],
"items": {
"type": "string"
}
},
"description": "build-time features enabled for this garage release"
},
"garageVersion": {
"type": "string"
"type": "string",
"description": "garage version running on this node"
},
"hostname": {
"type": [
"string",
"null"
],
"description": "hostname of this node"
},
"nodeId": {
"type": "string"
},
"rustVersion": {
"type": "string"
"type": "string",
"description": "rustc version with which this garage release was compiled"
}
}
},
@@ -3449,8 +3565,30 @@
"freeform"
],
"properties": {
"blockManagerStats": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/NodeBlockManagerStats",
"description": "block manager statistics"
}
]
},
"freeform": {
"type": "string"
"type": "string",
"description": "node statistics as a free-form string, kept for compatibility with nodes\nrunning older v2.x versions of garage"
},
"tableStats": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/NodeTableStats"
},
"description": "metadata table statistics"
}
}
},
@@ -3789,6 +3927,34 @@
}
}
},
"NodeBlockManagerStats": {
"type": "object",
"required": [
"rcEntries",
"resyncQueueLen",
"resyncErrors"
],
"properties": {
"rcEntries": {
"type": "integer",
"format": "int64",
"description": "number of reference counter entries",
"minimum": 0
},
"resyncErrors": {
"type": "integer",
"format": "int64",
"description": "number of blocks with resync errors",
"minimum": 0
},
"resyncQueueLen": {
"type": "integer",
"format": "int64",
"description": "number of blocks in the resync queue",
"minimum": 0
}
}
},
"NodeResp": {
"type": "object",
"required": [
@@ -3912,6 +4078,93 @@
}
]
},
"NodeRoleChangeRequest": {
"oneOf": [
{
"type": "object",
"required": [
"id",
"remove"
],
"properties": {
"id": {
"type": "string",
"description": "ID of the node for which this change applies"
},
"remove": {
"type": "boolean",
"description": "Set `remove` to `true` to remove the node from the layout"
}
}
},
{
"allOf": [
{
"$ref": "#/components/schemas/NodeAssignedRole"
},
{
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"description": "ID of the node for which this change applies"
}
}
}
]
}
]
},
"NodeTableStats": {
"type": "object",
"required": [
"tableName",
"items",
"merkleItems",
"merkleQueueLen",
"insertQueueLen",
"gcQueueLen"
],
"properties": {
"gcQueueLen": {
"type": "integer",
"format": "int64",
"description": "number of items in the garbage collection queue",
"minimum": 0
},
"insertQueueLen": {
"type": "integer",
"format": "int64",
"description": "number of items in the remote insert queue",
"minimum": 0
},
"items": {
"type": "integer",
"format": "int64",
"description": "number of items stored in metadata table",
"minimum": 0
},
"merkleItems": {
"type": "integer",
"format": "int64",
"description": "size of the merkle tree representing all items in the table",
"minimum": 0
},
"merkleQueueLen": {
"type": "integer",
"format": "int64",
"description": "number of items in the merkle tree update queue",
"minimum": 0
},
"tableName": {
"type": "string",
"description": "name of metadata table"
}
}
},
"NodeUpdateTrackers": {
"type": "object",
"required": [
@@ -3973,24 +4226,6 @@
}
]
},
"RemoveBucketAliasRequest": {
"allOf": [
{
"$ref": "#/components/schemas/BucketAliasEnum"
},
{
"type": "object",
"required": [
"bucketId"
],
"properties": {
"bucketId": {
"type": "string"
}
}
}
]
},
"RemoveBucketAliasResponse": {
"$ref": "#/components/schemas/GetBucketInfoResponse"
},
@@ -4105,7 +4340,7 @@
"items": {
"type": "string"
},
"description": "Scope of the admin API token, a list of admin endpoint names (such as\n`GetClusterStatus`, etc), or the special value `*` to allow all\nadmin endpoints. **WARNING:** Granting a scope of `CreateAdminToken` or\n`UpdateAdminToken` trivially allows for privilege escalation, and is thus\nfunctionnally equivalent to granting a scope of `*`."
"description": "Scope of the admin API token, a list of admin endpoint names (such as\n`GetClusterStatus`, etc), or the special value `*` to allow all\nadmin endpoints. **WARNING:** Granting a scope of `CreateAdminToken` or\n`UpdateAdminToken` trivially allows for privilege escalation, and is thus\nfunctionally equivalent to granting a scope of `*`."
}
}
},
@@ -4115,6 +4350,24 @@
"UpdateBucketRequestBody": {
"type": "object",
"properties": {
"corsRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/cors.Rule"
}
},
"lifecycleRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/lifecycle.Rule"
}
},
"quotas": {
"oneOf": [
{
@@ -4160,6 +4413,15 @@
"string",
"null"
]
},
"routingRules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/components/schemas/website.RoutingRule"
}
}
}
},
@@ -4180,7 +4442,7 @@
"roles": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NodeRoleChange"
"$ref": "#/components/schemas/NodeRoleChangeRequest"
},
"description": "New node roles to assign or remove in the cluster layout"
}
@@ -4401,6 +4663,205 @@
]
}
]
},
"cors.Rule": {
"type": "object",
"required": [
"AllowedOrigin",
"AllowedMethod"
],
"properties": {
"AllowedHeader": {
"type": "array",
"items": {}
},
"AllowedMethod": {
"type": "array",
"items": {}
},
"AllowedOrigin": {
"type": "array",
"items": {}
},
"ExposeHeader": {
"type": "array",
"items": {}
},
"ID": {},
"MaxAgeSeconds": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
}
}
},
"lifecycle.AbortIncompleteMpu": {
"type": "object",
"required": [
"DaysAfterInitiation"
],
"properties": {
"DaysAfterInitiation": {
"$ref": "#/components/schemas/xml.IntValue"
}
}
},
"lifecycle.Expiration": {
"type": "object",
"properties": {
"Date": {},
"Days": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
}
}
},
"lifecycle.Filter": {
"type": "object",
"properties": {
"And": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/lifecycle.Filter"
}
]
},
"ObjectSizeGreaterThan": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
},
"ObjectSizeLessThan": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
},
"Prefix": {}
}
},
"lifecycle.Rule": {
"type": "object",
"required": [
"Status"
],
"properties": {
"AbortIncompleteMultipartUpload": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/lifecycle.AbortIncompleteMpu"
}
]
},
"Expiration": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/lifecycle.Expiration"
}
]
},
"Filter": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/lifecycle.Filter"
}
]
},
"ID": {},
"Status": {}
}
},
"website.Condition": {
"type": "object",
"properties": {
"HttpErrorCodeReturnedEquals": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
},
"KeyPrefixEquals": {}
}
},
"website.Redirect": {
"type": "object",
"properties": {
"HostName": {},
"HttpRedirectCode": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/xml.IntValue"
}
]
},
"Protocol": {},
"ReplaceKeyPrefixWith": {},
"ReplaceKeyWith": {}
}
},
"website.RoutingRule": {
"type": "object",
"required": [
"Redirect"
],
"properties": {
"Condition": {
"oneOf": [
{
"type": "null"
},
{
"$ref": "#/components/schemas/website.Condition"
}
]
},
"Redirect": {
"$ref": "#/components/schemas/website.Redirect"
}
}
},
"xml.IntValue": {
"type": "integer",
"format": "int64"
}
},
"securitySchemes": {
+1 -1
View File
@@ -51,4 +51,4 @@ We are currently building this SDK for [Python](@/documentation/build/python.md#
More information:
- [In the reference manual](@/documentation/reference-manual/admin-api.md)
- [Full specifiction](https://garagehq.deuxfleurs.fr/api/garage-admin-v0.html)
- [Full specification](https://garagehq.deuxfleurs.fr/api/garage-admin-v0.html)
+3 -3
View File
@@ -5,13 +5,13 @@ weight = 99
## S3
If you are developping a new application, you may want to use Garage to store your user's media.
If you are developing a new application, you may want to use Garage to store your user's media.
The S3 API that Garage uses is a standard REST API, so as long as you can make HTTP requests,
you can query it. You can check the [S3 REST API Reference](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_Simple_Storage_Service.html) from Amazon to learn more.
Developping your own wrapper around the REST API is time consuming and complicated.
Instead, there are some libraries already avalaible.
Developing your own wrapper around the REST API is time consuming and complicated.
Instead, there are some libraries already available.
Some of them are maintained by Amazon, some by Minio, others by the community.
+1 -1
View File
@@ -23,7 +23,7 @@ To configure S3-compatible software to interact with Garage,
you will need the following parameters:
- An **API endpoint**: this corresponds to the HTTP or HTTPS address
used to contact the Garage server. When runing Garage locally this will usually
used to contact the Garage server. When running Garage locally this will usually
be `http://127.0.0.1:3900`. In a real-world setting, you would usually have a reverse-proxy
that adds TLS support and makes your Garage server available under a public hostname
such as `https://garage.example.com`.
+180 -6
View File
@@ -12,8 +12,9 @@ In this section, we cover the following web applications:
| [Mastodon](#mastodon) | ✅ | Natively supported |
| [Matrix](#matrix) | ✅ | Tested with `synapse-s3-storage-provider` |
| [ejabberd](#ejabberd) | ✅ | `mod_s3_upload` |
| [Pixelfed](#pixelfed) | ✅ | Natively supported |
| [Pleroma](#pleroma) | ❓ | Not yet tested |
| [Ente](#ente) | ✅ | Natively supported |
| [Pixelfed](#pixelfed) | ❓ | Natively supported |
| [Pleroma](#pleroma) | ✅ | Natively supported |
| [Lemmy](#lemmy) | ✅ | Supported with pict-rs |
| [Funkwhale](#funkwhale) | ❓ | Not yet tested |
| [Misskey](#misskey) | ❓ | Not yet tested |
@@ -53,7 +54,7 @@ garage bucket allow nextcloud --read --write --key nextcloud-key
Now edit your Nextcloud configuration file to enable object storage.
On my installation, the config. file is located at the following path: `/var/www/nextcloud/config/config.php`.
We will add a new root key to the `$CONFIG` dictionnary named `objectstore`:
We will add a new root key to the `$CONFIG` dictionary named `objectstore`:
```php
<?php
@@ -412,7 +413,7 @@ mc mirror --newer-than "3h" ./public/system/ garage/mastodon-data
## Matrix
Matrix is a chat communication protocol. Its main stable server implementation, [Synapse](https://matrix-org.github.io/synapse/latest/), provides a module to store media on a S3 backend. Additionally, a server independent media store supporting S3 has been developped by the community, it has been made possible thanks to how the matrix API has been designed and will work with implementations like Conduit, Dendrite, etc.
Matrix is a chat communication protocol. Its main stable server implementation, [Synapse](https://matrix-org.github.io/synapse/latest/), provides a module to store media on a S3 backend. Additionally, a server independent media store supporting S3 has been developed by the community, it has been made possible thanks to how the matrix API has been designed and will work with implementations like Conduit, Dendrite, etc.
### synapse-s3-storage-provider (synapse only)
@@ -449,7 +450,7 @@ media_storage_providers:
Note that uploaded media will also be stored locally and this behavior can not be deactivated, it is even required for
some operations like resizing images.
In fact, your local filesysem is considered as a cache but without any automated way to garbage collect it.
In fact, your local filesystem is considered as a cache but without any automated way to garbage collect it.
We can build our garbage collector with `s3_media_upload`, a tool provided with the module.
If you installed the module with the command provided before, you should be able to bring it in your path:
@@ -567,13 +568,186 @@ The module can then be configured with:
Other configuration options can be found in the
[configuration YAML file](https://github.com/processone/ejabberd-contrib/blob/master/mod_s3_upload/conf/mod_s3_upload.yml).
## Ente
Ente is an alternative for Google Photos and Apple Photos. It [can be selfhosted](https://help.ente.io/self-hosting/) and is working fine with Garage as of May 2024.
As a first step we need to create a bucket and a key for Ente:
```bash
garage bucket create ente
garage key create ente-key
# For the CORS setup to work, the key needs to be --owner as well, at least temporarily.
garage bucket allow ente --read --write --owner --key ente-key
```
We also need to setup some CORS rules to allow the Ente frontend to access the bucket:
```bash
export CORS='{"CORSRules":[{"AllowedHeaders":["*"],"AllowedMethods":["GET", "PUT", "POST", "DELETE"],"AllowedOrigins":["*"], "ExposeHeaders":["ETag"]}]}'
aws s3api put-bucket-cors --bucket ente --cors-configuration $CORS
```
Now we need to configure ente-server to use our bucket. This is explained [in the Ente S3 documentation](https://help.ente.io/self-hosting/guides/external-s3).
Prepare a configuration file for ente's backend as `museum.yaml`:
```yaml
credentials-file: /credentials.yaml
apps:
public-albums: https://albums.example.tld # If you want to use the share album feature
internal:
hardcoded-ott:
local-domain-suffix: "@example.com" # Your domain
local-domain-value: 123456 # Custom One-Time Password since we are not sending mail by default
key:
# WARNING -- You MUST CHANGE the values below
# Someone has made an image that can do it for you : https://github.com/EdyTheCow/ente-selfhost/blob/main/images/ente-server-tools/Dockerfile
# Simply build it yourself or run docker run --rm ghcr.io/edythecow/ente-server-tools go run tools/gen-random-keys/main.go
encryption: yvmG/RnzKrbCb9L3mgsmoxXr9H7i2Z4qlbT0mL3ln4w= # CHANGE THIS VALUE
hash: KXYiG07wC7GIgvCSdg+WmyWdXDAn6XKYJtp/wkEU7x573+byBRAYtpTP0wwvi8i/4l37uicX1dVTUzwH3sLZyw== # CHANGE THIS VALUE
jwt:
secret: i2DecQmfGreG6q1vBj5tCokhlN41gcfS2cjOs9Po-u8= # CHANGE THIS VALUE
```
The full configuration file can be found [here](https://github.com/ente-io/ente/blob/main/server/configurations/local.yaml)
Then prepare a credentials file as `credentials.yaml`
```yaml
db:
host: postgres
port: 5432
name: <ente_db_name>
user: <pguser>
password: <pgpass>
s3:
# Override the primary and secondary hot storage. The commented out values
# are the defaults.
#
hot_storage:
primary: b2-eu-cen
# secondary: wasabi-eu-central-2-v3
# If true, enable some workarounds to allow us to use a local minio instance
# for object storage.
#
# 1. Disable SSL.
# 2. Use "path" style S3 URLs (see `use_path_style_urls` below).
# 3. Directly download the file during replication instead of going via the
# Cloudflare worker.
# 4. Do not specify storage classes when uploading objects (since minio does
# not support them, specifically it doesn't support GLACIER).
are_local_buckets: true
# To use "path" style S3 URLs instead of DNS-based bucket access
# default to true if you set "are_local_buckets: true"
# use_path_style_urls: true
b2-eu-cen: # Don't change this key, it is hardcoded
key: <keyID>
secret: <keySecret>
endpoint: garage:3900 # publicly accessible endpoint of your garage instance
region: garage
bucket: <yourbucketName>
use_path_style: true
# you can specify secondary locations, names are hardcoded as well
# wasabi-eu-central-2-v3:
# scw-eu-fr-v3:
# and you can also specify a bucket to be used for embeddings, preview etc..
# default to the first bucket
# derived-storage: wasabi-eu-central-2-derived
```
Finally you can run it with Docker :
```bash
docker run -d --name ente-server --restart unless-stopped -v /path/to/museum.yaml:/museum.yaml -v /path/to/credentials.yaml:/credentials.yaml -p 8080:8080 ghcr.io/ente-io/ente-server
```
For more information on deployment you can check the [ente documentation](https://help.ente.io/self-hosting/)
## Pixelfed
[Pixelfed Technical Documentation > Configuration](https://docs.pixelfed.org/technical-documentation/env.html#filesystem)
## Pleroma
[Pleroma Documentation > Pleroma.Uploaders.S3](https://docs-develop.pleroma.social/backend/configuration/cheatsheet/#pleromauploaderss3)
### Creating your bucket
This is the usual Garage setup:
```bash
garage key new --name pleroma-key
garage bucket create pleroma
garage bucket allow pleroma --read --write --owner --key pleroma-key
```
We also need to expose these buckets publicly to serve their content to users:
```bash
garage bucket website --allow pleroma
```
Note the Key ID and Secret Key.
### Configure Pleroma
Update your Pleroma configuration like that in `/etc/pleroma/config.exs`.
```
config :pleroma, Pleroma.Upload,
uploader: Pleroma.Uploaders.S3,
base_url: "https://pleroma.garage.example.tld"
config :ex_aws, :s3,
access_key_id: "GW...",
secret_access_key: "XXX",
region: "garage",
host: "api.garage.example.tld"
```
And restart Pleroma.
You can found more information in [Pleroma Documentation > Pleroma.Uploaders.S3](https://docs-develop.pleroma.social/backend/configuration/cheatsheet/#pleromauploaderss3)
### Migrating your data
Pleroma have an internal migration tool that can encounter some fatal error
```
** (EXIT from #PID<0.98.0>) an exception was raised:
** (File.Error) could not stream "/var/lib/pleroma/uploads/09/f8": illegal operation on a directory
(elixir 1.17.3) lib/file/stream.ex:100: anonymous fn/3 in Enumerable.File.Stream.reduce/3
(elixir 1.17.3) lib/stream.ex:1675: anonymous fn/5 in Stream.resource/3
(elixir 1.17.3) lib/stream.ex:1891: Enumerable.Stream.do_each/4
(elixir 1.17.3) lib/task/supervised.ex:370: Task.Supervised.stream_reduce/7
(elixir 1.17.3) lib/enum.ex:4423: Enum.map/2
(ex_aws_s3 2.5.8) lib/ex_aws/s3/upload.ex:141: ExAws.Operation.ExAws.S3.Upload.perform/2
(pleroma 2.10.0) lib/pleroma/uploaders/s3.ex:60: Pleroma.Uploaders.S3.put_file/1
(pleroma 2.10.0) lib/pleroma/uploaders/uploader.ex:49: Pleroma.Uploaders.Uploader.put_file/2
```
So, use [your best tool](https://garagehq.deuxfleurs.fr/documentation/connect/cli/) to sync `/var/lib/pleroma/uploads/` in your S3.
Then, to avoid some non existent problem (just in case of), run this command
```bash
while true
do
rm -vr $(./bin/pleroma_ctl uploads migrate_local S3 2>&1 | grep "could not stream" | awk -F '"' '{print $2}')
sleep 5
done
```
If you have many files, stop this command sometime and the command bellow (interactive) to delete local
file after upload. Then restart the loop.
```bash
./bin/pleroma_ctl uploads migrate_local S3 --delete
```
And *voilà*
## Lemmy
+10
View File
@@ -207,3 +207,13 @@ $ plakar at @garageS3 ls
```
More information in Plakar documentation: https://www.plakar.io/docs/main/quickstart/
## Synology HyperBackup
HyperBackup can be configured to upload backups to garage using a custom S3 destination. However, the HyperBackup client hardcodes the `us-east-1` region that is a critical input to the v4 signature process. If garage is not set to `us-east-1`, HyperBackup will recognize available buckets, but fail during the final setup stage.
In garage.toml:
```toml
[s3_api]
s3_region = "us-east-1"
```
+11 -3
View File
@@ -41,7 +41,7 @@ Some commands:
# list buckets
mc ls garage/
# list objets in a bucket
# list objects in a bucket
mc ls garage/my_files
# copy from your filesystem to garage
@@ -149,6 +149,15 @@ rclone help
This will tremendously accelerate operations such as `rclone sync` or `rclone ncdu` by reducing the number
of ListObjects calls that are made.
**Garage behind Cloudflare proxy:** when running Garage behind Cloudflare proxy, you might see `Response: error 403 Forbidden, Forbidden: Invalid signature` error in your garage logs or `AccessDenied: Forbidden: Invalid signature` error in rclone logs. Try adding `--s3-sign-accept-encoding=false` flag to your rclone command and see if the issue is resolved.
```bash
# this throws an error
rclone lsd garage:
# this should work
rclone lsd --s3-sign-accept-encoding=false garage:
```
## `s3cmd`
@@ -209,7 +218,7 @@ Within Cyberduck, a
available within the `Preferences -> Profiles` section. This can enabled and
then connections to Garage may be configured.
### Instuctions for the CLI
### Instructions for the CLI
To configure duck (Cyberduck's CLI tool), start by creating its folder hierarchy:
@@ -314,4 +323,3 @@ ls
```
And through the web interface at http://[::1]:8080/web/client
+1 -3
View File
@@ -201,11 +201,9 @@ on the binary cache, the client will download the result from the cache instead
### Channels
Channels additionnaly serve Nix definitions, ie. a `.nix` file referencing
Channels additionally serve Nix definitions, ie. a `.nix` file referencing
all the derivations you want to serve.
## Gitlab
*External link:* [Gitlab Documentation > Object storage](https://docs.gitlab.com/ee/administration/object_storage.html)
+1 -1
View File
@@ -13,7 +13,7 @@ have published Ansible roles. We list them and compare them below.
| **Runtime** | Systemd | Docker | Systemd |
| **Target OS** | Any Linux | Any Linux | Any Linux |
| **Architecture** | amd64, arm64, i686 | amd64, arm64 | arm64, arm, 386, amd64 |
| **Additional software** | None | Traefik | Ngnix and Keepalived (optional) |
| **Additional software** | None | Traefik | Nginx and Keepalived (optional) |
| **Automatic node connection** | ❌ | ✅ | ✅ |
| **Layout management** | ❌ | ✅ | ✅ |
| **Manage buckets & keys** | ❌ | ✅ (basic) | ✅ |
+15 -4
View File
@@ -15,9 +15,10 @@ Alpine Linux repositories (available since v3.17):
apk add garage
```
The default configuration file is installed to `/etc/garage.toml`. You can run
Garage using: `rc-service garage start`. If you don't specify `rpc_secret`, it
will be automatically replaced with a random string on the first start.
The default configuration file is installed to `/etc/garage/garage.toml`. You can run
Garage using: `rc-service garage start`.
If you don't specify `rpc_secret`, it will be automatically replaced with a random string on the first start.
Please note that this package is built without Consul discovery, Kubernetes
discovery, OpenTelemetry exporter, and K2V features (K2V will be enabled once
@@ -26,7 +27,11 @@ it's stable).
## Arch Linux
Garage is available in the [AUR](https://aur.archlinux.org/packages/garage).
Garage is available in the official repositories under [extra](https://archlinux.org/packages/extra/x86_64/garage).
```bash
pacman -S garage
```
## FreeBSD
@@ -39,3 +44,9 @@ pkg install garage
```bash
nix-shell -p garage
```
## conda-forge
```bash
pixi global install garage
```
+4 -4
View File
@@ -33,7 +33,7 @@ by adding encryption at different levels.
We would be very curious to know your needs and thougs about ideas such as
encryption practices and things like key management, as we want Garage to be a
serious base platform for the developpment of secure, encrypted applications.
serious base platform for the development of secure, encrypted applications.
Do not hesitate to come talk to us if you have any thoughts or questions on the
subject.
@@ -59,7 +59,7 @@ For standard S3 API requests, Garage does not encrypt data at rest by itself.
For the most generic at rest encryption of data, we recommend setting up your
storage partitions on encrypted LUKS devices.
If you are developping your own client software that makes use of S3 storage,
If you are developing your own client software that makes use of S3 storage,
we recommend implementing data encryption directly on the client side and never
transmitting plaintext data to Garage. This makes it easy to use an external
untrusted storage provider if necessary.
@@ -108,14 +108,14 @@ Protects against the following threats:
- Stolen HDD
Crucially, does not protect againt malicious sysadmins or remote attackers that
Crucially, does not protect against malicious sysadmins or remote attackers that
might gain access to your servers.
Methods include full-disk encryption with tools such as LUKS.
## Encrypting data on the client side
Protects againt the following threats:
Protects against the following threats:
- A honest-but-curious administrator
- A malicious administrator that tries to corrupt your data
+1 -1
View File
@@ -9,7 +9,7 @@ There are three methods to expose buckets as website:
1. using the PutBucketWebsite S3 API call, which is allowed for access keys that have the owner permission bit set
2. from the Garage CLI, by an adminstrator of the cluster
2. from the Garage CLI, by an administrator of the cluster
3. using the Garage administration API
+11 -8
View File
@@ -20,12 +20,12 @@ sudo apt-get update
sudo apt-get install build-essential
```
## Building from source from the Gitea repository
## Building from source from the Forgejo repository
The primary location for Garage's source code is the
[Gitea repository](https://git.deuxfleurs.fr/Deuxfleurs/garage),
[Forgejo repository](https://git.deuxfleurs.fr/Deuxfleurs/garage),
which contains all of the released versions as well as the code
for the developpement of the next version.
for the development of the next version.
Clone the repository and enter it as follows:
@@ -41,7 +41,7 @@ git tag # List available tags
git checkout v0.8.0 # Change v0.8.0 with the version you wish to build
```
Otherwise you will be building a developpement build from the `main` branch
Otherwise you will be building a development build from the `main` branch
that includes all of the changes to be released in the next version.
Be careful that such a build might be unstable or contain bugs,
and could be incompatible with nodes that run stable versions of Garage.
@@ -85,11 +85,14 @@ The following feature flags are available in v0.8.0:
| Feature flag | Enabled | Description |
| ------------ | ------- | ----------- |
| `bundled-libs` | *by default* | Use bundled version of sqlite3, zstd, lmdb and libsodium |
| `system-libs` | optional | Use system version of sqlite3, zstd, lmdb and libsodium<br>if available (exclusive with `bundled-libs`, build using<br>`cargo build --no-default-features --features system-libs`) |
| `consul-discovery` | optional | Enable automatic registration and discovery<br>of cluster nodes through the Consul API |
| `fjall` | experimental | Enable using Fjall to store Garage's metadata |
| `journald` | optional | Enable logging to systemd-journald with<br>`GARAGE_LOG_TO_JOURNALD=true` environment variable set |
| `k2v` | optional | Enable the experimental K2V API (if used, all nodes on your<br>Garage cluster must have it enabled as well) |
| `kubernetes-discovery` | optional | Enable automatic registration and discovery<br>of cluster nodes through the Kubernetes API |
| `metrics` | *by default* | Enable collection of metrics in Prometheus format on the admin API |
| `telemetry-otlp` | optional | Enable collection of execution traces using OpenTelemetry |
| `syslog` | optional | Enable logging to Syslog |
| `lmdb` | *by default* | Enable using LMDB to store Garage's metadata |
| `metrics` | *by default* | Enable collection of metrics in Prometheus format on the admin API |
| `sqlite` | *by default* | Enable using Sqlite3 to store Garage's metadata |
| `syslog` | optional | Enable logging to Syslog with<br>`GARAGE_LOG_TO_SYSLOG=true` environment variable set |
| `system-libs` | optional | Use system version of sqlite3, zstd, lmdb and libsodium<br>if available (exclusive with `bundled-libs`, build using<br>`cargo build --no-default-features --features system-libs`) |
| `telemetry-otlp` | optional | Enable collection of execution traces using OpenTelemetry |
+3 -3
View File
@@ -11,7 +11,7 @@ Firstly clone the repository:
```bash
git clone https://git.deuxfleurs.fr/Deuxfleurs/garage
cd garage/scripts/helm
cd garage/script/helm
```
Deploy with default options:
@@ -26,7 +26,7 @@ Or deploy with custom values:
helm install --create-namespace --namespace garage garage ./garage -f values.override.yaml
```
If you want to manage the CustomRessourceDefinition used by garage for its `kubernetes_discovery` outside of the helm chart, add `garage.kubernetesSkipCrd: true` to your custom values and use the kustomization before deploying the helm chart:
If you want to manage the CustomResourceDefinition used by garage for its `kubernetes_discovery` outside of the helm chart, add `garage.kubernetesSkipCrd: true` to your custom values and use the kustomization before deploying the helm chart:
```bash
kubectl apply -k ../k8s/crd
@@ -47,7 +47,7 @@ All possible configuration values can be found with:
helm show values ./garage
```
This is an example `values.overrride.yaml` for deploying in a microk8s cluster with a https s3 api ingress route:
This is an example `values.override.yaml` for deploying in a microk8s cluster with a https s3 api ingress route:
```yaml
garage:
+5 -5
View File
@@ -96,14 +96,14 @@ to store 2 TB of data in total.
## Get a Docker image
Our docker image is currently named `dxflrs/garage` and is stored on the [Docker Hub](https://hub.docker.com/r/dxflrs/garage/tags?page=1&ordering=last_updated).
We encourage you to use a fixed tag (eg. `v2.1.0`) and not the `latest` tag.
For this example, we will use the latest published version at the time of the writing which is `v2.1.0` but it's up to you
We encourage you to use a fixed tag (eg. `v2.3.0`) and not the `latest` tag.
For this example, we will use the latest published version at the time of the writing which is `v2.3.0` but it's up to you
to check [the most recent versions on the Docker Hub](https://hub.docker.com/r/dxflrs/garage/tags?page=1&ordering=last_updated).
For example:
```
sudo docker pull dxflrs/garage:v2.1.0
docker pull dxflrs/garage:v2.3.0
```
## Deploying and configuring Garage
@@ -171,7 +171,7 @@ docker run \
-v /etc/garage.toml:/etc/garage.toml \
-v /var/lib/garage/meta:/var/lib/garage/meta \
-v /var/lib/garage/data:/var/lib/garage/data \
dxflrs/garage:v2.1.0
dxflrs/garage:v2.3.0
```
With this command line, Garage should be started automatically at each boot.
@@ -185,7 +185,7 @@ If you want to use `docker-compose`, you may use the following `docker-compose.y
version: "3"
services:
garage:
image: dxflrs/garage:v2.1.0
image: dxflrs/garage:v2.3.0
network_mode: "host"
restart: unless-stopped
volumes:
+70 -3
View File
@@ -7,7 +7,7 @@ The main reason to add a reverse proxy in front of Garage is to provide TLS to y
In production you will likely need your certificates signed by a certificate authority.
The most automated way is to use a provider supporting the [ACME protocol](https://datatracker.ietf.org/doc/html/rfc8555)
such as [Let's Encrypt](https://letsencrypt.org/), [ZeroSSL](https://zerossl.com/) or [Buypass Go SSL](https://www.buypass.com/ssl/products/acme).
such as [Let's Encrypt](https://letsencrypt.org/) or [ZeroSSL](https://zerossl.com/).
If you are only testing Garage, you can generate a self-signed certificate to follow the documentation:
@@ -142,7 +142,74 @@ server {
## Apache httpd
@TODO
The [Apache HTTP Server](https://httpd.apache.org/)
is a general purpose web server that includes
[reverse proxy](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html)
capabilities.
### Exposing the S3 endpoints
Create a new [virtual host](https://httpd.apache.org/docs/2.4/vhosts/),
obtain a certificate using
[certbot](https://eff-certbot.readthedocs.io/en/stable/using.html#apache),
and add the
[`ProxyPass`](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass)
and
[`ProxyPreserveHost`](https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost)
options:
```apache
<VirtualHost *:443>
ServerName garage.example.com
SSLCertificateFile /etc/letsencrypt/live/garage.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/garage.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
Header always set Strict-Transport-Security "max-age=31536000"
Header always add Content-Security-Policy upgrade-insecure-requests
ProxyPass "/" "http://localhost:3900/" nocanon
ProxyPreserveHost on
</VirtualHost>
```
The `nocanon` keyword is important for
[presigned URLs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-presigned-url.html);
otherwise,
> `mod_proxy` will canonicalise ProxyPassed URLs.
> But this may be incompatible with some backends,
> particularly those that make use of `PATH_INFO`.
> The optional `nocanon` keyword suppresses this
> and passes the URL path "raw" to the backend.
### Exposing the web endpoint
Adding static websites backed by Garage works very similarly,
with the only difference being the port selected in the `ProxyPass` directive.
```apache
ProxyPass "/" "http://localhost:3902/" nocanon
```
### Using Unix sockets
Apache can also proxy via Unix sockets instead of TCP ports,
if Garage is so configured.
`garage.toml`:
```toml
[s3_api]
api_bind_addr = "/run/garage/s3_api.socket"
```
Apache config:
```apache
ProxyPass "/" "unix:/run/garage/s3_api.socket|http://localhost/" nocanon
```
## Traefik v2
@@ -272,7 +339,7 @@ Add the following configuration section [to compress response](https://doc.traef
### Add caching response
Traefik's caching middleware is only available on [entreprise version](https://doc.traefik.io/traefik-enterprise/middlewares/http-cache/), however the freely-available [Souin plugin](https://github.com/darkweak/souin#tr%C3%A6fik-container) can also do the job. (section to be completed)
Traefik's caching middleware is only available on [enterprise version](https://doc.traefik.io/traefik-enterprise/middlewares/http-cache/), however the freely-available [Souin plugin](https://github.com/darkweak/souin#tr%C3%A6fik-container) can also do the job. (section to be completed)
### Complete example
+1 -1
View File
@@ -38,7 +38,7 @@ WantedBy=multi-user.target
id is dynamically allocated by systemd (set with `DynamicUser=true`). It cannot
access (read or write) home folders (`/home`, `/root` and `/run/user`), the
rest of the filesystem can only be read but not written, only the path seen as
`/var/lib/garage` is writable as seen by the service. Additionnaly, the process
`/var/lib/garage` is writable as seen by the service. Additionally, the process
can not gain new privileges over time.
For this to work correctly, your `garage.toml` must be set with
+1 -3
View File
@@ -10,7 +10,7 @@ perspective. It will allow you to understand if Garage is a good fit for
you, how to better use it, how to contribute to it, what can Garage could
and could not do, etc.
- **[Goals and use cases](@/documentation/design/goals.md):** This page explains why Garage was concieved and what practical use cases it targets.
- **[Goals and use cases](@/documentation/design/goals.md):** This page explains why Garage was conceived and what practical use cases it targets.
- **[Related work](@/documentation/design/related-work.md):** This pages presents the theoretical background on which Garage is built, and describes other software storage solutions and why they didn't work for us.
@@ -31,5 +31,3 @@ We love to talk and hear about Garage, that's why we keep a log here:
- [(en, 2021-04-28) Distributed object storage is centralised](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/commit/b1f60579a13d3c5eba7f74b1775c84639ea9b51a/doc/talks/2021-04-28_spirals-team/talk.pdf)
- [(fr, 2020-12-02) Garage : jouer dans la cour des grands quand on est un hébergeur associatif](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/commit/b1f60579a13d3c5eba7f74b1775c84639ea9b51a/doc/talks/2020-12-02_wide-team/talk.pdf)
+5 -5
View File
@@ -15,14 +15,14 @@ The more a user request will require intra-cluster requests to complete, the mor
This is especially true for sequential requests: requests that must wait the result of another request to be sent.
We designed Garage without consensus algorithms (eg. Paxos or Raft) to minimize the number of sequential and parallel requests.
This serie of benchmarks quantifies the impact of this design choice.
This series of benchmarks quantifies the impact of this design choice.
### On a simple simulated network
We start with a controlled environment, all the instances are running on the same (powerful enough) machine.
To control the network latency, we simulate the network with [mknet](https://git.deuxfleurs.fr/trinity-1686a/mknet) (a tool we developped, based on `tc` and the linux network stack).
To mesure S3 endpoints latency, we use our own tool [s3lat](https://git.deuxfleurs.fr/quentin/s3lat/) to observe only the intra-cluster latency and not some contention on the nodes (CPU, RAM, disk I/O, network bandwidth, etc.).
To control the network latency, we simulate the network with [mknet](https://git.deuxfleurs.fr/trinity-1686a/mknet) (a tool we developed, based on `tc` and the linux network stack).
To measure S3 endpoints latency, we use our own tool [s3lat](https://git.deuxfleurs.fr/quentin/s3lat/) to observe only the intra-cluster latency and not some contention on the nodes (CPU, RAM, disk I/O, network bandwidth, etc.).
Compared to other benchmark tools, S3Lat sends only one (small) request at the same time and measures its latency.
We selected 5 standard endpoints that are often in the critical path: ListBuckets, ListObjects, GetObject, PutObject and RemoveObject.
@@ -32,7 +32,7 @@ In this first benchmark, we consider 5 instances that are located in a different
Compared to garage, minio latency drastically increases on 3 endpoints: GetObject, PutObject, RemoveObject.
We suppose that these requests on minio make transactions over Raft, involving 4 sequential requests: 1) sending the message to the leader, 2) having the leader dispatch it to the other nodes, 3) waiting for the confirmation of followers and finally 4) commiting it. With our current configuration, one Raft transaction will take around 400 ms. GetObject seems to correlate to 1 transaction while PutObject and RemoveObject seems to correlate to 2 or 3. Reviewing minio code would be required to confirm this hypothesis.
We suppose that these requests on minio make transactions over Raft, involving 4 sequential requests: 1) sending the message to the leader, 2) having the leader dispatch it to the other nodes, 3) waiting for the confirmation of followers and finally 4) committing it. With our current configuration, one Raft transaction will take around 400 ms. GetObject seems to correlate to 1 transaction while PutObject and RemoveObject seems to correlate to 2 or 3. Reviewing minio code would be required to confirm this hypothesis.
Conversely, garage uses an architecture similar to DynamoDB and never require global cluster coordination to answer a request.
Instead, garage can always contact the right node in charge of the requested data, and can answer in as low as one request in the case of GetObject and PutObject. We also observed that Garage latency, while often lower to minio, is more dispersed: garage is still in beta and has not received any performance optimization yet.
@@ -50,7 +50,7 @@ We plot a similar graph as before:
This new graph is very similar to the one before, neither minio or garage seems to benefit from this new topology, but they also do not suffer from it.
Considering garage, this is expected: nodes in the same DC are put in the same zone, and then data are spread on different zones for data resiliency and availaibility.
Considering garage, this is expected: nodes in the same DC are put in the same zone, and then data are spread on different zones for data resiliency and availability.
Then, in the default mode, requesting data requires to query at least 2 zones to be sure that we have the most up to date information.
These requests will involve at least one inter-DC communication.
In other words, we prioritize data availability and synchronization over raw performances.
+1 -2
View File
@@ -94,7 +94,7 @@ delete a tombstone, the following condition has to be met:
- All nodes responsible for storing this entry are aware of the existence of
the tombstone, i.e. they cannot hold another version of the entry that is
superseeded by the tombstone. This ensures that deleting the tombstone is
superseded by the tombstone. This ensures that deleting the tombstone is
safe and that no deleted value will come back in the system.
Garage uses atomic database operations (such as compare-and-swap and
@@ -141,4 +141,3 @@ rebalance of data, this would have led to the disk utilization to explode
during the rebalancing, only to shrink again after 24 hours. The 10-minute
delay is a compromise that gives good security while not having this problem of
disk space explosion on rebalance.
+2 -2
View File
@@ -37,7 +37,7 @@ However, Amazon S3 source code is not open but alternatives were proposed.
We identified Minio, Pithos, Swift and Ceph.
Minio/Ceph enforces a total order, so properties similar to a (relaxed) filesystem.
Swift and Pithos are probably the most similar to AWS S3 with their consistent hashing ring.
However Pithos is not maintained anymore. More precisely the company that published Pithos version 1 has developped a second version 2 but has not open sourced it.
However Pithos is not maintained anymore. More precisely the company that published Pithos version 1 has developed a second version 2 but has not open sourced it.
Some tests conducted by the [ACIDES project](https://acides.org/) have shown that Openstack Swift consumes way more resources (CPU+RAM) that we can afford. Furthermore, people developing Swift have not designed their software for geo-distribution.
There were many attempts in research too. I am only thinking to [LBFS](https://pdos.csail.mit.edu/papers/lbfs:sosp01/lbfs.pdf) that was used as a basis for Seafile. But none of them have been effectively implemented yet.
@@ -63,7 +63,7 @@ Due to its industry oriented design, Ceph is also far from being *Simple* to ope
In a certain way, Ceph and MinIO are closer together than they are from Garage or OpenStack Swift.
**[Pithos](https://github.com/exoscale/pithos):**
Pithos has been abandonned and should probably not used yet, in the following we explain why we did not pick their design.
Pithos has been abandoned and should probably not used yet, in the following we explain why we did not pick their design.
Pithos was relying as a S3 proxy in front of Cassandra (and was working with Scylla DB too).
From its designers' mouth, storing data in Cassandra has shown its limitations justifying the project abandonment.
They built a closed-source version 2 that does not store blobs in the database (only metadata) but did not communicate further on it.
-23
View File
@@ -82,12 +82,6 @@ nix-build \
*The result is located in `result/bin`. You can pass arguments to cross compile: check `.woodpecker/release.yml` for examples.*
If you modify a `Cargo.toml` or regenerate any `Cargo.lock`, you must run `cargo2nix`:
```
cargo2nix -f
```
Many tools like rclone, `mc` (minio-client), or `aws` (awscliv2) will be available in your environment and will be useful to test Garage.
**This is the recommended method.**
@@ -124,23 +118,6 @@ cargo fmt # format the project, run it before any commit!
cargo clippy # run the linter, run it before any commit!
```
This is specific to our project, but you will need one last tool, `cargo2nix`.
To install it, run:
```bash
cargo install --git https://github.com/superboum/cargo2nix --branch main cargo2nix
```
You must use it every time you modify a `Cargo.toml` or regenerate a `Cargo.lock` file as follow:
```bash
cargo build # Rebuild Cargo.lock if needed
cargo2nix -f
```
It will output a `Cargo.nix` file which is a specific `Cargo.lock` file dedicated to Nix that is required by our CI
which means you must include it in your commits.
Later, to use our scripts and integration tests, you might need additional tools.
These tools are listed at the end of the `shell.nix` package in the `nativeBuildInputs` part.
It is up to you to find a way to install the ones you need on your computer.
@@ -3,15 +3,6 @@ title = "Miscellaneous notes"
weight = 20
+++
## Quirks about cargo2nix/rust in Nix
If you use submodules in your crate (like `crdt` and `replication` in `garage_table`), you must list them in `default.nix`
The Windows target does not work. it might be solvable through [overrides](https://github.com/cargo2nix/cargo2nix/blob/master/overlay/overrides.nix). Indeed, we pass `x86_64-pc-windows-gnu` but mingw need `x86_64-w64-mingw32`
We have a simple [PR on cargo2nix](https://github.com/cargo2nix/cargo2nix/pull/201) that fixes critical bugs but the project does not seem very active currently. We must use [my patched version of cargo2nix](https://github.com/superboum/cargo2nix) to enable i686 and armv6l compilation. We might need to contribute to cargo2nix in the future.
## Nix
Nix has no armv7 + musl toolchains but armv7l is backward compatible with armv6l.
+3 -5
View File
@@ -23,7 +23,7 @@ This logic is defined in `nix/build_index.nix`.
For each commit, we first pass the code to a formatter (rustfmt) and a linter (clippy).
Then we try to build it in debug mode and run both unit tests and our integration tests.
Additionnaly, when releasing, our integration tests are run on the release build for amd64 and i686.
Additionally, when releasing, our integration tests are run on the release build for amd64 and i686.
## Generated Artifacts
@@ -32,7 +32,7 @@ We generate the following binary artifacts for now:
- **os**: linux
- **format**: static binary, docker container
Additionnaly we also build two web pages and one JSON document:
Additionally we also build two web pages and one JSON document:
- the documentation (this website)
- [the release page](https://garagehq.deuxfleurs.fr/_releases.html)
- [the release list in JSON format](https://garagehq.deuxfleurs.fr/_releases.json)
@@ -67,7 +67,7 @@ nix copy --to 's3://nix?endpoint=garage.deuxfleurs.fr&region=garage&secret-key=/
The previous command will only send the built package and not its dependencies.
In the case of our CI pipeline, we want to cache all intermediate build steps
as well. This can be done using this quite involved command (here as an example
for the `pkgs.amd64.relase` package):
for the `pkgs.amd64.release` package):
```bash
nix copy -j8 \
@@ -174,5 +174,3 @@ drone sign --save Deuxfleurs/garage
```
Looking at the file, you will see that most of the commands are `nix-shell` and `nix-build` commands with various parameters.
+2 -2
View File
@@ -242,7 +242,7 @@ dc3 Tags Partitions Capacity Usable capacity
TOTAL 256 (256 unique) 2.0 GB 1000.0 MB (50.0%)
```
As we can see, the node that was moved to `dc3` (node4) is only used at 25% (approximatively),
As we can see, the node that was moved to `dc3` (node4) is only used at 25% (approximately),
whereas the node that was already in `dc3` (node3) is used at 75%.
This can be explained by the following:
@@ -260,7 +260,7 @@ This can be explained by the following:
data can be removed to be moved to node1.
- Garage will move data in equal proportions from all possible sources, in this
case it means that it will tranfer 25% of the entire data set from node3 to
case it means that it will transfer 25% of the entire data set from node3 to
node1 and another 25% from node4 to node1.
This explains why node3 ends with 75% utilization (100% from before minus 25%
+1 -1
View File
@@ -40,7 +40,7 @@ First of all, Garage divides the set of all possible block hashes
in a fixed number of slices (currently 1024), and assigns
to each slice a primary storage location among the specified data directories.
The number of slices having their primary location in each data directory
is proportionnal to the capacity specified in the config file.
is proportional to the capacity specified in the config file.
When Garage receives a block to write, it will always write it in the primary
directory of the slice that contains its hash.
+1 -1
View File
@@ -56,7 +56,7 @@ From a high level perspective, a major upgrade looks like this:
10. Enable API access (reverse step 1)
11. Monitor your cluster while load comes back, check that all your applications are happy with this new version
### Major upgarades with minimal downtime
### Major upgrades with minimal downtime
There is only one operation that has to be coordinated cluster-wide: the switch of one version of the internal RPC protocol to the next.
This means that an upgrade with very limited downtime can simply be performed from one major version to the next by restarting all nodes
+211 -138
View File
@@ -43,12 +43,10 @@ or if you want a build customized for your system,
you can [build Garage from source](@/documentation/cookbook/from-source.md).
If none of these option work for you, you can also run Garage in a Docker
container. When using Docker, the commands used in this guide will not work
anymore. We recommend reading the tutorial on [configuring a
multi-node cluster](@/documentation/cookbook/real-world.md) to learn about
using Garage as a Docker container. For simplicity, a minimal command to launch
Garage using Docker is provided in this quick start guide as well.
container. For simplicity, a minimal command to launch Garage using Docker is
provided in this quick start guide. We recommend reading the tutorial on
[configuring a multi-node cluster](@/documentation/cookbook/real-world.md) to
learn about the full Docker workflow for Garage.
## Configuring and starting Garage
@@ -82,9 +80,6 @@ bind_addr = "[::]:3902"
root_domain = ".web.garage.localhost"
index = "index.html"
[k2v_api]
api_bind_addr = "[::]:3904"
[admin]
api_bind_addr = "[::]:3903"
admin_token = "$(openssl rand -base64 32)"
@@ -95,10 +90,13 @@ EOF
See the [Configuration file format](https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/)
for complete options and values.
Now that your configuration file has been created, you may save it to the directory of your choice.
By default, Garage looks for **`/etc/garage.toml`.**
You can also store it somewhere else, but you will have to specify `-c path/to/garage.toml`
at each invocation of the `garage` binary (for example: `garage -c ./garage.toml server`, `garage -c ./garage.toml status`).
By default, Garage looks for its configuration file in **`/etc/garage.toml`.**
Since we have written our configuration file in the working directory, we will have to set
the following environment variable:
```bash
export GARAGE_CONFIG_FILE=$(pwd)/garage.toml
```
As you can see, the `rpc_secret` is a 32 bytes hexadecimal string.
You can regenerate it with `openssl rand -hex 32`.
@@ -111,15 +109,36 @@ Garage server will not be persistent. Change these to locations on your local di
your data to be persisted properly.
### Configuring initial access credentials
Since `v2.3.0`, Garage can automatically create a default access key and a default storage bucket,
based on values provided in environment variables.
To use this feature, export the following environment variables:
```bash
export GARAGE_DEFAULT_ACCESS_KEY="GK$(openssl rand -hex 16)"
export GARAGE_DEFAULT_SECRET_KEY="$(openssl rand -hex 32)"
export GARAGE_DEFAULT_BUCKET="default-bucket"
```
The example above creates a random access key ID and associated secret key.
You can also provide an access key ID and secret key of your own.
### Launching the Garage server
Use the following command to launch the Garage server:
```
garage -c path/to/garage.toml server
```bash
garage server --single-node --default-bucket
```
If you have placed the `garage.toml` file in `/etc` (its default location), you can simply run `garage server`.
The `--single-node` flag instructs Garage to automatically configure a single-node cluster without data replication.
The `--default-bucket` flag instructs Garage to create a default access key and a default bucket using the environment variables we defined above.
Both flags are optional and can be omitted, in which case you will have to follow manual configuration steps described below.
**For older versions of Garage (before v2.3.0):** automatic configuration using `--single-node` and `--default-bucket` is not available,
you must follow the manual configuration steps.
Alternatively, if you cannot or do not wish to run the Garage binary directly,
you may use Docker to run Garage in a container using the following command:
@@ -127,21 +146,58 @@ you may use Docker to run Garage in a container using the following command:
```bash
docker run \
-d \
--name garaged \
--name garage-container \
-p 3900:3900 -p 3901:3901 -p 3902:3902 -p 3903:3903 \
-v /path/to/garage.toml:/etc/garage.toml \
-v /path/to/garage/meta:/var/lib/garage/meta \
-v /path/to/garage/data:/var/lib/garage/data \
dxflrs/garage:v2.1.0
-v $(pwd)/garage.toml:/etc/garage.toml \
-e GARAGE_DEFAULT_ACCESS_KEY \
-e GARAGE_DEFAULT_SECRET_KEY \
-e GARAGE_DEFAULT_BUCKET \
dxflrs/garage:v2.3.0
/garage server --single-node --default-bucket
```
Under Linux, you can substitute `--network host` for `-p 3900:3900 -p 3901:3901 -p 3902:3902 -p 3903:3903`
Note that this command will NOT create persistent volumes for Garage's data, so
your cluster will be wiped if the container terminates. To persist Garage's
data, you must manually add volumes for the `data` and `metadata` directories
and configure their correct paths in your `garage.toml` files (see [configuring
a multi-node cluster](@/documentation/cookbook/real-world.md)).
#### Troubleshooting
Under Linux, you can substitute `--network host` for `-p 3900:3900 -p 3901:3901 -p 3902:3902 -p 3903:3903`.
### Checking that Garage runs correctly
The `garage` utility is also used as a CLI tool to administrate your Garage
deployment. It needs read access to your configuration file and to the metadata directory
to obtain connection parameters to contact the local Garage node.
Use the following command to show the status of your cluster:
```
garage status
```
If you are running Garage in a Docker container, you can use the following command instead:
```bash
docker exec garage-container /garage status
```
This should show something like this:
```
==== HEALTHY NODES ====
ID Hostname Address Tags Zone Capacity DataAvail Version
563e1ac825ee3323 linuxbox 127.0.0.1:3901 [default] dc1 19.9 GiB 19.5 GiB (97.6%) v2.3.0
```
### Troubleshooting
Ensure your configuration file, `metadata_dir` and `data_dir` are readable by the user running the `garage` server or Docker.
You can tune Garage's verbosity by setting the `RUST_LOG=` environment variable. \
When running the `garage` CLI, ensure that the path to your configuration file is correctly specified (see below),
and that it can read it and read from your metadata directory.
You can tune Garage's verbosity by setting the `RUST_LOG=` environment variable.
Available log levels are (from less verbose to more verbose): `error`, `warn`, `info` *(default)*, `debug` and `trace`.
```bash
@@ -154,36 +210,135 @@ Log level `info` is the default value and is recommended for most use cases.
Log level `debug` can help you check why your S3 API calls are not working.
### Checking that Garage runs correctly
The `garage` utility is also used as a CLI tool to configure your Garage deployment.
It uses values from the TOML configuration file to find the Garage daemon running on the
local node, therefore if your configuration file is not at `/etc/garage.toml` you will
again have to specify `-c path/to/garage.toml` at each invocation.
## Uploading and downloading from Garage
If you are running Garage in a Docker container, you can set `alias garage="docker exec -ti <container name> /garage"`
to use the Garage binary inside your container.
This section will show how to download and upload files on Garage using a third-party tool named `awscli`.
If the `garage` CLI is able to correctly detect the parameters of your local Garage node,
the following command should be enough to show the status of your cluster:
```
garage status
### Install and configure `awscli`
If you have python on your system, you can install it with:
```bash
python -m pip install --user awscli
```
This should show something like this:
Now that `awscli` is installed, you must configure it to talk to your Garage
instance using the credentials defined above. Here is a simple way to create
a configuration file in `~/.awsrc` using a single command that will save the
secrets from your environment:
```bash
cat > ~/.awsrc <<EOF
export AWS_ENDPOINT_URL='http://localhost:3900'
export AWS_DEFAULT_REGION='garage'
export AWS_ACCESS_KEY_ID='$GARAGE_DEFAULT_ACCESS_KEY'
export AWS_SECRET_ACCESS_KEY='$GARAGE_DEFAULT_SECRET_KEY'
aws --version
EOF
```
Note that you need to have at least `awscli` `>=1.29.0` or `>=2.13.0`, otherwise you
need to specify `--endpoint-url` explicitly on each `awscli` invocation.
Now, each time you want to use `awscli` on this target, run:
```bash
source ~/.awsrc
```
*You can create multiple files with different names if you
have multiple Garage clusters or different keys.
Switching from one cluster to another is as simple as
sourcing the right file.*
### Example usage of `awscli`
```bash
# list buckets
aws s3 ls
# list objects of a bucket
aws s3 ls s3://default-bucket
# copy from your filesystem to garage
aws s3 cp /proc/cpuinfo s3://default-bucket/cpuinfo.txt
# copy from garage to your filesystem
aws s3 cp s3://default-bucket/cpuinfo.txt /tmp/cpuinfo.txt
```
Note that you can use `awscli` for more advanced operations like
creating a bucket, pre-signing a request or managing your website.
[Read the full documentation to know more](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html).
Some features are however not implemented like ACL or policy.
Check [our S3 compatibility list](@/documentation/reference-manual/s3-compatibility.md).
### Other tools for interacting with Garage
The following tools can also be used to send and receive files from/to Garage:
- [minio-client](@/documentation/connect/cli.md#minio-client)
- [s3cmd](@/documentation/connect/cli.md#s3cmd)
- [rclone](@/documentation/connect/cli.md#rclone)
- [Cyberduck](@/documentation/connect/cli.md#cyberduck)
- [WinSCP](@/documentation/connect/cli.md#winscp)
An exhaustive list is maintained in the ["Integrations" > "Browsing tools" section](@/documentation/connect/_index.md).
## Manual configuration
This section provides instructions that are equivalent to using the
`--single-node` and `--default-bucket` flags for automatic configuration. If
you are using an older version of Garage (before v2.3.0), you must follow
these instructions as automatic configuration is not available.
We will have to run quite a few `garage` administration commands to get started.
If you ever get lost, don't forget that the `help` command and the `--help` flags can help you anywhere,
the CLI tool is self-documented! Two examples:
```
garage help
garage bucket allow --help
```
### Configuring the `garage` CLI
Remember that the `garage` CLI needs to know the path of your `garage.toml` configuration file.
If it is not in the default location of `/etc/garage.toml`, you can specify it either:
- by setting the `GARAGE_CONFIG_FILE` environment variable;
- by adding the `-c` flag to each `garage` command, for example: `garage -c ./garage.toml status`.
If you are running Garage in a Docker container, you can set the following alias
to provide a fake `garage`command that uses the Garage binary inside your container:
```bash
alias garage="docker exec -ti <container name> /garage"
```
You can test that your `garage` CLI is configured correctly by running a basic command such as `garage status`.
### Creating a cluster layout
When you first start a cluster without automatic configuration, the output of `garage status` will look as follows:
```
==== HEALTHY NODES ====
ID Hostname Address Tag Zone Capacity
563e1ac825ee3323 linuxbox 127.0.0.1:3901 NO ROLE ASSIGNED
ID Hostname Address Tags Zone Capacity DataAvail Version
563e1ac825ee3323 linuxbox 127.0.0.1:3901 NO ROLE ASSIGNED v2.3.0
```
## Creating a cluster layout
Creating a cluster layout for a Garage deployment means informing Garage
of the disk space available on each node of the cluster, `-c`,
as well as the name of the zone (e.g. datacenter), `-z`, each machine is located in.
Creating a cluster layout for a Garage deployment means informing Garage of the
disk space available on each node of the cluster using the `-c` flag, as well
as the name of the zone (e.g. datacenter) each machine is located in using the
`-z` flag.
For our test deployment, we are have only one node with zone named `dc1` and a
capacity of `1G`, though the capacity is ignored for a single node deployment
@@ -204,38 +359,29 @@ garage layout apply --version 1
```
## Creating buckets and keys
In this section, we will suppose that we want to create a bucket named `nextcloud-bucket`
that will be accessed through a key named `nextcloud-app-key`.
Don't forget that `help` command and `--help` subcommands can help you anywhere,
the CLI tool is self-documented! Two examples:
```
garage help
garage bucket allow --help
```
### Create a bucket
### Creating buckets and keys
Let's take an example where we want to deploy NextCloud using Garage as the
main data storage.
main data storage. We will suppose that we want to create a bucket named
`nextcloud-bucket` that will be accessed through a key named
`nextcloud-app-key`.
First, create a bucket with the following command:
#### Create a bucket
First, create the bucket with the following command:
```
garage bucket create nextcloud-bucket
```
Check that everything went well:
Check that the bucket was created properly:
```
garage bucket list
garage bucket info nextcloud-bucket
```
### Create an API key
#### Create an API key
The `nextcloud-bucket` bucket now exists on the Garage server,
however it cannot be accessed until we add an API key with the proper access rights.
@@ -258,14 +404,14 @@ Secret key: 7d37d093435a41f2aab8f13c19ba067d9776c90215f56614adad6ece597dbb34
Authorized buckets:
```
Check that everything works as intended:
Check that the key was created properly:
```
garage key list
garage key info nextcloud-app-key
```
### Allow a key to access a bucket
#### Allow a key to access a bucket
Now that we have a bucket and a key, we need to give permissions to the key on the bucket:
@@ -284,78 +430,5 @@ You can check at any time the allowed keys on your bucket with:
garage bucket info nextcloud-bucket
```
## Uploading and downloading from Garage
To download and upload files on garage, we can use a third-party tool named `awscli`.
### Install and configure `awscli`
If you have python on your system, you can install it with:
```bash
python -m pip install --user awscli
```
Now that `awscli` is installed, you must configure it to talk to your Garage instance,
with your key. There are multiple ways to do that, the simplest one is to create a file
named `~/.awsrc` with this content:
```bash
export AWS_ACCESS_KEY_ID=xxxx # put your Key ID here
export AWS_SECRET_ACCESS_KEY=xxxx # put your Secret key here
export AWS_DEFAULT_REGION='garage'
export AWS_ENDPOINT_URL='http://localhost:3900'
aws --version
```
Note you need to have at least `awscli` `>=1.29.0` or `>=2.13.0`, otherwise you
need to specify `--endpoint-url` explicitly on each `awscli` invocation.
Now, each time you want to use `awscli` on this target, run:
```bash
source ~/.awsrc
```
*You can create multiple files with different names if you
have multiple Garage clusters or different keys.
Switching from one cluster to another is as simple as
sourcing the right file.*
### Example usage of `awscli`
```bash
# list buckets
aws s3 ls
# list objects of a bucket
aws s3 ls s3://nextcloud-bucket
# copy from your filesystem to garage
aws s3 cp /proc/cpuinfo s3://nextcloud-bucket/cpuinfo.txt
# copy from garage to your filesystem
aws s3 cp s3://nextcloud-bucket/cpuinfo.txt /tmp/cpuinfo.txt
```
Note that you can use `awscli` for more advanced operations like
creating a bucket, pre-signing a request or managing your website.
[Read the full documentation to know more](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3/index.html).
Some features are however not implemented like ACL or policy.
Check [our s3 compatibility list](@/documentation/reference-manual/s3-compatibility.md).
### Other tools for interacting with Garage
The following tools can also be used to send and receive files from/to Garage:
- [minio-client](@/documentation/connect/cli.md#minio-client)
- [s3cmd](@/documentation/connect/cli.md#s3cmd)
- [rclone](@/documentation/connect/cli.md#rclone)
- [Cyberduck](@/documentation/connect/cli.md#cyberduck)
- [WinSCP](@/documentation/connect/cli.md#winscp)
An exhaustive list is maintained in the ["Integrations" > "Browsing tools" section](@/documentation/connect/_index.md).
You should now be able to read and write objects to the bucket using the
credentials created above.
+45 -18
View File
@@ -25,7 +25,7 @@ db_engine = "lmdb"
block_size = "1M"
block_ram_buffer_max = "256MiB"
block_max_concurrent_reads = 16
block_max_concurrent_writes_per_request =10
lmdb_map_size = "1T"
compression_level = 1
@@ -51,17 +51,21 @@ allow_punycode = false
[consul_discovery]
api = "catalog"
consul_http_addr = "http://127.0.0.1:8500"
consul_http_addr = "https://127.0.0.1:8500"
tls_skip_verify = false
service_name = "garage-daemon"
ca_cert = "/etc/consul/consul-ca.crt"
# for `agent` API mode, unset client_cert and client_key:
client_cert = "/etc/consul/consul-client.crt"
client_key = "/etc/consul/consul-key.crt"
# for `agent` API mode, unset client_cert and client_key, and optionally enable `token`
# optionally enable `token` for authentication:
# token = "abcdef-01234-56789"
tls_skip_verify = false
tags = [ "dns-enabled" ]
meta = { dns-acl = "allow trusted" }
datacenters = ["dc1", "dc2", "dc3"]
[kubernetes_discovery]
namespace = "garage"
@@ -99,6 +103,7 @@ Top-level configuration options, in alphabetical order:
[`allow_punycode`](#allow_punycode),
[`allow_world_readable_secrets`](#allow_world_readable_secrets),
[`block_max_concurrent_reads`](#block_max_concurrent_reads),
[`block_max_concurrent_writes_per_request`](#block_max_concurrent_writes_per_request),
[`block_ram_buffer_max`](#block_ram_buffer_max),
[`block_size`](#block_size),
[`bootstrap_peers`](#bootstrap_peers),
@@ -127,12 +132,14 @@ The `[consul_discovery]` section:
[`client_cert`](#consul_client_cert_and_key),
[`client_key`](#consul_client_cert_and_key),
[`consul_http_addr`](#consul_http_addr),
[`datacenters`](#consul_datacenters)
[`meta`](#consul_tags_and_meta),
[`service_name`](#consul_service_name),
[`tags`](#consul_tags_and_meta),
[`tls_skip_verify`](#consul_tls_skip_verify),
[`token`](#consul_token).
The `[kubernetes_discovery]` section:
[`namespace`](#kube_namespace),
[`service_name`](#kube_service_name),
@@ -366,7 +373,7 @@ Performance characteristics of the different DB engines are as follows:
not recommended.
- Keys in LMDB are limited to 511 bytes. This limit translates to limits on
object keys in S3 and sort keys in K2V that are limted to 479 bytes.
object keys in S3 and sort keys in K2V that are limited to 479 bytes.
- **Sqlite:** Garage supports Sqlite as an alternative storage backend for
metadata, which does not have the issues listed above for LMDB. Sqlite is
@@ -390,7 +397,7 @@ garage convert-db -a <input db engine> -i <input db path> \
```
Make sure to specify the full database path as presented in the table above
(third colummn), and not just the path to the metadata directory.
(third column), and not just the path to the metadata directory.
#### `metadata_fsync` {#metadata_fsync}
@@ -432,7 +439,7 @@ This might reduce the risk that a data block is lost in rare
situations such as simultaneous node losing power,
at the cost of a moderate drop in write performance.
Similarly to `metatada_fsync`, this is likely not necessary
Similarly to `metadata_fsync`, this is likely not necessary
if geographical replication is used.
#### `metadata_auto_snapshot_interval` (since `v0.9.4`) {#metadata_auto_snapshot_interval}
@@ -548,12 +555,20 @@ awaits for one of the `block_max_concurrent_reads` slots to be available
slot, it reads the entire block file to RAM and frees the slot as soon as the
block file is finished reading. Only after the slot is released will the
block's data start being transferred over the network. If the request fails to
acquire a reading slot wihtin 15 seconds, it fails with a timeout error.
acquire a reading slot within 15 seconds, it fails with a timeout error.
Timeout events can be monitored through the `block_read_semaphore_timeouts`
metric in Prometheus: a non-zero number of such events indicates an I/O
bottleneck on HDD read speed.
#### `block_max_concurrent_writes_per_request` (since `v1.3.1` / `v2.2.0`) {#block_max_concurrent_writes_per_request}
This parameter is designed to adapt to the concurrent write performance of
different storage media. Maximum number of parallel block writes per put request.
Higher values may improve throughput but increase memory usage.
Default value: 3. Recommended values: 10-30 for NVMe, 3-10 for spinning HDD.
#### `lmdb_map_size` {#lmdb_map_size}
This parameters can be used to set the map size used by LMDB,
@@ -603,11 +618,11 @@ storing the secret as the `GARAGE_RPC_SECRET_FILE` environment variable.
#### `rpc_bind_addr` {#rpc_bind_addr}
The address and port on which to bind for inter-cluster communcations
(reffered to as RPC for remote procedure calls).
The address and port on which to bind for inter-cluster communications
(referred to as RPC for remote procedure calls).
The port specified here should be the same one that other nodes will used to contact
the node, even in the case of a NAT: the NAT should be configured to forward the external
port number to the same internal port nubmer. This means that if you have several nodes running
port number to the same internal port number. This means that if you have several nodes running
behind a NAT, they should each use a different RPC port number.
#### `rpc_bind_outgoing` (since `v0.9.2`) {#rpc_bind_outgoing}
@@ -726,6 +741,18 @@ node_prefix "" {
}
```
#### `datacenters` {#consul_datacenters}
Optional list of datacenters that allow garage to do service discovery when Consul is configured in WAN federation.
Example: `datacenters = ["dc1", "dc2", "dc3"]`
In a WAN configuration, by default the Consul services API only responds with
local LAN services. When a list of datacenters is specified using this option,
Garage will query the consul server API by datacenter directly, allowing for
Garage to discover nodes across the Consul WAN.
#### `tags` and `meta` {#consul_tags_and_meta}
Additional list of tags and map of service meta to add during service registration.
@@ -758,14 +785,14 @@ manually.
#### `api_bind_addr` {#s3_api_bind_addr}
The IP and port on which to bind for accepting S3 API calls.
This endpoint does not suport TLS: a reverse proxy should be used to provide it.
This endpoint does not support TLS: a reverse proxy should be used to provide it.
Alternatively, since `v0.8.5`, a path can be used to create a unix socket with 0222 mode.
#### `s3_region` {#s3_region}
Garage will accept S3 API calls that are targetted to the S3 region defined here.
API calls targetted to other regions will fail with a AuthorizationHeaderMalformed error
Garage will accept S3 API calls that are targeted to the S3 region defined here.
API calls targeted to other regions will fail with a AuthorizationHeaderMalformed error
message that redirects the client to the correct region.
#### `root_domain` {#s3_root_domain}
@@ -773,7 +800,7 @@ message that redirects the client to the correct region.
The optional suffix to access bucket using vhost-style in addition to path-style request.
Note path-style requests are always enabled, whether or not vhost-style is configured.
Configuring vhost-style S3 required a wildcard DNS entry, and possibly a wildcard TLS certificate,
but might be required by softwares not supporting path-style requests.
but might be required by software not supporting path-style requests.
If `root_domain` is `s3.garage.eu`, a bucket called `my-bucket` can be interacted with
using the hostname `my-bucket.s3.garage.eu`.
@@ -789,7 +816,7 @@ behaviour of this module.
The IP and port on which to bind for accepting HTTP requests to buckets configured
for website access.
This endpoint does not suport TLS: a reverse proxy should be used to provide it.
This endpoint does not support TLS: a reverse proxy should be used to provide it.
Alternatively, since `v0.8.5`, a path can be used to create a unix socket with 0222 mode.
@@ -862,7 +889,7 @@ You can use any random string for this value. We recommend generating a random t
If this is set to `true`, accessing the metrics endpoint will always require
an access token. Valid tokens include the `metrics_token` if it is set,
and admin API token defined dynamicaly in Garage which have
and admin API token defined dynamically in Garage which have
the `Metrics` endpoint in their scope.
#### `trace_sink` {#admin_trace_sink}
+4 -4
View File
@@ -46,7 +46,7 @@ to select the replication mode best suited to your use case (hint: in most cases
### Compression and deduplication
All data stored in Garage is deduplicated, and optionnally compressed using
All data stored in Garage is deduplicated, and optionally compressed using
Zstd. Objects uploaded to Garage are chunked in blocks of constant sizes (see
[`block_size`](@/documentation/reference-manual/configuration.md#block_size)),
and the hashes of individual blocks are used to dispatch them to storage nodes
@@ -84,13 +84,13 @@ exposing the same content under different domain names.
Garage also supports bucket aliases which are local to a single user:
this allows different users to have different buckets with the same name, thus avoiding naming collisions.
This can be helpfull for instance if you want to write an application that creates per-user buckets with always the same name.
This can be helpful for instance if you want to write an application that creates per-user buckets with always the same name.
This feature is totally invisible to S3 clients and does not break compatibility with AWS.
### Cluster administration API
Garage provides a fully-fledged REST API to administer your cluster programatically.
Garage provides a fully-fledged REST API to administer your cluster programmatically.
Functionality included in the admin API include: setting up and monitoring
cluster nodes, managing access credentials, and managing storage buckets and bucket aliases.
A full reference of the administration API is available [here](@/documentation/reference-manual/admin-api.md).
@@ -100,7 +100,7 @@ A full reference of the administration API is available [here](@/documentation/r
Garage makes some internal metrics available in the Prometheus data format,
which allows you to build interactive dashboards to visualize the load and internal state of your storage cluster.
For developpers and performance-savvy administrators,
For developers and performance-savvy administrators,
Garage also supports exporting traces of what it does internally in OpenTelemetry format.
This allows to monitor the time spent at various steps of the processing of requests,
in order to detect potential performance bottlenecks.
+1 -2
View File
@@ -19,7 +19,7 @@ The specification of the K2V API can be found
[here](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/commit/f8be15c37db857e177d543de7be863692628d567/doc/drafts/k2v-spec.md).
This document also includes a high-level overview of K2V's design.
The K2V API uses AWSv4 signatures for authentification, same as the S3 API.
The K2V API uses AWSv4 signatures for authentication, same as the S3 API.
The AWS region used for signature calculation is always the same as the one
defined for the S3 API in the config file.
@@ -55,4 +55,3 @@ cargo build --features cli --bin k2v-cli
The CLI utility is self-documented, run `k2v-cli --help` to learn how to use
it. There is also a short README.md in the `src/k2v-client` folder with some
instructions.
+188
View File
@@ -0,0 +1,188 @@
+++
title = "Known issues"
weight = 80
+++
Issues in each section are roughly sorted by order of decreasing impact, based on actual reports from users.
## Architectural limitations
Issues that are caused by design decisions of Garage internals, and that can't
be fixed without major architectural changes in the codebase.
### Metadata performance issues with many objects
**Related issues:**
- [#851 - Performances collapse with 10 millions pictures in a bucket](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/851)
- [#1222 - Cluster Setup Write Performance Degraded After Writing 10 Million Object (200-300Kb per object)](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1222)
### Very big objects cause performance degradation
For each object, there is a single metadata entry called a `Version` that
contains a list of all of the data blocks in the object. For very big objects,
this entry can contain thousands of block references. During the uploading of
an object, this metadata entry needs to be read, deserialized, reserialized and
written for each individual data block uploaded. This means that the
complexity of an upload is `O(n²)` in the number of blocks needed.
This manifests by excessive metadata I/O and CPU usage, and uploads eventually stalling.
**Mitigation:** Increase the `block_size` configuration parameter to reduce the
number of blocks. Make sure multipart uploads use chunks that are at least
`block_size` in size, and that are an exact multiple of `block_size` to avoid
the creation of smaller blocks.
**Long-term solution:** An architectural change in the metadata system would be
required to store block lists in many independent metadata entries instead of
one single big entry per object.
**Related issues:**
- [#662 - Large Files fail to upload](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/662)
- [#1366 - High CPU usage and performance degradation during long multipart uploads](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1366)
### No conditional writes / locking / WORM support (`if-none-match`, ...)
This is structurally impossible to implement in Garage due to the lack of a consensus algorithm,
which is one of Garage's core design choices which we cannot reconsider.
A semi-working, *unsafe* implementation of WORM and object locking could be
implemented, with the following constraint: only after the completion of the
first write (in case of WORM) or the setting of a lock (for object lock) can we
guarantee that the object cannot be overwritten. In case where an overwrite
requests arrives at the same time as the initial request to write or to lock
the object, we cannot implement a safe and consistent way to reject it. This
means that many practical use-cases for `if-none-match` cannot be supported
(e.g. using it to implement mutual exclusion between concurrent writers).
**Related issues:**
- [#1052 - Support conditional writes](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1052)
- [#1127 - Feature Request: WORM (Write Once Read Many) / Object Lock Support](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/1127)
### `CreateBucket` race condition
Also due to the lack of a consensus algorithm, there is no mutual exclusion
between concurrent `CreateBucket` requests using the same bucket name.
**Related issues:**
- [#649 - Race condition in CreateBucket](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/649)
### Metadata and data have the same replication factor
There is a single `replication_factor` in the configuration file that applies both to data blocks and metadata entries.
This makes clusters with `replication_factor = 1` particularly vulnerable in cases of metadata corruption (see below), as there
is a single copy of the metadata for each object even in multi-node clusters.
**Mitigation:** Do not use `replication_factor = 1`.
**Long-term solution:** We want to allow scenarios such as replicating the
metadata on 2, 3 or more nodes and the data on only 1 or 2 nodes (for example),
so that the metadata can benefit from better redundancy without increasing the
storage costs for the entire dataset. This will require some important changes
in the codebase.
**Related issues:**
- [#720 - Separate replication modes for metadata/data](https://git.deuxfleurs.fr/Deuxfleurs/garage/issues/720)
### Node count limitation
Garage will have issues in clusters with too many nodes, it will not be able to
spread data uniformly among nodes and some nodes will fill up faster than
other. This starts to manifest when the number of nodes is bigger than `10 ×
replication_factor`. This is due to the fact that Garage uses only 256
partitions internally.
**Mitigation:** Build clusters with fewer, bigger nodes.
**Potential solution:** This can be fixed by increasing the number of
partitions in Garage. The code paths exist, there is [a `const`
somewhere](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/commit/6fd9bba0cb55062cb1725ab961b7fa8acb9dcc61/src/rpc/layout/mod.rs#L35)
that theoretically allows to increase the number of partitions up to `2^16`,
but this has not been tested so there might be bugs.
### Buckets are not sharded
For each bucket, the first metadata layer that contains an index of all objects
is not sharded. This index, which includes the names and all metadata (size,
headers, ...) for each object, is stored on `$replication_factor` nodes.
For instance with `replication_factor = 3`, a given bucket will use only 3
specific nodes for this index (chosen at random when the bucket is created) to
store this index. In a multi-zone deployments, these nodes will be spread in
different zones. Each bucket uses a different set of 3 random nodes for its
index.
As a consequence, very large buckets might cause uneven load distribution
within a cluster. If all of the requests on a cluster are for objects in a
single bucket, then the `$replication_factor` nodes that store the index will
become a hotspot in the cluster, with more intensive metadata access patterns.
There is no way of choosing which nodes will have this role.
Currently, we have no report of this being an issue in practice.
**Mitigation:** This impacts in particular clusters that are used for a single
purpose with a single bucket. This can be solved by dividing your dataset among
many buckets, using a client-side sharding strategy that you will have to
design. Use at least as many buckets as you have nodes on your cluster.
## Bugs
Known bugs that are complex to diagnose and fix, and therefore have not been
fixed yet.
### LMDB metadata corruption
Many users have reported situations where the LMDB metadata db becomes
corrupted, sometimes after a forced shutdown of Garage or in case of power
loss. A corrupted database file is generally not recoverable.
**Mitigation:** Use a `replication_factor` of at least 2. Configure automatic
snapshotting using `metadata_auto_snapshot_interval` so that in case of
corruption you can rollback to a working database.
Note that taking filesystem-level snapshots of your `metadata_dir`, although it
is much faster and less I/O intensive than Garage's built-in snapshotting, does
not ensure that the snapshot will be consistent. If the snapshot is taking
during a metadata write, the snapshot itself might be corrupted and thus not
usable as a rollback point. Therefore, prefer using
`metadata_auto_snapshot_interval` in all cases.
### Layout updates might require manual intervention
In case of disconnected nodes, when changing the cluster layout to remove these
nodes and add other nodes instead, Garage might not be able to properly evict
the old nodes from the system. This is a built-in security measure to avoid any
inconsistent cluster states.
This manifests by several cluster layout versions staying active even after a
full resync. You can diagnose this situation with `garage layout history`,
which will give you instructions to fix it.
### Tag assignment
In the `garage layout assign` command, the `-t` argument has to be repeated
multiple times to set multiple tags on a node. Writing multiple tags separated
by commas will result in a single string.
## General footguns
Choices made by the developers that users must be aware of if they don't want
to run into potential issues.
### Resync tranquility is conservative by default
By default, the worker parameters `resync-tranquility` and `resync-worker-count` are set to very conservative values, to avoid overloading nodes with I/O when data needs to be resynchronized between nodes.
This can cause issues where the resync queue grows faster than it can be cleared, which in turn causes performance issues in the rest of Garage.
This situation is indicated by a big resync queue with few resync errors (the queue is not caused by a disconnected/malfunctionning node).
To fix it, increase the number of resync workers and reduce the resync tranquility. For instance, if you want to resync as fast as possible:
```
garage worker set -a resync-worker-count 8
garage worker set -a resync-tranquility 0
```
@@ -27,7 +27,7 @@ Feel free to open a PR to suggest fixes this table. Minio is missing because the
| Feature | Garage | [Openstack Swift](https://docs.openstack.org/swift/latest/s3_compat.html) | [Ceph Object Gateway](https://docs.ceph.com/en/latest/radosgw/s3/) | [Riak CS](https://docs.riak.com/riak/cs/2.1.1/references/apis/storage/s3/index.html) | [OpenIO](https://docs.openio.io/latest/source/arch-design/s3_compliancy.html) |
|------------------------------|----------------------------------|-----------------|---------------|---------|-----|
| [signature v2](https://docs.aws.amazon.com/general/latest/gr/signature-version-2.html) (deprecated) | ❌ Missing | ✅ | ✅ | ✅ | ✅ |
| [signature v2](https://docs.aws.amazon.com/AmazonS3/latest/API/Appendix-Sigv2.html) (deprecated) | ❌ Missing | ✅ | ✅ | ✅ | ✅ |
| [signature v4](https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) | ✅ Implemented | ✅ | ✅ | ❌ | ✅ |
| [URL path-style](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#path-style-access) (eg. `host.tld/bucket/key`) | ✅ Implemented | ✅ | ✅ | ❓| ✅ |
| [URL vhost-style](https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#virtual-hosted-style-access) URL (eg. `bucket.host.tld/key`) | ✅ Implemented | ❌| ✅| ✅ | ✅ |
@@ -45,7 +45,7 @@ we suppose that OpenIO supports presigned URLs.
All endpoints that are missing on Garage will return a 501 Not Implemented.
Some `x-amz-` headers are not implemented.
### Core endoints
### Core endpoints
| Endpoint | Garage | [Openstack Swift](https://docs.openstack.org/swift/latest/s3_compat.html) | [Ceph Object Gateway](https://docs.ceph.com/en/latest/radosgw/s3/) | [Riak CS](https://docs.riak.com/riak/cs/2.1.1/references/apis/storage/s3/index.html) | [OpenIO](https://docs.openio.io/latest/source/arch-design/s3_compliancy.html) |
|------------------------------|----------------------------------|-----------------|---------------|---------|-----|
@@ -135,12 +135,12 @@ If you need this feature, please [share your use case in our dedicated issue](ht
**PutBucketLifecycleConfiguration:** The only actions supported are
`AbortIncompleteMultipartUpload` and `Expiration` (without the
`ExpiredObjectDeleteMarker` field). All other operations are dependent on
either bucket versionning or storage classes which Garage currently does not
either bucket versioning or storage classes which Garage currently does not
implement. The deprecated `Prefix` member directly in the the `Rule`
structure/XML tag is not supported, specified prefixes must be inside the
`Filter` structure/XML tag.
**GetBucketVersioning:** Stub implementation which always returns "versionning not enabled", since Garage does not yet support bucket versionning.
**GetBucketVersioning:** Stub implementation which always returns "versioning not enabled", since Garage does not yet support bucket versioning.
### Replication endpoints
@@ -155,7 +155,7 @@ Please open an issue if you have a use case for replication.
*Note: Ceph documentation briefly says that Ceph supports
[replication through the S3 API](https://docs.ceph.com/en/latest/radosgw/multisite-sync-policy/#s3-replication-api)
but with some limitations.
Additionaly, replication endpoints are not documented in the S3 compatibility page so I don't know what kind of support we can expect.*
Additionally, replication endpoints are not documented in the S3 compatibility page so I don't know what kind of support we can expect.*
### Locking objects
@@ -197,7 +197,7 @@ Please open an issue if you have a use case.
### Vendor specific endpoints
<details><summary>Display Amazon specifc endpoints</summary>
<details><summary>Display Amazon specific endpoints</summary>
| Endpoint | Garage | [Openstack Swift](https://docs.openstack.org/swift/latest/s3_compat.html) | [Ceph Object Gateway](https://docs.ceph.com/en/latest/radosgw/s3/) | [Riak CS](https://docs.riak.com/riak/cs/2.1.1/references/apis/storage/s3/index.html) | [OpenIO](https://docs.openio.io/latest/source/arch-design/s3_compliancy.html) |
@@ -234,4 +234,3 @@ Please open an issue if you have a use case.
| [SelectObjectContent](https://docs.aws.amazon.com/AmazonS3/latest/API/API_SelectObjectContent.html) | ❌ Missing | ❌| ❌| ❌| ❌|
</details>
@@ -3,7 +3,7 @@ title = "S3 compatibility target"
weight = 5
+++
If there is a specific S3 functionnality you have a need for, feel free to open
If there is a specific S3 functionality you have a need for, feel free to open
a PR to put the corresponding endpoints higher in the list. Please explain
your motivations for doing so in the PR message.
+2 -2
View File
@@ -68,7 +68,7 @@ Workflow for DELETE:
1. Check write permission (LDAP)
2. Get current version (or versions) in object table
3. Do the deletion of those versions NOT IN A BACKGROUND JOB THIS TIME
4. Return succes to the user if we were able to delete blocks from the blocks table and entries from the object table
4. Return success to the user if we were able to delete blocks from the blocks table and entries from the object table
To delete a version:
@@ -92,7 +92,7 @@ Known issue: if someone is reading from a version that we want to delete and the
- file path = /meta/(first 3 hex digits of hash)/(rest of hash)
- map block hash -> set of version UUIDs where it is referenced
Usefull metadata:
Useful metadata:
- list of versions that reference this block in the Casandra table, so that we can do GC by checking in Cassandra that the lines still exist
- list of other nodes that we know have acknowledged a write of this block, useful in the rebalancing algorithm
+3 -3
View File
@@ -49,12 +49,12 @@ The ring construction that selects `n_token` random positions for each nodes giv
is not well-balanced: the space between the tokens varies a lot, and some partitions are thus bigger than others.
This problem was demonstrated in the original Dynamo DB paper.
To solve this, we want to apply a better second method for partitionning our dataset:
To solve this, we want to apply a better second method for partitioning our dataset:
1. fix an initially large number of partitions (say 1024) with evenly-spaced delimiters,
2. attribute each partition randomly to a node, with a probability
proportionnal to its capacity (which `n_tokens` represented in the first
proportional to its capacity (which `n_tokens` represented in the first
method)
For now we continue using the multi-DC ring walking described above.
@@ -66,7 +66,7 @@ I have studied two ways to do the attribution of partitions to nodes, in a way t
MagLev provided significantly better balancing, as it guarantees that the exact
same number of partitions is attributed to all nodes that have the same
capacity (and that this number is proportionnal to the node's capacity, except
capacity (and that this number is proportional to the node's capacity, except
for large values), however in both cases:
- the distribution is still bad, because we use the naive multi-DC ring walking
+1 -1
View File
@@ -19,7 +19,7 @@ The migration steps are as follows:
2. Disable API and web access. Garage does not support disabling
these endpoints but you can change the port number or stop your reverse
proxy for instance.
3. Check once again that your cluster is healty. Run again `garage repair --all-nodes --yes tables` which is quick.
3. Check once again that your cluster is healthy. Run again `garage repair --all-nodes --yes tables` which is quick.
Also check your queues are empty, run `garage stats` to query them.
4. Turn off Garage v0.6
5. Backup the metadata folder of all your nodes: `cd /var/lib/garage ; tar -acf meta-v0.6.tar.zst meta/`
@@ -28,11 +28,11 @@ We should try to test in least invasive ways, i.e. minimize the impact of the te
- Not making `garage` a shared library (launch using `execve`, it's perfectly fine)
Instead, we should focus on building a clean outer interface for the `garage` binary,
for example loading configuration using environnement variables instead of the configuration file if that's helpfull for writing the tests.
for example loading configuration using environment variables instead of the configuration file if that's helpful for writing the tests.
There are two reasons for this:
- Keep the soure code clean and focused
- Keep the source code clean and focused
- Test something that is as close as possible as the true garage that will actually be running
Reminder: rules of simplicity, concerning changes to Garage's source code.
@@ -71,5 +71,3 @@ Interesting blog posts on the blog of the Sled database:
Misc:
- [mutagen](https://github.com/llogiq/mutagen) - mutation testing is a way to assert our test quality by mutating the code and see if the mutation makes the tests fail
- [fuzzing](https://rust-fuzz.github.io/book/) - cargo supports fuzzing, it could be a way to test our software reliability in presence of garbage data.
+5 -5
View File
@@ -176,7 +176,7 @@ Returns the cluster's current health in JSON format, with the following variable
- degraded: Garage node is not connected to all storage nodes, but a quorum of write nodes is available for all partitions
- unavailable: a quorum of write nodes is not available for some partitions
- `knownNodes`: the number of nodes this Garage node has had a TCP connection to since the daemon started
- `connectedNodes`: the nubmer of nodes this Garage node currently has an open connection to
- `connectedNodes`: the number of nodes this Garage node currently has an open connection to
- `storageNodes`: the number of storage nodes currently registered in the cluster layout
- `storageNodesOk`: the number of storage nodes to which a connection is currently open
- `partitions`: the total number of partitions of the data (currently always 256)
@@ -379,7 +379,7 @@ Example response:
]
```
#### GetKeyInfo `GET /v2/GetKeyInfo?id=<acces key id>`
#### GetKeyInfo `GET /v2/GetKeyInfo?id=<access key id>`
#### GetKeyInfo `GET /v2/GetKeyInfo?search=<pattern>`
Returns information about the requested API access key.
@@ -388,7 +388,7 @@ If `id` is set, the key is looked up using its exact identifier (faster).
If `search` is set, the key is looked up using its name or prefix
of identifier (slower, all keys are enumerated to do this).
Optionnally, the query parameter `showSecretKey=true` can be set to reveal the
Optionally, the query parameter `showSecretKey=true` can be set to reveal the
associated secret access key.
Example response:
@@ -487,7 +487,7 @@ Request body format:
This returns the key info in the same format as the result of GetKeyInfo.
#### UpdateKey `POST /v2/UpdateKey?id=<acces key id>`
#### UpdateKey `POST /v2/UpdateKey?id=<access key id>`
Updates information about the specified API access key.
@@ -509,7 +509,7 @@ The possible flags in `allow` and `deny` are: `createBucket`.
This returns the key info in the same format as the result of GetKeyInfo.
#### DeleteKey `POST /v2/DeleteKey?id=<acces key id>`
#### DeleteKey `POST /v2/DeleteKey?id=<access key id>`
Deletes an API access key.
+6 -6
View File
@@ -35,7 +35,7 @@ Triples in K2V are constituted of three fields:
partition key in which the client wants to read/delete lists of items
- a sort key (`sk`), an utf8 string that defines the index of the triplet inside its
partition; triplets are uniquely idendified by their partition key + sort key
partition; triplets are uniquely identified by their partition key + sort key
- a value (`v`), an opaque binary blob associated to the partition key + sort key;
they are transmitted as binary when possible but in most case in the JSON API
@@ -74,7 +74,7 @@ are obsoleted by the new write.
**Basic insertion.** To insert a new value `v4` with context `[(node1, t2), (node2, t3)]`, in a
simple case where there was no insertion in-between reading the value
mentionned above and writing `v4`, and supposing that node2 receives the
mentioned above and writing `v4`, and supposing that node2 receives the
InsertItem query:
- `node2` generates a timestamp `t4` such that `t4 > t3`.
@@ -332,7 +332,7 @@ Inserts a single item. This request does not use JSON, the body is sent directly
To supersede previous values, the HTTP header `X-Garage-Causality-Token` should
be set to the causality token returned by a previous read on this key. This
header can be ommitted for the first writes to the key.
header can be omitted for the first writes to the key.
Example query:
@@ -397,7 +397,7 @@ smallest partition key that exists. It returns partition keys in increasing
order, or decreasing order if `reverse` is set to `true`,
and stops when either of the following conditions is met:
1. if `end` is specfied, the partition key `end` is reached or surpassed (if it
1. if `end` is specified, the partition key `end` is reached or surpassed (if it
is reached exactly, it is not included in the result)
2. if `limit` is specified, `limit` partition keys have been listed
@@ -491,7 +491,7 @@ the triplet is inserted for the first time, the causality token should be set to
The value is expected to be a base64-encoded binary blob. The value `null` can
also be used to delete the triplet while preserving causality information: this
allows to know if a delete has happenned concurrently with an insert, in which
allows to know if a delete has happened concurrently with an insert, in which
case both are preserved and returned on reads (see below).
Partition keys and sort keys are utf8 strings which are stored sorted by
@@ -540,7 +540,7 @@ JSON struct with the following fields:
For each of the searches, triplets are listed and returned separately. The
semantics of `prefix`, `start`, `end`, `limit` and `reverse` are the same as for ReadIndex. The
additionnal parameter `singleItem` allows to get a single item, whose sort key
additional parameter `singleItem` allows to get a single item, whose sort key
is the one given in `start`. Parameters `conflictsOnly` and `tombstones`
control additional filters on the items that are returned.
+1 -1
View File
@@ -59,7 +59,7 @@ To link the effective storage capacity of the cluster to partition assignment, w
\end{equation}
This assumption is justified by the dispersion of the hashing function, when the number of partitions is small relative to the number of stored blocks.
Every node $n$ wille store some number $p_n$ of partitions (it is the number of partitions $p$ such that $n$ appears in the $\alpha_p$). Hence the partitions stored by $n$ (and hence all partitions by our assumption) have there size bounded by $c_n/p_n$. This remark leads us to define the optimal size that we will want to maximize:
Every node $n$ will store some number $p_n$ of partitions (it is the number of partitions $p$ such that $n$ appears in the $\alpha_p$). Hence the partitions stored by $n$ (and hence all partitions by our assumption) have there size bounded by $c_n/p_n$. This remark leads us to define the optimal size that we will want to maximize:
\begin{equation}
\label{eq:optimal}
+10 -10
View File
@@ -38,7 +38,7 @@ We would like to compute an assignment of nodes to partitions. We will impose so
\end{equation}
This assumption is justified by the dispersion of the hashing function, when the number of partitions is small relative to the number of stored large objects.
Every node $n$ wille store some number $k_n$ of partitions. Hence the partitions stored by $n$ (and hence all partitions by our assumption) have there size bounded by $c_n/k_n$. This remark leads us to define the optimal size that we will want to maximize:
Every node $n$ will store some number $k_n$ of partitions. Hence the partitions stored by $n$ (and hence all partitions by our assumption) have there size bounded by $c_n/k_n$. This remark leads us to define the optimal size that we will want to maximize:
\begin{equation}
\label{eq:optimal}
@@ -62,7 +62,7 @@ For now, in the following, we ask the following redundancy constraint:
\textbf{Mode 3:} every partition needs to be assignated to three nodes. We try to spread the three nodes over different zones as much as possible.
\textbf{Warning:} This is a working document written incrementaly. The last version of the algorithm is the \textbf{parametric assignment} described in the next section.
\textbf{Warning:} This is a working document written incrementally. The last version of the algorithm is the \textbf{parametric assignment} described in the next section.
\section{Computation of a parametric assignment}
@@ -318,7 +318,7 @@ $$
$$
which is the universal upper bound on $s^*$. Hence any optimal utilization $(n_v)$ can be modified to another optimal utilization such that $n_v\ge \hat{n}_v$
Because $z_0$ cannot store more than $N$ partition occurences, in any assignment, at least $2N$ partitions must be assignated to the zones $Z\setminus\{z_0\}$. Let $C_0 = C-c_{z_0}$. Suppose that there exists a zone $z_1\neq z_0$ such that $c_{z_1}/C_0 \ge 1/2$. Then, with the same argument as for $z_0$, we can define
Because $z_0$ cannot store more than $N$ partition occurrences, in any assignment, at least $2N$ partitions must be assignated to the zones $Z\setminus\{z_0\}$. Let $C_0 = C-c_{z_0}$. Suppose that there exists a zone $z_1\neq z_0$ such that $c_{z_1}/C_0 \ge 1/2$. Then, with the same argument as for $z_0$, we can define
$$\hat{n}_v = \left\lfloor\frac{c_v}{c_{z_1}}N\right\rfloor$$
for every $v\in z_1$.
@@ -351,7 +351,7 @@ Define $3N$ tokens $t_1,\ldots, t_{3N}\in V$ as follows:
Then for $1\le i \le N$, define the triplet $T_i$ to be
$(t_i, t_{i+N}, t_{i+2N})$. Since the same nodes of a zone appear contiguously, the three nodes of a triplet must belong to three distinct zones.
However simple, this solution to go from an utilization to an assignment has the drawback of not spreading the triplets: a node will tend to be associated to the same two other nodes for many partitions. Hence, during data transfer, it will tend to use only two link, instead of spreading the bandwith use over many other links to other nodes. To achieve this goal, we will reframe the search of an assignment as a flow problem. and in the flow algorithm, we will introduce randomness in the order of exploration. This will be sufficient to obtain a good dispersion of the triplets.
However simple, this solution to go from an utilization to an assignment has the drawback of not spreading the triplets: a node will tend to be associated to the same two other nodes for many partitions. Hence, during data transfer, it will tend to use only two link, instead of spreading the bandwidth use over many other links to other nodes. To achieve this goal, we will reframe the search of an assignment as a flow problem. and in the flow algorithm, we will introduce randomness in the order of exploration. This will be sufficient to obtain a good dispersion of the triplets.
\begin{figure}
\centering
@@ -436,7 +436,7 @@ T_3=(b,c,d').
$$
One can check that in this case, it is impossible to minimize both the number of zone and node changes.
Because of the redundancy constraint, we cannot use a greedy algorithm to just replace nodes in the triplets to try to get the new utilization rate: this could lead to blocking situation where there is still a hole to fill in a triplet but no available node satisfies the zone separation constraint. To circumvent this issue, we propose an algorithm based on finding cycles in a graph encoding of the assignment. As in section \ref{sec:opt_assign}, we can explore the neigbours in a random order in the graph algorithms, to spread the triplets distribution.
Because of the redundancy constraint, we cannot use a greedy algorithm to just replace nodes in the triplets to try to get the new utilization rate: this could lead to blocking situation where there is still a hole to fill in a triplet but no available node satisfies the zone separation constraint. To circumvent this issue, we propose an algorithm based on finding cycles in a graph encoding of the assignment. As in section \ref{sec:opt_assign}, we can explore the neighbours in a random order in the graph algorithms, to spread the triplets distribution.
\subsubsection{Minimizing the zone discrepancy}
@@ -550,8 +550,8 @@ We give some considerations of worst case complexity for these algorithms. In th
Algorithm \ref{alg:util} can be implemented with complexity $O(\#V^2)$. The complexity of the function call at line \ref{lin:subutil} is $O(\#V)$. The difference between the sum of the subutilizations and $3N$ is at most the sum of the rounding errors when computing the $\hat{n}_v$. Hence it is bounded by $\#V$ and the loop at line \ref{lin:loopsub} is iterated at most $\#V$ times. Finding the minimizing $v$ at line \ref{lin:findmin} takes $O(\#V)$ operations (naively, we could also use a heap).
Algorithm \ref{alg:opt} can be implemented with complexity $O(N^3\times \#Z)$. The flow graph has $O(N+\#Z)$ vertices and $O(N\times \#Z)$ edges. Dinic's algorithm has complexity $O(\#\mathrm{Vertices}^2\#\mathrm{Edges})$ hence in our case it is $O(N^3\times \#Z)$.
Algorithm \ref{alg:mini} can be implented with complexity $O(N^3\# Z)$ under \eqref{hyp:A} and $O(N^3 \#Z \#V)$ under \eqref{hyp:B}.
Algorithm \ref{alg:mini} can be implemented with complexity $O(N^3\# Z)$ under \eqref{hyp:A} and $O(N^3 \#Z \#V)$ under \eqref{hyp:B}.
The graph $G_T$ has $O(N)$ vertices and $O(N\times \#Z)$ edges under assumption \eqref{hyp:A} and respectively $O(N\times \#Z)$ vertices and $O(N\times \#V)$ edges under assumption \eqref{hyp:B}. The loop at line \ref{lin:repeat} is iterated at most $N$ times since the distance between $T$ and $T'$ decreases at every iteration. Bellman-Ford algorithm has complexity $O(\#\mathrm{Vertices}\#\mathrm{Edges})$, which in our case amounts to $O(N^2\# Z)$ under \eqref{hyp:A} and $O(N^2 \#Z \#V)$ under \eqref{hyp:B}.
\begin{algorithm}
@@ -637,7 +637,7 @@ We try to maximize $s^*$ defined in \eqref{eq:optimal}. So we can compute the op
\subsection{Computation of a candidate assignment}
To compute a candidate assignment (that does not optimize zone spreading nor distance to a previous assignment yet), we can use the folowing flow problem.
To compute a candidate assignment (that does not optimize zone spreading nor distance to a previous assignment yet), we can use the following flow problem.
Define the oriented weighted graph $(X,E)$. The set of vertices $X$ contains the source $\mathbf{s}$, the sink $\mathbf{t}$, vertices
$\mathbf{x}_p, \mathbf{u}^+_p, \mathbf{u}^-_p$ for every partition $p$, vertices $\mathbf{y}_{p,z}$ for every partition $p$ and zone $z$, and vertices $\mathbf{z}_v$ for every node $v$.
@@ -680,14 +680,14 @@ Given the flow $f$, let $G_f=(X',E_f)$ be the multi-graph where $X' = X\setminus
\end{itemize}
To summarize, arcs are oriented left to right if they correspond to a presence of flow in $f$, and right to left if they correspond to an absence of flow. They are positively weighted if we want them to stay at their current state, and negatively if we want them to switch. Let us compute the weight of such graph.
\begin{multline*}
\begin{multiline*}
w(G_f) = \sum_{e\in E_f} w(e_f) \\
=
(\alpha - \beta -\gamma) N_1 + (\alpha +\beta - \gamma) N_2 + (\alpha+\beta+\gamma) N_3
\\ +
\#V\times N - 4 \sum_p 3-\#(T_p\cap T'_p) \\
=(\#V-12+\alpha-\beta-\gamma)\times N + 4Q_V + 2\beta N_2 + 2(\beta+\gamma) N_3 \\
\end{multline*}
\end{multiline*}
As for the mode 3-strict, one can check that the difference of two such graphs corresponding to the same $(n_v)$ is always eulerian. Hence we can navigate in this class with the same greedy algorithm that discovers positive cycles and flips them.
+18
View File
@@ -0,0 +1,18 @@
*
!*.txt
!*.md
!assets
!.gitignore
!*.svg
!*.png
!*.jpg
!*.tex
!Makefile
!.gitignore
!assets/*.drawio.pdf
talk.{nav,out,snm,toc,aux,log}
!talk.pdf
+3
View File
@@ -0,0 +1,3 @@
talk.pdf: talk.tex
pdflatex talk.tex
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

+330
View File
@@ -0,0 +1,330 @@
%\nonstopmode
\documentclass[aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
% \usepackage[frenchb]{babel}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{breqn}
\usepackage{multirow}
\usetheme{boxes}
\usepackage{graphicx}
%\useoutertheme[footline=authortitle,subsection=false]{miniframes}
\beamertemplatenavigationsymbolsempty
\definecolor{TitleOrange}{RGB}{255,137,0}
\setbeamercolor{title}{fg=TitleOrange}
\setbeamercolor{frametitle}{fg=TitleOrange}
\definecolor{ListOrange}{RGB}{255,145,5}
\setbeamertemplate{itemize item}{\color{ListOrange}$\blacktriangleright$}
\definecolor{verygrey}{RGB}{70,70,70}
\setbeamercolor{normal text}{fg=verygrey}
\usepackage{tabu}
\usepackage{multicol}
\usepackage{vwcol}
\usepackage{stmaryrd}
\usepackage{graphicx}
\usepackage[normalem]{ulem}
\title{Garage Object Storage: 2.0 update and best practices}
\subtitle{a new storage platform for self-hosted geo-distributed clusters}
\author{Maximilien Richer, Deuxfleurs}
\date{FOSDEM '26}
\begin{document}
\begin{frame}
\centering
\includegraphics[width=.3\linewidth]{../../sticker/Garage.pdf}
\vspace{1em}
{\large\bf Maximilien Richer, Deuxfleurs}
\vspace{1em}
\url{https://garagehq.deuxfleurs.fr/}
Matrix channel: \texttt{\#garage:deuxfleurs.fr}
\end{frame}
\begin{frame}
\frametitle{Our objective at Deuxfleurs}
\begin{center}
French association promoting digital sovereignty and privacy\\
through self-hosting hosting \textbf{as an alternative to large cloud providers}
\end{center}
\vspace{2em}
\vspace{2em}
\begin{center}
\textbf{This requires \underline{resilience}}\\
{\footnotesize (we want good uptime/availability with low supervision)}
\end{center}
\end{frame}
\begin{frame}
\frametitle{But what is Garage, exactly?}
\textbf{Garage is a self-hosted drop-in replacement for the Amazon S3 object store}\\
\vspace{.5em}
that implements resilience through geographical redundancy on commodity hardware
\begin{center}
\includegraphics[width=.8\linewidth]{assets/garageuses.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{What makes Garage different?}
\textbf{Coordination-free:}
\vspace{2em}
\begin{itemize}
\item No Raft or Paxos
\vspace{1em}
\item Internal data types are CRDTs
\vspace{1em}
\item All nodes are equivalent (no master/leader/index node)
\end{itemize}
\vspace{2em}
$\to$ less sensitive to higher latencies between nodes
\end{frame}
\begin{frame}
\frametitle{What makes Garage different?}
\begin{center}
TODO update with latest garage and minio versions
\includegraphics[width=.9\linewidth]{assets/endpoint-latency-dc.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{What makes Garage different?}
\textbf{Consistency model:}
\vspace{2em}
\begin{itemize}
\item Not ACID (not required by S3 spec) / not linearizable
\vspace{1em}
\item \textbf{Read-after-write consistency}\\
{\footnotesize (stronger than eventual consistency)}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{What makes Garage different?}
\textbf{Location-aware:}
\vspace{2em}
\begin{center}
\includegraphics[width=\linewidth]{assets/location-aware.png}
\end{center}
\vspace{2em}
Garage replicates data on different zones when possible
\end{frame}
\begin{frame}
\frametitle{What makes Garage different?}
\begin{center}
\includegraphics[width=.8\linewidth]{assets/map.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{An ever-increasing compatibility list}
\begin{center}
\includegraphics[width=.7\linewidth]{assets/compatibility.png}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Version history and roadmap}
\begin{itemize}
\item v0.3: initial beta release (2021)
\item v0.7: first released version (2022)
\item v1.0: stable release (2024), will be deprecated in summer 2026 1y after v2.0 was released
\item v2.0: stable release (2025)
\begin{itemize}
\item new HTTP admin API
\item reworded replication configuration: \texttt{replication\_mode} changed to \texttt{replication\_factor} \& \texttt{consistency\_policy}
\end{itemize}
\item
\end{itemize}
\begin{center}
v3.0: TBA may include versionning support, tag on buckets and objets, retention policies...
\end{center}
\end{frame}
\begin{frame}
\centering
{\large\bf Best practices for Garage deployments}
\end{frame}
\begin{frame}
\frametitle{Things you should know}
\begin{itemize}
\item no TLS support, use your own proxy
\item no anonymous access (use website endpoint)
\item you need to assign roles to nodes manually
\item the replication factor cannot be changed easily
\item the default region is \texttt{garage} and not \texttt{us-east-1}
\item only use the \texttt{degraded} consistency policy for data recovery!
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{What hardware should I use?}
\begin{itemize}
\item do NOT use network file storage (NFS, SMB, etc.) for \texttt{\/metadata}
\item get a \textbf{write-intensive flash disk} for the \texttt{\/metadata} folder
\item set \texttt{metadata} on a RAID1 if possible, with a COW filesystem (e.g. Btrfs or ZFS)
\item get large HDDs for the \texttt{\/data} folder
\item use XFS and garage multi-hdd mode for best performance
\item you can use a RAID for data but you'll leave a lot of performance on the table
\end{itemize}
\center\textit{Garage doesn't require a powerful CPUs nor much RAM, but your performance will depend on your disks!}
\end{frame}
\begin{frame}
\frametitle{Picking a metadata engine}
All files-to-block mappings are stored in the metadata engine, including bucket and object metadata. Files below 3KB are stored directly in the metadata engine.
\vspace{1em}
\begin{itemize}
\item Sled: removed in 1.x, move to SQLite or LMDB
\item \textbf{SQLite}: safer, \textbf{recommended for small clusters and single-node}
\item LMDB: faster, recommended for large clusters with metadata redundancy
\begin{itemize}
\item Warning: limited to 480 bytes per key with LMDB (not an issue in practice)
\end{itemize}
\item Fjall: experimental but promising rust-native engine, test it and let us know!
\end{itemize}
\center{Metadata engine can be set node per node, and changed later with a migration tool}
\end{frame}
\begin{frame}
\frametitle{Single-node deployment}
\begin{itemize}
\item garage was initially designed for multi-node deployments
\item single-node deployments are possible, but you will lose resilience
\item \textbf{If you do please ensure you have backups} (especially for metadata)
\begin{itemize}
\item set up \texttt{metadata\_auto\_snapshot\_interval}
\end{itemize}
\item use sqlite to minimize data loss risks on powercuts
\item or use a UPS!
\end{itemize}
\vspace{1em}
Use \texttt{github.com/bikeshedder/garage-single-node} for an easy single-node setup!
\end{frame}
\begin{frame}
\frametitle{Multi-node deployment}
\begin{itemize}
\item try to have geo-distributed zones
\item multiple nodes per zone to add more capacity
\item at least 3 zones for best resilience
\item keep in mind your available network and IO bandwidth
\item \textbf{Rebalancing a cluster can take multiple weeks with large HDDs and slow network links}
\item monitor your nodes with Prometheus + Grafana
\end{itemize}
\center{Deuxfleurs has been running a 9TB (3TB usable) 8-nodes cluster (3+3+2) over retail fiber (10ms site-to-site latency) for close to 5 years now. We heard there are petabyte clusters out there!}
\end{frame}
\begin{frame}
\frametitle{Deploying and administering garage at scale}
\begin{itemize}
\item deploy with your favorite tool (eg. Ansible) and system manager (eg. systemd)
\item or use Docker, docker-compose, Kubernetes or Nomad
\item Kubernetes and Consul are supported for node-to-node discovery
\begin{itemize}
\item you'll still have to manage the layout manually!
\end{itemize}
\item use gateway nodes to optimize network usage
\item ajust \texttt{resync-tranquility} and \texttt{scrub-tranquility} to your ressources
\end{itemize}
\center{Kubernetes storage controller: \texttt{github.com/bmarinov/garage-storage-controller}}
\end{frame}
\begin{frame}
\frametitle{Community UI available!}
\begin{center}
\includegraphics[width=0.9\linewidth]{assets/community-ui.png}\\
\vspace{-1em}
\url{https://github.com/khairul169/garage-webui}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Official Embedded UI comming later this year!}
\begin{center}
\includegraphics[width=0.9\linewidth]{assets/Garage Web Admin - Dashboard@2x.png}\\
\vspace{-1em}
\end{center}
\end{frame}
\begin{frame}
\frametitle{Official Embedded UI comming this year!}
\begin{center}
\includegraphics[width=0.9\linewidth]{assets/Garage Web Admin - Bucket details page@2x.png}\\
\vspace{-1em}
\end{center}
\end{frame}
\begin{frame}
\frametitle{How to make sense of garage metrics?}
\begin{center}
\includegraphics[width=0.7\linewidth]{assets/garage-stats.png}\\
\vspace{-1em}
\end{center}
\end{frame}
\begin{frame}
\frametitle{What if things go wrong?}
\begin{itemize}
\item set logs to debug with \texttt{RUST_LOG=garage_api_common=debug,garage_api_s3=debug,garage=debug}
\item auth issues: check your reverse proxy configuration
\item slow resync: check your network and disk IO usage, and \texttt{resync-tranquility} worker configuration
\item big LMDB database: stop garage and compact with \texttt{mdb\_copy -c}
\item ask us on matrix \texttt{\#garage:deuxfleurs.fr} or open an issue on git.deuxfleurs.fr!
\begin{itemize}
\item provide the output of \texttt{garage status}, \texttt{garage stats} and relevant metrics and logs
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Moving from Minio}
\begin{itemize}
\item list your buckets and your keys
\item create buckets and keys on the garage cluster
\begin{itemize}
\item you cannot import non-garage keys yet, patch to come soon!
\end{itemize}
\item loop over buckets, copy with rclone
\begin{itemize}
\item see doc \url{https://garagehq.deuxfleurs.fr/documentation/connect/cli/}
\end{itemize}
\item blog post coming soon!
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Demo time!}
\end{frame}
\begin{frame}
\frametitle{Get Garage now!}
\begin{center}
\includegraphics[width=.3\linewidth]{../../logo/garage_hires.png}\\
\vspace{-1em}
\url{https://garagehq.deuxfleurs.fr/}\\
Matrix channel: \texttt{\#garage:deuxfleurs.fr}
\vspace{2em}
\includegraphics[width=.09\linewidth]{assets/rust_logo.png}
\includegraphics[width=.2\linewidth]{assets/AGPLv3_Logo.png}
\end{center}
\end{frame}
\end{document}
%% vim: set ts=4 sw=4 tw=0 noet spelllang=fr :
Generated
+12 -11
View File
@@ -12,16 +12,17 @@
"original": {
"owner": "ipetkov",
"repo": "crane",
"rev": "6fe74265bbb6d016d663b1091f015e2976c4a527",
"type": "github"
}
},
"flake-compat": {
"locked": {
"lastModified": 1717312683,
"narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=",
"lastModified": 1761640442,
"narHash": "sha256-AtrEP6Jmdvrqiv4x2xa5mrtaIp3OEe8uBYCDZDS+hu8=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea",
"rev": "4a56054d8ffc173222d09dad23adf4ba946c8884",
"type": "github"
},
"original": {
@@ -50,17 +51,17 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1747825515,
"narHash": "sha256-BWpMQymVI73QoKZdcVCxUCCK3GNvr/xa2Dc4DM1o2BE=",
"lastModified": 1763977559,
"narHash": "sha256-g4MKqsIRy5yJwEsI+fYODqLUnAqIY4kZai0nldAP6EM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cd2812de55cf87df88a9e09bf3be1ce63d50c1a6",
"rev": "cfe2c7d5b5d3032862254e68c37a6576b633d632",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cd2812de55cf87df88a9e09bf3be1ce63d50c1a6",
"rev": "cfe2c7d5b5d3032862254e68c37a6576b633d632",
"type": "github"
}
},
@@ -80,17 +81,17 @@
]
},
"locked": {
"lastModified": 1738549608,
"narHash": "sha256-GdyT9QEUSx5k/n8kILuNy83vxxdyUfJ8jL5mMpQZWfw=",
"lastModified": 1763952169,
"narHash": "sha256-+PeDBD8P+NKauH+w7eO/QWCIp8Cx4mCfWnh9sJmy9CM=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "35c6f8c4352f995ecd53896200769f80a3e8f22d",
"rev": "ab726555a9a72e6dc80649809147823a813fa95b",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "35c6f8c4352f995ecd53896200769f80a3e8f22d",
"rev": "ab726555a9a72e6dc80649809147823a813fa95b",
"type": "github"
}
},
+15 -6
View File
@@ -2,16 +2,17 @@
description =
"Garage, an S3-compatible distributed object store for self-hosted deployments";
# Nixpkgs 25.05 as of 2025-05-22
# Nixpkgs 25.05 as of 2025-11-24
inputs.nixpkgs.url =
"github:NixOS/nixpkgs/cd2812de55cf87df88a9e09bf3be1ce63d50c1a6";
"github:NixOS/nixpkgs/cfe2c7d5b5d3032862254e68c37a6576b633d632";
# Rust overlay as of 2025-02-03
# Rust overlay as of 2025-11-24
inputs.rust-overlay.url =
"github:oxalica/rust-overlay/35c6f8c4352f995ecd53896200769f80a3e8f22d";
"github:oxalica/rust-overlay/ab726555a9a72e6dc80649809147823a813fa95b";
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
inputs.crane.url = "github:ipetkov/crane";
# Crane as of 2025-01-24
inputs.crane.url = "github:ipetkov/crane/6fe74265bbb6d016d663b1091f015e2976c4a527";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-utils.url = "github:numtide/flake-utils";
@@ -30,6 +31,10 @@
inherit system nixpkgs crane rust-overlay extraTestEnv;
release = false;
}).garage-test;
lints = (compile {
inherit system nixpkgs crane rust-overlay;
release = false;
});
in
{
packages = {
@@ -56,9 +61,13 @@
tests-fjall = testWith {
GARAGE_TEST_INTEGRATION_DB_ENGINE = "fjall";
};
# lints (fmt, clippy)
fmt = lints.garage-cargo-fmt;
clippy = lints.garage-cargo-clippy;
};
# ---- developpment shell, for making native builds only ----
# ---- development shell, for making native builds only ----
devShells =
let
targets = compile {
+1 -1
View File
@@ -167,7 +167,7 @@ let
</ul></p>
<p> Sources:
<ul>
<li><a href="https://git.deuxfleurs.fr/Deuxfleurs/garage/src/${r.type}/${x.version}">gitea</a></li>
<li><a href="https://git.deuxfleurs.fr/Deuxfleurs/garage/src/${r.type}/${x.version}">Forgejo</a></li>
<li><a href="https://git.deuxfleurs.fr/Deuxfleurs/garage/archive/${x.version}.zip">.zip</a></li>
<li><a href="https://git.deuxfleurs.fr/Deuxfleurs/garage/archive/${x.version}.tar.gz">.tar.gz</a></li>
</ul></p>
+12 -1
View File
@@ -48,7 +48,7 @@ let
inherit (pkgs) lib stdenv;
toolchainFn = (p: p.rust-bin.stable."1.82.0".default.override {
toolchainFn = (p: p.rust-bin.stable."1.91.0".default.override {
targets = lib.optionals (target != null) [ rustTarget ];
extensions = [
"rust-src"
@@ -190,4 +190,15 @@ in rec {
pkgs.cacert
];
} // extraTestEnv);
# ---- source code linting ----
garage-cargo-fmt = craneLib.cargoFmt (commonArgs // {
cargoExtraArgs = "";
});
garage-cargo-clippy = craneLib.cargoClippy (commonArgs // {
cargoArtifacts = garage-deps;
cargoClippyExtraArgs = "--all-targets -- -D warnings";
});
}
+2 -2
View File
@@ -2,8 +2,8 @@ apiVersion: v2
name: garage
description: S3-compatible object store for small self-hosted geo-distributed deployments
type: application
version: 0.9.1
appVersion: "v2.1.0"
version: 0.9.3
appVersion: "v2.3.0"
home: https://garagehq.deuxfleurs.fr/
icon: https://garagehq.deuxfleurs.fr/images/garage-logo.svg
+3 -3
View File
@@ -1,6 +1,6 @@
# garage
![Version: 0.9.1](https://img.shields.io/badge/Version-0.9.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.1.0](https://img.shields.io/badge/AppVersion-v2.1.0-informational?style=flat-square)
![Version: 0.9.3](https://img.shields.io/badge/Version-0.9.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.3.0](https://img.shields.io/badge/AppVersion-v2.3.0-informational?style=flat-square)
S3-compatible object store for small self-hosted geo-distributed deployments
@@ -29,7 +29,7 @@ S3-compatible object store for small self-hosted geo-distributed deployments
| garage.dbEngine | string | `"lmdb"` | Can be changed for better performance on certain systems https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#db_engine |
| garage.existingConfigMap | string | `""` | if not empty string, allow using an existing ConfigMap for the garage.toml, if set, ignores garage.toml |
| garage.garageTomlString | string | `""` | String Template for the garage configuration if set, ignores above values. Values can be templated, see https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/ |
| garage.kubernetesSkipCrd | bool | `false` | Set to true if you want to use k8s discovery but install the CRDs manually outside of the helm chart, for example if you operate at namespace level without cluster ressources |
| garage.kubernetesSkipCrd | bool | `false` | Set to true if you want to use k8s discovery but install the CRDs manually outside of the helm chart, for example if you operate at namespace level without cluster resources |
| garage.replicationFactor | string | `"3"` | Default to 3 replicas, see the replication_factor section at https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#replication_factor |
| garage.consistencyMode | string | `"consistent"` | Default to read-after-write consistency, see the consistency_mode section at https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#consistency_mode |
| garage.metadataAutoSnapshotInterval | string | `""` | If this value is set, Garage will automatically take a snapshot of the metadata DB file at a regular interval and save it in the metadata directory. https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#metadata_auto_snapshot_interval |
@@ -76,7 +76,7 @@ S3-compatible object store for small self-hosted geo-distributed deployments
| persistence.enabled | bool | `true` | |
| persistence.meta.hostPath | string | `"/var/lib/garage/meta"` | |
| persistence.meta.size | string | `"100Mi"` | |
| podAnnotations | object | `{}` | additonal pod annotations |
| podAnnotations | object | `{}` | additional pod annotations |
| podSecurityContext.fsGroup | int | `1000` | |
| podSecurityContext.runAsGroup | int | `1000` | |
| podSecurityContext.runAsNonRoot | bool | `true` | |
+2 -2
View File
@@ -47,8 +47,8 @@ helm.sh/chart: {{ include "garage.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ with .Values.commonLabels }}
{{- toYaml . }}
{{- with .Values.commonLabels }}
{{- toYaml . | nindent 0 }}
{{- end }}
{{- end }}
@@ -5,9 +5,11 @@ metadata:
labels:
{{- include "garage.labels" . | nindent 4 }}
rules:
{{- if eq .Values.garage.kubernetesSkipCrd false }}
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get", "list", "watch", "create", "patch"]
{{ end }}
- apiGroups: ["deuxfleurs.fr"]
resources: ["garagenodes"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
@@ -25,4 +27,4 @@ subjects:
roleRef:
kind: ClusterRole
name: manage-crds-{{ .Release.Namespace }}-{{ .Release.Name }}
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
+6 -2
View File
@@ -13,7 +13,7 @@ data:
db_engine = "{{ .Values.garage.dbEngine }}"
block_size = {{ .Values.garage.blockSize }}
block_size = "{{ .Values.garage.blockSize }}"
replication_factor = {{ .Values.garage.replicationFactor }}
consistency_mode = "{{ .Values.garage.consistencyMode }}"
@@ -28,7 +28,11 @@ data:
# rpc_secret will be populated by the init container from a k8s secret object
rpc_secret = "__RPC_SECRET_REPLACE__"
bootstrap_peers = {{ .Values.garage.bootstrapPeers }}
bootstrap_peers = [
{{- range $index, $peer := .Values.garage.bootstrapPeers }}
{{- if $index}}, {{ end }}{{ $peer | quote }}
{{ end }}
]
{{- if .Values.garage.additionalTopLevelConfig }}
{{ .Values.garage.additionalTopLevelConfig | nindent 4 }}
+5 -1
View File
@@ -4,6 +4,10 @@ metadata:
name: {{ include "garage.fullname" . }}
labels:
{{- include "garage.labels" . | nindent 4 }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
ports:
@@ -37,4 +41,4 @@ spec:
name: metrics
selector:
{{- include "garage.selectorLabels" . | nindent 4 }}
{{- end }}
{{- end }}
+4 -1
View File
@@ -28,6 +28,9 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "garage.serviceAccountName" . }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
@@ -91,7 +94,7 @@ spec:
volumes:
- name: configmap
configMap:
name: {{ include "garage.fullname" . }}-config
name: {{ if .Values.garage.existingConfigMap }}{{ .Values.garage.existingConfigMap }}{{ else }}{{ include "garage.fullname" . }}-config{{ end }}
- name: etc
emptyDir: {}
{{- if .Values.persistence.enabled }}
+9 -3
View File
@@ -44,7 +44,7 @@ garage:
# -- This is not required if you use the integrated kubernetes discovery
bootstrapPeers: []
# -- Set to true if you want to use k8s discovery but install the CRDs manually outside
# of the helm chart, for example if you operate at namespace level without cluster ressources
# of the helm chart, for example if you operate at namespace level without cluster resources
kubernetesSkipCrd: false
s3:
api:
@@ -120,7 +120,7 @@ serviceAccount:
# If not set and create is true, a name is generated using the fullname template
name: ""
# -- additonal pod annotations
# -- additional pod annotations
podAnnotations: {}
podSecurityContext:
@@ -144,6 +144,8 @@ service:
# - NodePort (+ Ingress)
# - LoadBalancer
type: ClusterIP
# -- Annotations to add to the service
annotations: {}
s3:
api:
port: 3900
@@ -207,7 +209,7 @@ ingress:
# - kubernetes.docker.internal
resources: {}
# The following are indicative for a small-size deployement, for anything serious double them.
# The following are indicative for a small-size deployment, for anything serious double them.
# limits:
# cpu: 100m
# memory: 1024Mi
@@ -236,6 +238,10 @@ tolerations: []
affinity: {}
# -- Optional priority class name to assign to the pods.
# See https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
priorityClassName: ""
environment: {}
extraVolumes: {}
+3 -3
View File
@@ -127,7 +127,7 @@ They are due to the download being interrupted in the middle (^C during first la
Add `:force?` to the `cached-wget!` call in `daemon.clj` to re-download the binary,
or restar the VMs to clear temporary files.
### In `jepsen.garage`: prefix wierdness
### In `jepsen.garage`: prefix weirdness
In `store/garage set1/20231019T163358.615+0200`:
@@ -146,12 +146,12 @@ and passing all values that were previously in the context (creds and prefix) as
The reg2 test is our custom checker for CRDT read-after-write on individual object keys, acting as registers which can be updated.
The test fails without the timestamp fix, which is expected as the clock scrambler will prevent nodes from having a correct ordering of objects.
With the timestamp fix (`--patch tsfix1`), the happenned-before relationship should at least be respected, meaning that when a PutObject call starts
With the timestamp fix (`--patch tsfix1`), the happened-before relationship should at least be respected, meaning that when a PutObject call starts
after another PutObject call has ended, the second call should overwrite the value of the first call, and that value should not be
readable by future GetObject calls.
However, we observed inconsistencies even with the timestamp fix.
The inconsistencies seemed to always happenned after writing a nil value, which translates to a DeleteObject call
The inconsistencies seemed to always happened after writing a nil value, which translates to a DeleteObject call
instead of a PutObject. By removing the possibility of writing nil values, therefore only doing
PutObject calls, the issue disappears. There is therefore an issue to fix in DeleteObject.
+2 -2
View File
@@ -2,7 +2,7 @@
: '
This script tests whether uploaded parts can be skipped in a
CompleteMultipartUpoad
CompleteMultipartUpload
On Minio: yes, parts can be skipped
@@ -52,7 +52,7 @@
Conclusions:
- Skipping a part in a CompleteMultipartUpoad call is OK
- Skipping a part in a CompleteMultipartUpload call is OK
- The part is simply not included in the stored object
- Sequential part renumbering counts only non-skipped parts
'
+5 -2
View File
@@ -26,7 +26,7 @@ in
s3cmd
minio-client
rclone
(python312.withPackages (ps: [ ps.boto3 ]))
(python313.withPackages (ps: [ ps.boto3 ]))
socat
psmisc
@@ -34,8 +34,11 @@ in
openssl
curl
jq
typos
];
shellHook = ''
export AWS_REQUEST_CHECKSUM_CALCULATION='when_required'
function to_s3 {
AWS_REQUEST_CHECKSUM_CALCULATION=WHEN_REQUIRED AWS_RESPONSE_CHECKSUM_VALIDATION=WHEN_REQUIRED \
aws \
@@ -49,7 +52,7 @@ in
function to_docker {
executor \
--force \
--customPlatform="$(echo "''${DOCKER_PLATFORM}" | sed 's/i386/386/')" \
--custom-platform="$(echo "''${DOCKER_PLATFORM}" | sed 's/i386/386/')" \
--destination "$(echo "''${CONTAINER_NAME}" | sed 's/i386/386/'):''${CONTAINER_TAG}" \
--context dir://`pwd` \
--verbosity=debug
+6 -3
View File
@@ -1,6 +1,6 @@
[package]
name = "garage_api_admin"
version = "2.1.0"
version = "2.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -46,5 +46,8 @@ opentelemetry-prometheus = { workspace = true, optional = true }
prometheus = { workspace = true, optional = true }
[features]
metrics = [ "opentelemetry-prometheus", "prometheus" ]
k2v = [ "garage_model/k2v" ]
metrics = ["opentelemetry-prometheus", "prometheus"]
k2v = ["garage_model/k2v"]
[lints]
workspace = true
+3 -3
View File
@@ -143,7 +143,7 @@ impl RequestHandler for UpdateAdminTokenRequest {
garage: &Arc<Garage>,
_admin: &Admin,
) -> Result<UpdateAdminTokenResponse, Error> {
let mut token = get_existing_admin_token(&garage, &self.id).await?;
let mut token = get_existing_admin_token(garage, &self.id).await?;
apply_token_updates(&mut token, self.body)?;
@@ -164,7 +164,7 @@ impl RequestHandler for DeleteAdminTokenRequest {
garage: &Arc<Garage>,
_admin: &Admin,
) -> Result<DeleteAdminTokenResponse, Error> {
let token = get_existing_admin_token(&garage, &self.id).await?;
let token = get_existing_admin_token(garage, &self.id).await?;
garage
.admin_token_table
@@ -224,7 +224,7 @@ impl RequestHandler for GetCurrentAdminTokenInfoRequest {
}
let (prefix, _) = self.admin_token.split_once('.').unwrap();
let token = get_existing_admin_token(&garage, &prefix.to_string()).await?;
let token = get_existing_admin_token(garage, &prefix.to_string()).await?;
Ok(GetCurrentAdminTokenInfoResponse(admin_token_info_results(
&token, now,
+96 -5
View File
@@ -12,7 +12,7 @@ use garage_rpc::*;
use garage_model::garage::Garage;
use garage_api_common::{common_error::CommonError, helpers::is_default};
use garage_api_common::{common_error::CommonError, helpers::is_default, xml};
use crate::api_server::{find_matching_nodes, AdminRpc, AdminRpcResponse};
use crate::error::Error;
@@ -262,7 +262,7 @@ pub struct GetClusterHealthResponse {
pub status: String,
/// the number of nodes this Garage node has had a TCP connection to since the daemon started
pub known_nodes: usize,
/// the nubmer of nodes this Garage node currently has an open connection to
/// the number of nodes this Garage node currently has an open connection to
pub connected_nodes: usize,
/// the number of storage nodes currently registered in the cluster layout
pub storage_nodes: usize,
@@ -282,8 +282,34 @@ pub struct GetClusterHealthResponse {
pub struct GetClusterStatisticsRequest;
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct GetClusterStatisticsResponse {
// FIXME for v3: remove freeform field and move display logic to garage crate
/// cluster statistics as a free-form string, kept for compatibility with nodes
/// running older v2.x versions of garage
pub freeform: String,
// FIXME for v3: remove Option<> and serde(default) for all fields below
/// available storage space for object data in the entire cluster, in bytes
#[serde(default, skip_serializing_if = "Option::is_none")]
pub data_avail: Option<u64>,
/// available storage space for object metadata in the entire cluster, in bytes
#[serde(default, skip_serializing_if = "Option::is_none")]
pub metadata_avail: Option<u64>,
/// true if the available storage space statistics are imprecise due to missing
/// information of disconnected nodes. When this is the case, the actual
/// space available in the cluster might be lower than the reported values.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub incomplete_avail_info: Option<bool>,
/// number of buckets in the cluster
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bucket_count: Option<u64>,
/// total number of objects stored in all buckets
#[serde(default, skip_serializing_if = "Option::is_none")]
pub total_object_count: Option<u64>,
/// total size of objects stored in all buckets, before compression, deduplication and
/// replication (this is NOT equivalent to actual disk usage in the cluster)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub total_object_bytes: Option<u64>,
}
// ---- ConnectClusterNodes ----
@@ -387,7 +413,7 @@ pub struct UpdateAdminTokenRequestBody {
/// `GetClusterStatus`, etc), or the special value `*` to allow all
/// admin endpoints. **WARNING:** Granting a scope of `CreateAdminToken` or
/// `UpdateAdminToken` trivially allows for privilege escalation, and is thus
/// functionnally equivalent to granting a scope of `*`.
/// functionally equivalent to granting a scope of `*`.
pub scope: Option<Vec<String>>,
}
@@ -841,11 +867,18 @@ pub struct GetBucketInfoResponse {
pub created: DateTime<Utc>,
/// List of global aliases for this bucket
pub global_aliases: Vec<String>,
/// Whether website acces is enabled for this bucket
/// Whether website access is enabled for this bucket
pub website_access: bool,
#[serde(default)]
/// Website configuration for this bucket
#[serde(default, skip_serializing_if = "Option::is_none")]
pub website_config: Option<GetBucketInfoWebsiteResponse>,
// FIXME for v3: remove serde(default) for the two fields below
/// CORS rules for this bucket
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cors_rules: Option<Vec<xml::cors::CorsRule>>,
/// Object lifecycle rules for this bucket
#[serde(default, skip_serializing_if = "Option::is_none")]
pub lifecycle_rules: Option<Vec<xml::lifecycle::LifecycleRule>>,
/// List of access keys that have permissions granted on this bucket
pub keys: Vec<GetBucketInfoKey>,
/// Number of objects in this bucket
@@ -869,6 +902,9 @@ pub struct GetBucketInfoResponse {
pub struct GetBucketInfoWebsiteResponse {
pub index_document: String,
pub error_document: Option<String>,
// FIXME for v3: remove serde(default) for field below
#[serde(default, skip_serializing_if = "Option::is_none")]
pub routing_rules: Option<Vec<xml::website::RoutingRule>>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
@@ -927,6 +963,11 @@ pub struct UpdateBucketResponse(pub GetBucketInfoResponse);
pub struct UpdateBucketRequestBody {
pub website_access: Option<UpdateBucketWebsiteAccess>,
pub quotas: Option<ApiBucketQuotas>,
// FIXME for v3: remove serde(default) for the two fields below
#[serde(default)]
pub cors_rules: Option<Vec<xml::cors::CorsRule>>,
#[serde(default)]
pub lifecycle_rules: Option<Vec<xml::lifecycle::LifecycleRule>>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
@@ -935,6 +976,9 @@ pub struct UpdateBucketWebsiteAccess {
pub enabled: bool,
pub index_document: Option<String>,
pub error_document: Option<String>,
// FIXME for v3: remove serde(default) for field below
#[serde(default)]
pub routing_rules: Option<Vec<xml::website::RoutingRule>>,
}
// ---- DeleteBucket ----
@@ -1109,9 +1153,17 @@ pub struct LocalGetNodeInfoRequest;
#[serde(rename_all = "camelCase")]
pub struct LocalGetNodeInfoResponse {
pub node_id: String,
// FIXME for v3: remove Option<> and serde(default) for field below
/// hostname of this node
#[serde(default, skip_serializing_if = "Option::is_none")]
pub hostname: Option<String>,
/// garage version running on this node
pub garage_version: String,
/// build-time features enabled for this garage release
pub garage_features: Option<Vec<String>>,
/// rustc version with which this garage release was compiled
pub rust_version: String,
/// database engine used for metadata
pub db_engine: String,
}
@@ -1121,8 +1173,47 @@ pub struct LocalGetNodeInfoResponse {
pub struct LocalGetNodeStatisticsRequest;
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct LocalGetNodeStatisticsResponse {
// FIXME for v3: remove freeform field and move display logic to garage crate
/// node statistics as a free-form string, kept for compatibility with nodes
/// running older v2.x versions of garage
pub freeform: String,
// FIXME for v3: remove serde(default) for fields below
/// metadata table statistics
#[serde(default, skip_serializing_if = "Option::is_none")]
pub table_stats: Option<Vec<NodeTableStats>>,
/// block manager statistics
#[serde(default, skip_serializing_if = "Option::is_none")]
pub block_manager_stats: Option<NodeBlockManagerStats>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NodeTableStats {
/// name of metadata table
pub table_name: String,
/// number of items stored in metadata table
pub items: u64,
/// size of the merkle tree representing all items in the table
pub merkle_items: u64,
/// number of items in the merkle tree update queue
pub merkle_queue_len: u64,
/// number of items in the remote insert queue
pub insert_queue_len: u64,
/// number of items in the garbage collection queue
pub gc_queue_len: u64,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, Default)]
#[serde(rename_all = "camelCase")]
pub struct NodeBlockManagerStats {
/// number of reference counter entries
pub rc_entries: u64,
/// number of blocks in the resync queue
pub resync_queue_len: u64,
/// number of blocks with resync errors
pub resync_errors: u64,
}
// ---- CreateMetadataSnapshot ----
+7 -7
View File
@@ -64,7 +64,7 @@ impl EndpointHandler<AdminRpc> for AdminApiServer {
match message {
AdminRpc::Proxy(req) => {
info!("Proxied admin API request: {}", req.name());
let res = req.clone().handle(&self.garage, &self).await;
let res = req.clone().handle(&self.garage, self).await;
match res {
Ok(res) => Ok(AdminRpcResponse::ProxyApiOkResponse(res.tagged())),
Err(e) => Ok(AdminRpcResponse::ApiErrorResponse {
@@ -76,7 +76,7 @@ impl EndpointHandler<AdminRpc> for AdminApiServer {
}
AdminRpc::Internal(req) => {
info!("Internal admin API request: {}", req.name());
let res = req.clone().handle(&self.garage, &self).await;
let res = req.clone().handle(&self.garage, self).await;
match res {
Ok(res) => Ok(AdminRpcResponse::InternalApiOkResponse(res)),
Err(e) => Ok(AdminRpcResponse::ApiErrorResponse {
@@ -173,12 +173,12 @@ impl AdminApiServer {
}
match request {
AdminApiRequest::Options(req) => req.handle(&self.garage, &self).await,
AdminApiRequest::CheckDomain(req) => req.handle(&self.garage, &self).await,
AdminApiRequest::Health(req) => req.handle(&self.garage, &self).await,
AdminApiRequest::Metrics(req) => req.handle(&self.garage, &self).await,
AdminApiRequest::Options(req) => req.handle(&self.garage, self).await,
AdminApiRequest::CheckDomain(req) => req.handle(&self.garage, self).await,
AdminApiRequest::Health(req) => req.handle(&self.garage, self).await,
AdminApiRequest::Metrics(req) => req.handle(&self.garage, self).await,
req => {
let res = req.handle(&self.garage, &self).await?;
let res = req.handle(&self.garage, self).await?;
let mut res = json_ok_response(&res)?;
res.headers_mut()
.insert(ACCESS_CONTROL_ALLOW_ORIGIN, HeaderValue::from_static("*"));
+9 -9
View File
@@ -29,7 +29,7 @@ impl RequestHandler for LocalListBlockErrorsRequest {
let errors = errors
.into_iter()
.map(|e| BlockError {
block_hash: hex::encode(&e.hash),
block_hash: hex::encode(e.hash),
refcount: e.refcount,
error_count: e.error_count,
last_try_secs_ago: now.saturating_sub(e.last_try) / 1000,
@@ -61,15 +61,15 @@ impl RequestHandler for LocalGetBlockInfoRequest {
VersionBacklink::MultipartUpload { upload_id } => {
if let Some(u) = garage.mpu_table.get(upload_id, &EmptyKey).await? {
BlockVersionBacklink::Upload {
upload_id: hex::encode(&upload_id),
upload_id: hex::encode(upload_id),
upload_deleted: u.deleted.get(),
upload_garbage_collected: false,
bucket_id: Some(hex::encode(&u.bucket_id)),
bucket_id: Some(hex::encode(u.bucket_id)),
key: Some(u.key.to_string()),
}
} else {
BlockVersionBacklink::Upload {
upload_id: hex::encode(&upload_id),
upload_id: hex::encode(upload_id),
upload_deleted: true,
upload_garbage_collected: true,
bucket_id: None,
@@ -78,12 +78,12 @@ impl RequestHandler for LocalGetBlockInfoRequest {
}
}
VersionBacklink::Object { bucket_id, key } => BlockVersionBacklink::Object {
bucket_id: hex::encode(&bucket_id),
bucket_id: hex::encode(bucket_id),
key: key.to_string(),
},
};
versions.push(BlockVersion {
version_id: hex::encode(&br.version),
version_id: hex::encode(br.version),
ref_deleted: br.deleted.get(),
version_deleted: v.deleted.get(),
garbage_collected: false,
@@ -91,7 +91,7 @@ impl RequestHandler for LocalGetBlockInfoRequest {
});
} else {
versions.push(BlockVersion {
version_id: hex::encode(&br.version),
version_id: hex::encode(br.version),
ref_deleted: br.deleted.get(),
version_deleted: true,
garbage_collected: true,
@@ -100,7 +100,7 @@ impl RequestHandler for LocalGetBlockInfoRequest {
}
}
Ok(LocalGetBlockInfoResponse {
block_hash: hex::encode(&hash),
block_hash: hex::encode(hash),
refcount,
versions,
})
@@ -215,7 +215,7 @@ fn find_block_hash_by_prefix(garage: &Arc<Garage>, prefix: &str) -> Result<Hash,
for item in iter {
let (k, _v) = item.map_err(GarageError::from)?;
let hash = Hash::try_from(&k[..32]).unwrap();
if &hash.as_slice()[..prefix_bin.len()] != prefix_bin {
if hash.as_slice()[..prefix_bin.len()] != prefix_bin {
break;
}
if hex::encode(hash.as_slice()).starts_with(prefix) {
+80 -12
View File
@@ -18,6 +18,7 @@ use garage_model::s3::mpu_table;
use garage_model::s3::object_table::*;
use garage_api_common::common_error::CommonError;
use garage_api_common::xml;
use crate::api::*;
use crate::error::*;
@@ -37,7 +38,7 @@ impl RequestHandler for ListBucketsRequest {
&EmptyKey,
None,
Some(DeletedFilter::NotDeleted),
10000,
1_000_000,
EnumerationOrder::Forward,
)
.await?;
@@ -183,7 +184,7 @@ impl RequestHandler for CreateBucketRequest {
let key = helper.key().get_existing_key(&la.access_key_id).await?;
let state = key.state.as_option().unwrap();
if matches!(state.local_aliases.get(&la.alias), Some(_)) {
if state.local_aliases.get(&la.alias).is_some() {
return Err(Error::bad_request("Local alias already exists"));
}
}
@@ -293,10 +294,28 @@ impl RequestHandler for UpdateBucketRequest {
if let Some(wa) = self.body.website_access {
if wa.enabled {
let (redirect_all, routing_rules) = match state.website_config.get() {
Some(wc) => (wc.redirect_all.clone(), wc.routing_rules.clone()),
None => (None, Vec::new()),
let redirect_all = state
.website_config
.get()
.as_ref()
.and_then(|wc| wc.redirect_all.clone());
let routing_rules = if let Some(rr) = wa.routing_rules {
for r in rr.iter() {
r.validate()?;
}
rr.into_iter()
.map(xml::website::RoutingRule::into_garage_routing_rule)
.collect::<Vec<_>>()
} else {
state
.website_config
.get()
.as_ref()
.map(|wc| wc.routing_rules.clone())
.unwrap_or_default()
};
state.website_config.update(Some(WebsiteConfig {
index_document: wa.index_document.ok_or_bad_request(
"Please specify indexDocument when enabling website access.",
@@ -322,6 +341,38 @@ impl RequestHandler for UpdateBucketRequest {
});
}
if let Some(cr) = self.body.cors_rules {
let cors_config = if cr.is_empty() {
None
} else {
let cc = xml::cors::CorsConfiguration {
xmlns: (),
cors_rules: cr,
};
cc.validate()?;
Some(cc.into_garage_cors_config()?)
};
state.cors_config.update(cors_config);
}
if let Some(lr) = self.body.lifecycle_rules {
let lifecycle_config = if lr.is_empty() {
None
} else {
let lc = xml::lifecycle::LifecycleConfiguration {
xmlns: (),
lifecycle_rules: lr,
};
Some(
lc.validate_into_garage_lifecycle_config()
.ok_or_bad_request("Invalid lifecycle configuration")?,
)
};
state.lifecycle_config.update(lifecycle_config);
}
garage.bucket_table.insert(&bucket).await?;
Ok(UpdateBucketResponse(
@@ -380,13 +431,13 @@ impl RequestHandler for InspectObjectRequest {
.map(|(vk, vb)| InspectObjectBlock {
part_number: vk.part_number,
offset: vk.offset,
hash: hex::encode(&vb.hash),
hash: hex::encode(vb.hash),
size: vb.size,
})
.collect::<Vec<_>>()
})
.unwrap_or_default();
let uuid = hex::encode(&obj_ver.uuid);
let uuid = hex::encode(obj_ver.uuid);
let timestamp = DateTime::from_timestamp_millis(obj_ver.timestamp as i64)
.expect("invalid timestamp in db");
match &obj_ver.state {
@@ -467,7 +518,7 @@ impl RequestHandler for InspectObjectRequest {
}
Ok(InspectObjectResponse {
bucket_id: hex::encode(&object.bucket_id),
bucket_id: hex::encode(object.bucket_id),
key: object.key,
versions,
})
@@ -557,7 +608,7 @@ impl RequestHandler for AddBucketAliasRequest {
BucketAliasEnum::Global { global_alias } => {
helper
.set_global_bucket_alias(bucket_id, &global_alias)
.await?
.await?;
}
BucketAliasEnum::Local {
local_alias,
@@ -565,7 +616,7 @@ impl RequestHandler for AddBucketAliasRequest {
} => {
helper
.set_local_bucket_alias(bucket_id, &access_key_id, &local_alias)
.await?
.await?;
}
}
@@ -591,7 +642,7 @@ impl RequestHandler for RemoveBucketAliasRequest {
BucketAliasEnum::Global { global_alias } => {
helper
.unset_global_bucket_alias(bucket_id, &global_alias)
.await?
.await?;
}
BucketAliasEnum::Local {
local_alias,
@@ -599,7 +650,7 @@ impl RequestHandler for RemoveBucketAliasRequest {
} => {
helper
.unset_local_bucket_alias(bucket_id, &access_key_id, &local_alias)
.await?
.await?;
}
}
@@ -693,8 +744,25 @@ async fn bucket_info_results(
GetBucketInfoWebsiteResponse {
index_document: wsc.index_document,
error_document: wsc.error_document,
routing_rules: Some(
wsc.routing_rules
.into_iter()
.map(xml::website::RoutingRule::from_garage_routing_rule)
.collect::<Vec<_>>(),
),
}
}),
cors_rules: state.cors_config.get().as_ref().map(|rules| {
rules
.iter()
.map(xml::cors::CorsRule::from_garage_cors_rule)
.collect::<Vec<_>>()
}),
lifecycle_rules: state.lifecycle_config.get().as_ref().map(|lc| {
lc.iter()
.map(xml::lifecycle::LifecycleRule::from_garage_lifecycle_rule)
.collect::<Vec<_>>()
}),
keys: relevant_keys
.into_values()
.filter_map(|key| {
+104 -27
View File
@@ -8,8 +8,10 @@ use garage_util::data::*;
use garage_rpc::layout;
use garage_rpc::layout::PARTITION_BITS;
use garage_table::*;
use garage_model::garage::Garage;
use garage_model::s3::object_table;
use crate::api::*;
use crate::error::*;
@@ -152,7 +154,6 @@ impl RequestHandler for GetClusterHealthRequest {
impl RequestHandler for GetClusterStatisticsRequest {
type Response = GetClusterStatisticsResponse;
// FIXME: return this as a JSON struct instead of text
async fn handle(
self,
garage: &Arc<Garage>,
@@ -160,8 +161,60 @@ impl RequestHandler for GetClusterStatisticsRequest {
) -> Result<GetClusterStatisticsResponse, Error> {
let mut ret = String::new();
// Gather storage node and free space statistics for current nodes
// Gather info on number of buckets, objects and object size
let buckets = garage
.bucket_table
.get_range(
&EmptyKey,
None,
Some(DeletedFilter::NotDeleted),
1_000_000,
EnumerationOrder::Forward,
)
.await?;
let bucket_stats_opt = if buckets.len() < 1000 {
futures::future::try_join_all(
buckets
.iter()
.map(|b| garage.object_counter_table.table.get(&b.id, &EmptyKey)),
)
.await
.ok()
} else {
None
};
let layout = &garage.system.cluster_layout();
let bucket_count = buckets.len() as u64;
let (total_object_count, total_object_bytes);
if let Some(bucket_stats) = bucket_stats_opt {
let bucket_stats = bucket_stats
.into_iter()
.filter_map(|cnt| cnt.map(|x| x.filtered_values(layout)))
.collect::<Vec<_>>();
total_object_count = Some(
bucket_stats
.iter()
.clone()
.map(|cnt| *cnt.get(object_table::OBJECTS).unwrap_or(&0) as u64)
.sum(),
);
total_object_bytes = Some(
bucket_stats
.iter()
.clone()
.map(|cnt| *cnt.get(object_table::BYTES).unwrap_or(&0) as u64)
.sum(),
);
} else {
total_object_count = None;
total_object_bytes = None;
}
// Gather storage node and free space statistics for current nodes
let mut node_partition_count = HashMap::<Uuid, u64>::new();
if let Ok(current_layout) = layout.current() {
for short_id in current_layout.ring_assignment_data.iter() {
@@ -231,33 +284,57 @@ impl RequestHandler for GetClusterStatisticsRequest {
.map(|c| c.0 / *parts)
})
.collect::<Vec<_>>();
if !meta_part_avail.is_empty() && !data_part_avail.is_empty() {
let meta_avail =
bytesize::ByteSize(meta_part_avail.iter().min().unwrap() * (1 << PARTITION_BITS));
let data_avail =
bytesize::ByteSize(data_part_avail.iter().min().unwrap() * (1 << PARTITION_BITS));
writeln!(
&mut ret,
"\nEstimated available storage space cluster-wide (might be lower in practice):"
)
.unwrap();
if meta_part_avail.len() < node_partition_count.len()
|| data_part_avail.len() < node_partition_count.len()
{
ret += &format_table_to_string(vec![
format!(" data: < {}", data_avail),
format!(" metadata: < {}", meta_avail),
]);
writeln!(&mut ret, "A precise estimate could not be given as information is missing for some storage nodes.").unwrap();
} else {
ret += &format_table_to_string(vec![
format!(" data: {}", data_avail),
format!(" metadata: {}", meta_avail),
]);
}
let metadata_avail: u64 =
meta_part_avail.iter().min().unwrap_or(&0) * (1 << PARTITION_BITS);
let data_avail: u64 = data_part_avail.iter().min().unwrap_or(&0) * (1 << PARTITION_BITS);
let metadata_avail_str = bytesize::ByteSize(metadata_avail);
let data_avail_str = bytesize::ByteSize(data_avail);
let incomplete_info = meta_part_avail.len() < node_partition_count.len()
|| data_part_avail.len() < node_partition_count.len();
// Display bucket statistics
let mut bucket_stats = vec![format!("Number of buckets:\t{}", bucket_count)];
if let Some(toc) = total_object_count {
bucket_stats.push(format!("Total number of objects:\t{}", toc));
}
if let Some(tob) = total_object_bytes {
bucket_stats.push(format!(
"Total size of objects:\t{}",
bytesize::ByteSize(tob)
));
}
writeln!(&mut ret, "\n{}", format_table_to_string(bucket_stats)).unwrap();
writeln!(
&mut ret,
"Estimated available storage space cluster-wide (might be lower in practice):"
)
.unwrap();
if incomplete_info {
ret += &format_table_to_string(vec![
format!(" data: < {}", data_avail_str),
format!(" metadata: < {}", metadata_avail_str),
]);
writeln!(&mut ret, "A precise estimate could not be given as information is missing for some storage nodes.").unwrap();
} else {
ret += &format_table_to_string(vec![
format!(" data: {}", data_avail_str),
format!(" metadata: {}", metadata_avail_str),
]);
}
Ok(GetClusterStatisticsResponse { freeform: ret })
Ok(GetClusterStatisticsResponse {
freeform: ret,
metadata_avail: Some(metadata_avail),
data_avail: Some(data_avail),
incomplete_avail_info: Some(incomplete_info),
bucket_count: Some(bucket_count),
total_object_count,
total_object_bytes,
})
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ pub enum Error {
NoSuchAdminToken(String),
/// The API access key does not exist
#[error("Access key not found: {00}")]
#[error("Access key not found: {0}")]
NoSuchAccessKey(String),
/// The requested block does not exist
+4 -2
View File
@@ -76,7 +76,9 @@ impl RequestHandler for GetKeyInfoRequest {
.await?
.into_iter()
.collect::<Vec<_>>();
if candidates.len() != 1 {
if candidates.is_empty() {
return Err(Error::NoSuchAccessKey(search.clone()));
} else if candidates.len() != 1 {
return Err(Error::bad_request(format!(
"{} matching keys",
candidates.len()
@@ -91,7 +93,7 @@ impl RequestHandler for GetKeyInfoRequest {
}
};
Ok(key_info_results(garage, key, self.show_secret_key).await?)
key_info_results(garage, key, self.show_secret_key).await
}
}
+11 -9
View File
@@ -143,7 +143,7 @@ impl RequestHandler for GetClusterLayoutHistoryRequest {
.iter()
.map(|node| {
(
hex::encode(&node),
hex::encode(node),
NodeUpdateTrackers {
ack: layout.update_trackers.ack_map.get(node, min_stored),
sync: layout.update_trackers.sync_map.get(node, min_stored),
@@ -343,14 +343,16 @@ impl RequestHandler for ClusterLayoutSkipDeadNodesRequest {
for node in all_nodes.iter() {
// Update ACK tracker for dead nodes or for all nodes if --allow-missing-data
if self.allow_missing_data || !status.iter().any(|x| x.id == *node && x.is_up) {
if layout.update_trackers.ack_map.set_max(*node, self.version) {
let ack_changed = layout.update_trackers.ack_map.set_max(*node, self.version);
if ack_changed {
ack_updated.push(hex::encode(node));
}
}
// If --allow-missing-data, update SYNC tracker for all nodes.
if self.allow_missing_data {
if layout.update_trackers.sync_map.set_max(*node, self.version) {
let sync_changed = layout.update_trackers.sync_map.set_max(*node, self.version);
if sync_changed {
sync_updated.push(hex::encode(node));
}
}
@@ -380,9 +382,9 @@ impl From<layout::ZoneRedundancy> for ZoneRedundancy {
}
}
impl Into<layout::ZoneRedundancy> for ZoneRedundancy {
fn into(self) -> layout::ZoneRedundancy {
match self {
impl From<ZoneRedundancy> for layout::ZoneRedundancy {
fn from(val: ZoneRedundancy) -> Self {
match val {
ZoneRedundancy::Maximum => layout::ZoneRedundancy::Maximum,
ZoneRedundancy::AtLeast(x) => layout::ZoneRedundancy::AtLeast(x),
}
@@ -397,10 +399,10 @@ impl From<layout::LayoutParameters> for LayoutParameters {
}
}
impl Into<layout::LayoutParameters> for LayoutParameters {
fn into(self) -> layout::LayoutParameters {
impl From<LayoutParameters> for layout::LayoutParameters {
fn from(val: LayoutParameters) -> Self {
layout::LayoutParameters {
zone_redundancy: self.zone_redundancy.into(),
zone_redundancy: val.zone_redundancy.into(),
}
}
}
+75 -53
View File
@@ -22,8 +22,12 @@ impl RequestHandler for LocalGetNodeInfoRequest {
garage: &Arc<Garage>,
_admin: &Admin,
) -> Result<LocalGetNodeInfoResponse, Error> {
let sys_status = garage.system.local_status();
let hostname = sys_status.hostname.unwrap_or_default().to_string();
Ok(LocalGetNodeInfoResponse {
node_id: hex::encode(garage.system.id),
hostname: Some(hostname),
garage_version: garage_util::version::garage_version().to_string(),
garage_features: garage_util::version::garage_features()
.map(|features| features.iter().map(ToString::to_string).collect()),
@@ -57,46 +61,58 @@ impl RequestHandler for LocalGetNodeStatisticsRequest {
) -> Result<LocalGetNodeStatisticsResponse, Error> {
let sys_status = garage.system.local_status();
let hostname = sys_status.hostname.unwrap_or_default().to_string();
let garage_version = garage_util::version::garage_version().to_string();
let garage_features = garage_util::version::garage_features()
.unwrap()
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>();
let rustc_version = garage_util::version::rust_version().to_string();
let db_engine_descr = garage.db.engine();
let mut ret = format_table_to_string(vec![
format!("Node ID:\t{:?}", garage.system.id),
format!("Hostname:\t{}", sys_status.hostname.unwrap_or_default(),),
format!(
"Garage version:\t{}",
garage_util::version::garage_version(),
),
format!(
"Garage features:\t{}",
garage_util::version::garage_features()
.map(|list| list.join(", "))
.unwrap_or_else(|| "(unknown)".into()),
),
format!(
"Rust compiler version:\t{}",
garage_util::version::rust_version(),
),
format!("Database engine:\t{}", garage.db.engine()),
format!("Hostname:\t{}", hostname),
format!("Garage version:\t{}", garage_version),
format!("Garage features:\t{}", garage_features.join(", ")),
format!("Rust compiler version:\t{}", rustc_version),
format!("Database engine:\t{}", db_engine_descr),
]);
// Gather table statistics
let mut table = vec![" Table\tItems\tMklItems\tMklTodo\tInsQueue\tGcTodo".into()];
table.push(gather_table_stats(&garage.admin_token_table)?);
table.push(gather_table_stats(&garage.bucket_table)?);
table.push(gather_table_stats(&garage.bucket_alias_table)?);
table.push(gather_table_stats(&garage.key_table)?);
table.push(gather_table_stats(&garage.object_table)?);
table.push(gather_table_stats(&garage.object_counter_table.table)?);
table.push(gather_table_stats(&garage.mpu_table)?);
table.push(gather_table_stats(&garage.mpu_counter_table.table)?);
table.push(gather_table_stats(&garage.version_table)?);
table.push(gather_table_stats(&garage.block_ref_table)?);
let mut table_stats = vec![
gather_table_stats(&garage.admin_token_table)?,
gather_table_stats(&garage.bucket_table)?,
gather_table_stats(&garage.bucket_alias_table)?,
gather_table_stats(&garage.key_table)?,
gather_table_stats(&garage.object_table)?,
gather_table_stats(&garage.object_counter_table.table)?,
gather_table_stats(&garage.mpu_table)?,
gather_table_stats(&garage.mpu_counter_table.table)?,
gather_table_stats(&garage.version_table)?,
gather_table_stats(&garage.block_ref_table)?,
];
#[cfg(feature = "k2v")]
{
table.push(gather_table_stats(&garage.k2v.item_table)?);
table.push(gather_table_stats(&garage.k2v.counter_table.table)?);
table_stats.push(gather_table_stats(&garage.k2v.item_table)?);
table_stats.push(gather_table_stats(&garage.k2v.counter_table.table)?);
}
// Gather table statistics
let mut table = vec![" Table\tItems\tMklItems\tMklTodo\tInsQueue\tGcTodo".into()];
table.extend(table_stats.iter().map(|ts| {
format!(
" {}\t{}\t{}\t{}\t{}\t{}",
ts.table_name,
ts.items,
ts.merkle_items,
ts.merkle_queue_len,
ts.insert_queue_len,
ts.gc_queue_len,
)
}));
write!(
&mut ret,
"\nTable stats:\n{}",
@@ -104,46 +120,52 @@ impl RequestHandler for LocalGetNodeStatisticsRequest {
)
.unwrap();
let block_manager_stats = NodeBlockManagerStats {
rc_entries: garage.block_manager.rc_approximate_len()? as u64,
resync_queue_len: garage.block_manager.resync.queue_approximate_len()? as u64,
resync_errors: garage.block_manager.resync.errors_approximate_len()? as u64,
};
// Gather block manager statistics
writeln!(&mut ret, "\nBlock manager stats:").unwrap();
let rc_len = garage.block_manager.rc_approximate_len()?.to_string();
ret += &format_table_to_string(vec![
format!(" number of RC entries:\t{} (~= number of blocks)", rc_len),
format!(
" number of RC entries:\t{} (~= number of blocks)",
block_manager_stats.rc_entries
),
format!(
" resync queue length:\t{}",
garage.block_manager.resync.queue_approximate_len()?
block_manager_stats.resync_queue_len,
),
format!(
" blocks with resync errors:\t{}",
garage.block_manager.resync.errors_approximate_len()?
block_manager_stats.resync_errors
),
]);
Ok(LocalGetNodeStatisticsResponse { freeform: ret })
Ok(LocalGetNodeStatisticsResponse {
freeform: ret,
table_stats: Some(table_stats),
block_manager_stats: Some(block_manager_stats),
})
}
}
fn gather_table_stats<F, R>(t: &Arc<Table<F, R>>) -> Result<String, Error>
fn gather_table_stats<F, R>(t: &Arc<Table<F, R>>) -> Result<NodeTableStats, Error>
where
F: TableSchema + 'static,
R: TableReplication + 'static,
{
let data_len = t
.data
.store
.approximate_len()
.map_err(GarageError::from)?
.to_string();
let mkl_len = t.merkle_updater.merkle_tree_approximate_len()?.to_string();
let data_len = t.data.store.approximate_len().map_err(GarageError::from)?;
let mkl_len = t.merkle_updater.merkle_tree_approximate_len()?;
Ok(format!(
" {}\t{}\t{}\t{}\t{}\t{}",
F::TABLE_NAME,
data_len,
mkl_len,
t.merkle_updater.todo_approximate_len()?,
t.data.insert_queue_approximate_len()?,
t.data.gc_todo_approximate_len()?
))
Ok(NodeTableStats {
table_name: F::TABLE_NAME.to_string(),
items: data_len as u64,
merkle_items: mkl_len as u64,
merkle_queue_len: t.merkle_updater.todo_approximate_len()? as u64,
insert_queue_len: t.data.insert_queue_approximate_len()? as u64,
gc_queue_len: t.data.gc_todo_approximate_len()? as u64,
})
}
+115 -57
View File
@@ -1,7 +1,8 @@
#![allow(dead_code)]
#![allow(non_snake_case)]
use utoipa::{Modify, OpenApi};
use serde::{Deserialize, Serialize};
use utoipa::{Modify, OpenApi, ToSchema};
use crate::api::*;
@@ -18,7 +19,7 @@ use crate::api::*;
(status = 200, description = "Garage daemon metrics exported in Prometheus format"),
),
)]
fn Metrics() -> () {}
fn Metrics() {}
#[utoipa::path(get,
path = "/health",
@@ -35,7 +36,7 @@ as long as it is able to have a quorum of nodes for read and write operations.
(status = 503, description = "This Garage daemon is not able to handle requests")
),
)]
fn Health() -> () {}
fn Health() {}
#[utoipa::path(get,
path = "/check",
@@ -53,7 +54,7 @@ do not correspond to an actual website.
(status = 400, description = "No static website bucket exists for this domain")
),
)]
fn CheckDomain() -> () {}
fn CheckDomain() {}
// **********************************************
// Cluster operations
@@ -77,7 +78,7 @@ Returns the cluster's current status, including:
(status = 500, description = "Internal server error")
),
)]
fn GetClusterStatus() -> () {}
fn GetClusterStatus() {}
#[utoipa::path(get,
path = "/v2/GetClusterHealth",
@@ -87,7 +88,7 @@ fn GetClusterStatus() -> () {}
(status = 200, description = "Cluster health report", body = GetClusterHealthResponse),
),
)]
fn GetClusterHealth() -> () {}
fn GetClusterHealth() {}
#[utoipa::path(get,
path = "/v2/GetClusterStatistics",
@@ -102,7 +103,7 @@ Fetch global cluster statistics.
(status = 500, description = "Internal server error")
),
)]
fn GetClusterStatistics() -> () {}
fn GetClusterStatistics() {}
#[utoipa::path(post,
path = "/v2/ConnectClusterNodes",
@@ -114,7 +115,7 @@ fn GetClusterStatistics() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn ConnectClusterNodes() -> () {}
fn ConnectClusterNodes() {}
// **********************************************
// Admin API token operations
@@ -129,7 +130,7 @@ fn ConnectClusterNodes() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn ListAdminTokens() -> () {}
fn ListAdminTokens() {}
#[utoipa::path(get,
path = "/v2/GetAdminTokenInfo",
@@ -144,7 +145,7 @@ You can search by specifying the exact token identifier (`id`) or by specifying
(status = 500, description = "Internal server error")
),
)]
fn GetAdminTokenInfo() -> () {}
fn GetAdminTokenInfo() {}
#[utoipa::path(post,
path = "/v2/CreateAdminToken",
@@ -156,7 +157,7 @@ fn GetAdminTokenInfo() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn CreateAdminToken() -> () {}
fn CreateAdminToken() {}
#[utoipa::path(post,
path = "/v2/UpdateAdminToken",
@@ -171,7 +172,7 @@ Updates information about the specified admin API token.
(status = 500, description = "Internal server error")
),
)]
fn UpdateAdminToken() -> () {}
fn UpdateAdminToken() {}
#[utoipa::path(post,
path = "/v2/DeleteAdminToken",
@@ -183,7 +184,7 @@ fn UpdateAdminToken() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn DeleteAdminToken() -> () {}
fn DeleteAdminToken() {}
#[utoipa::path(get,
path = "/v2/GetCurrentAdminTokenInfo",
@@ -196,7 +197,7 @@ Return information about the calling admin API token.
(status = 500, description = "Internal server error")
),
)]
fn GetCurrentAdminTokenInfo() -> () {}
fn GetCurrentAdminTokenInfo() {}
// **********************************************
// Layout operations
@@ -218,7 +219,7 @@ Returns the cluster's current layout, including:
(status = 500, description = "Internal server error")
),
)]
fn GetClusterLayout() -> () {}
fn GetClusterLayout() {}
#[utoipa::path(get,
path = "/v2/GetClusterLayoutHistory",
@@ -231,7 +232,7 @@ Returns the history of layouts in the cluster
(status = 500, description = "Internal server error")
),
)]
fn GetClusterLayoutHistory() -> () {}
fn GetClusterLayoutHistory() {}
#[utoipa::path(post,
path = "/v2/UpdateClusterLayout",
@@ -246,7 +247,7 @@ For example to declare 100GB, you must set `capacity: 100000000000`.
Garage uses internally the International System of Units (SI), it assumes that 1kB = 1000 bytes, and displays storage as kB, MB, GB (and not KiB, MiB, GiB that assume 1KiB = 1024 bytes).
",
request_body(
content=UpdateClusterLayoutRequest,
content=UpdateClusterLayoutRequestOpenapi,
description="
To add a new node to the layout or to change the configuration of an existing node, simply set the values you want (`zone`, `capacity`, and `tags`).
To remove a node, simply pass the `remove: true` field.
@@ -260,7 +261,46 @@ Contrary to the CLI that may update only a subset of the fields capacity, zone a
(status = 500, description = "Internal server error")
),
)]
fn UpdateClusterLayout() -> () {}
fn UpdateClusterLayout() {}
// Hack: we cannot use the UpdateClusterLayoutRequest from api.rs,
// as it contains (via NodeRoleChange) an untagged enum flattenned into
// a struct, which breaks the openapi generator.
// See issue #1249.
// Instead, we use a rewritten version of the NodeRoleChange struct where
// the struct fields are distributed into the enum variants (this is an equivalent
// representation, but this way we avoid having to rewrite all uses of the original
// struct in the Garage codebase).
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[schema(as = UpdateClusterLayoutRequest)]
pub struct UpdateClusterLayoutRequestOpenapi {
/// New node roles to assign or remove in the cluster layout
#[serde(default)]
pub roles: Vec<NodeRoleChangeOpenapi>,
/// New layout computation parameters to use
#[serde(default)]
pub parameters: Option<LayoutParameters>,
}
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[schema(as = NodeRoleChangeRequest)]
#[serde(untagged)]
pub enum NodeRoleChangeOpenapi {
#[serde(rename_all = "camelCase")]
Remove {
/// ID of the node for which this change applies
id: String,
/// Set `remove` to `true` to remove the node from the layout
remove: bool,
},
#[serde(rename_all = "camelCase")]
Update {
/// ID of the node for which this change applies
id: String,
#[serde(flatten)]
role: NodeAssignedRole,
},
}
#[utoipa::path(post,
path = "/v2/PreviewClusterLayoutChanges",
@@ -275,7 +315,7 @@ Computes a new layout taking into account the staged parameters, and returns it
(status = 500, description = "Internal server error")
),
)]
fn PreviewClusterLayoutChanges() -> () {}
fn PreviewClusterLayoutChanges() {}
#[utoipa::path(post,
path = "/v2/ApplyClusterLayout",
@@ -291,7 +331,7 @@ Applies to the cluster the layout changes currently registered as staged layout
(status = 500, description = "Internal server error")
),
)]
fn ApplyClusterLayout() -> () {}
fn ApplyClusterLayout() {}
#[utoipa::path(post,
path = "/v2/RevertClusterLayout",
@@ -302,7 +342,7 @@ fn ApplyClusterLayout() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn RevertClusterLayout() -> () {}
fn RevertClusterLayout() {}
#[utoipa::path(post,
path = "/v2/ClusterLayoutSkipDeadNodes",
@@ -314,7 +354,7 @@ fn RevertClusterLayout() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn ClusterLayoutSkipDeadNodes() -> () {}
fn ClusterLayoutSkipDeadNodes() {}
// **********************************************
// Access key operations
@@ -329,7 +369,7 @@ fn ClusterLayoutSkipDeadNodes() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn ListKeys() -> () {}
fn ListKeys() {}
#[utoipa::path(get,
path = "/v2/GetKeyInfo",
@@ -346,7 +386,7 @@ For confidentiality reasons, the secret key is not returned by default: you must
(status = 500, description = "Internal server error")
),
)]
fn GetKeyInfo() -> () {}
fn GetKeyInfo() {}
#[utoipa::path(post,
path = "/v2/CreateKey",
@@ -358,7 +398,7 @@ fn GetKeyInfo() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn CreateKey() -> () {}
fn CreateKey() {}
#[utoipa::path(post,
path = "/v2/ImportKey",
@@ -374,7 +414,7 @@ Imports an existing API key. This feature must only be used for migrations and b
(status = 500, description = "Internal server error")
),
)]
fn ImportKey() -> () {}
fn ImportKey() {}
#[utoipa::path(post,
path = "/v2/UpdateKey",
@@ -391,7 +431,7 @@ Updates information about the specified API access key.
(status = 500, description = "Internal server error")
),
)]
fn UpdateKey() -> () {}
fn UpdateKey() {}
#[utoipa::path(post,
path = "/v2/DeleteKey",
@@ -403,7 +443,7 @@ fn UpdateKey() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn DeleteKey() -> () {}
fn DeleteKey() {}
// **********************************************
// Bucket operations
@@ -418,7 +458,7 @@ fn DeleteKey() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn ListBuckets() -> () {}
fn ListBuckets() {}
#[utoipa::path(get,
path = "/v2/GetBucketInfo",
@@ -435,7 +475,7 @@ and its quotas (if any).
(status = 500, description = "Internal server error")
),
)]
fn GetBucketInfo() -> () {}
fn GetBucketInfo() {}
#[utoipa::path(post,
path = "/v2/CreateBucket",
@@ -450,7 +490,7 @@ Technically, you can also specify both `globalAlias` and `localAlias` and that w
(status = 500, description = "Internal server error")
),
)]
fn CreateBucket() -> () {}
fn CreateBucket() {}
#[utoipa::path(post,
path = "/v2/UpdateBucket",
@@ -476,7 +516,7 @@ to change only one of the two quotas.
(status = 500, description = "Internal server error")
),
)]
fn UpdateBucket() -> () {}
fn UpdateBucket() {}
#[utoipa::path(post,
path = "/v2/DeleteBucket",
@@ -494,7 +534,7 @@ Deletes a storage bucket. A bucket cannot be deleted if it is not empty.
(status = 500, description = "Internal server error")
),
)]
fn DeleteBucket() -> () {}
fn DeleteBucket() {}
#[utoipa::path(post,
path = "/v2/CleanupIncompleteUploads",
@@ -506,7 +546,7 @@ fn DeleteBucket() -> () {}
(status = 500, description = "Internal server error")
),
)]
fn CleanupIncompleteUploads() -> () {}
fn CleanupIncompleteUploads() {}
#[utoipa::path(get,
path = "/v2/InspectObject",
@@ -528,7 +568,7 @@ upload is in progress and not yet finished.
(status = 500, description = "Internal server error")
),
)]
fn InspectObject() -> () {}
fn InspectObject() {}
// **********************************************
// Operations on permissions for keys on buckets
@@ -554,7 +594,7 @@ If you want to disallow read for the key, check the DenyBucketKey operation.
(status = 500, description = "Internal server error")
),
)]
fn AllowBucketKey() -> () {}
fn AllowBucketKey() {}
#[utoipa::path(post,
path = "/v2/DenyBucketKey",
@@ -576,7 +616,7 @@ If you want the key to have the reading permission, check the AllowBucketKey ope
(status = 500, description = "Internal server error")
),
)]
fn DenyBucketKey() -> () {}
fn DenyBucketKey() {}
// **********************************************
// Operations on bucket aliases
@@ -586,25 +626,43 @@ fn DenyBucketKey() -> () {}
path = "/v2/AddBucketAlias",
tag = "Bucket alias",
description = "Add an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
request_body = AddBucketAliasRequest,
request_body = BucketAliasEnumOpenapi,
responses(
(status = 200, description = "Returns exhaustive information about the bucket", body = AddBucketAliasResponse),
(status = 500, description = "Internal server error")
),
)]
fn AddBucketAlias() -> () {}
fn AddBucketAlias() {}
#[utoipa::path(post,
path = "/v2/RemoveBucketAlias",
tag = "Bucket alias",
description = "Remove an alias for the target bucket. This can be either a global or a local alias, depending on which fields are specified.",
request_body = RemoveBucketAliasRequest,
request_body = BucketAliasEnumOpenapi,
responses(
(status = 200, description = "Returns exhaustive information about the bucket", body = RemoveBucketAliasResponse),
(status = 500, description = "Internal server error")
),
)]
fn RemoveBucketAlias() -> () {}
fn RemoveBucketAlias() {}
// Hack for issue #1249 (see UpdateClusterLayout)
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(untagged)]
#[schema(as = BucketAliasEnum)]
pub enum BucketAliasEnumOpenapi {
#[serde(rename_all = "camelCase")]
Global {
bucket_id: String,
global_alias: String,
},
#[serde(rename_all = "camelCase")]
Local {
bucket_id: String,
local_alias: String,
access_key_id: String,
},
}
// **********************************************
// Node operations
@@ -622,7 +680,7 @@ Return information about the Garage daemon running on one or several nodes.
(status = 500, description = "Internal server error")
),
)]
fn GetNodeInfo() -> () {}
fn GetNodeInfo() {}
#[utoipa::path(get,
path = "/v2/GetNodeStatistics",
@@ -638,7 +696,7 @@ Fetch statistics for one or several Garage nodes.
(status = 500, description = "Internal server error")
),
)]
fn GetNodeStatistics() -> () {}
fn GetNodeStatistics() {}
#[utoipa::path(post,
path = "/v2/CreateMetadataSnapshot",
@@ -652,7 +710,7 @@ Instruct one or several nodes to take a snapshot of their metadata databases.
(status = 500, description = "Internal server error")
),
)]
fn CreateMetadataSnapshot() -> () {}
fn CreateMetadataSnapshot() {}
#[utoipa::path(post,
path = "/v2/LaunchRepairOperation",
@@ -667,7 +725,7 @@ Launch a repair operation on one or several cluster nodes.
(status = 500, description = "Internal server error")
),
)]
fn LaunchRepairOperation() -> () {}
fn LaunchRepairOperation() {}
// **********************************************
// Worker operations
@@ -686,7 +744,7 @@ List background workers currently running on one or several cluster nodes.
(status = 500, description = "Internal server error")
),
)]
fn ListWorkers() -> () {}
fn ListWorkers() {}
#[utoipa::path(post,
path = "/v2/GetWorkerInfo",
@@ -701,7 +759,7 @@ Get information about the specified background worker on one or several cluster
(status = 500, description = "Internal server error")
),
)]
fn GetWorkerInfo() -> () {}
fn GetWorkerInfo() {}
#[utoipa::path(post,
path = "/v2/GetWorkerVariable",
@@ -716,7 +774,7 @@ Fetch values of one or several worker variables, from one or several cluster nod
(status = 500, description = "Internal server error")
),
)]
fn GetWorkerVariable() -> () {}
fn GetWorkerVariable() {}
#[utoipa::path(post,
path = "/v2/SetWorkerVariable",
@@ -731,7 +789,7 @@ Set the value for a worker variable, on one or several cluster nodes.
(status = 500, description = "Internal server error")
),
)]
fn SetWorkerVariable() -> () {}
fn SetWorkerVariable() {}
// **********************************************
// Block operations
@@ -749,7 +807,7 @@ List data blocks that are currently in an errored state on one or several Garage
(status = 500, description = "Internal server error")
),
)]
fn ListBlockErrors() -> () {}
fn ListBlockErrors() {}
#[utoipa::path(post,
path = "/v2/GetBlockInfo",
@@ -764,7 +822,7 @@ Get detailed information about a data block stored on a Garage node, including a
(status = 500, description = "Internal server error")
),
)]
fn GetBlockInfo() -> () {}
fn GetBlockInfo() {}
#[utoipa::path(post,
path = "/v2/RetryBlockResync",
@@ -779,7 +837,7 @@ Instruct Garage node(s) to retry the resynchronization of one or several missing
(status = 500, description = "Internal server error")
),
)]
fn RetryBlockResync() -> () {}
fn RetryBlockResync() {}
#[utoipa::path(post,
path = "/v2/PurgeBlocks",
@@ -796,7 +854,7 @@ This will remove all objects and in-progress multipart uploads that contain the
(status = 500, description = "Internal server error")
),
)]
fn PurgeBlocks() -> () {}
fn PurgeBlocks() {}
// **********************************************
// **********************************************
@@ -811,18 +869,18 @@ impl Modify for SecurityAddon {
components.add_security_scheme(
"bearerAuth",
SecurityScheme::Http(Http::builder().scheme(HttpAuthScheme::Bearer).build()),
)
);
}
}
#[derive(OpenApi)]
#[openapi(
info(
version = "v2.1.0",
version = "v2.3.0",
title = "Garage administration API",
description = "Administrate your Garage cluster programatically, including status, layout, keys, buckets, and maintainance tasks.
description = "Administrate your Garage cluster programmatically, including status, layout, keys, buckets, and maintenance tasks.
*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionnaly, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
*Disclaimer: This API may change in future Garage versions. Read the changelog and upgrade your scripts before upgrading. Additionally, this specification is early stage and can contain bugs, so be careful and please report any issues on our issue tracker.*",
contact(
name = "The Garage team",
email = "garagehq@deuxfleurs.fr",
+1 -1
View File
@@ -345,7 +345,7 @@ impl BlockRcRepair {
#[async_trait]
impl Worker for BlockRcRepair {
fn name(&self) -> String {
format!("Block refcount repair worker")
"Block refcount repair worker".into()
}
fn status(&self) -> WorkerStatus {
+2 -2
View File
@@ -77,7 +77,7 @@ pub enum Endpoint {
impl Endpoint {
/// Determine which S3 endpoint a request is for using the request, and a bucket which was
/// possibly extracted from the Host header.
/// Returns Self plus bucket name, if endpoint is not Endpoint::ListBuckets
/// Returns Self plus bucket name, if endpoint is not `Endpoint::ListBuckets`
pub fn from_request<T>(req: &Request<T>) -> Result<Self, Error> {
let uri = req.uri();
let path = uri.path();
@@ -124,7 +124,7 @@ impl Endpoint {
]);
if let Some(message) = query.nonempty_message() {
debug!("Unused query parameter: {}", message)
debug!("Unused query parameter: {}", message);
}
Ok(res)
+2 -2
View File
@@ -79,7 +79,7 @@ pub enum Endpoint {
impl Endpoint {
/// Determine which S3 endpoint a request is for using the request, and a bucket which was
/// possibly extracted from the Host header.
/// Returns Self plus bucket name, if endpoint is not Endpoint::ListBuckets
/// Returns Self plus bucket name, if endpoint is not `Endpoint::ListBuckets`
pub fn from_request<T>(req: &Request<T>) -> Result<Self, Error> {
let uri = req.uri();
let path = uri.path();
@@ -126,7 +126,7 @@ impl Endpoint {
]);
if let Some(message) = query.nonempty_message() {
debug!("Unused query parameter: {}", message)
debug!("Unused query parameter: {}", message);
}
Ok(res)
+2 -2
View File
@@ -15,7 +15,7 @@ use crate::Authorization;
impl AdminApiRequest {
/// Determine which S3 endpoint a request is for using the request, and a bucket which was
/// possibly extracted from the Host header.
/// Returns Self plus bucket name, if endpoint is not Endpoint::ListBuckets
/// Returns Self plus bucket name, if endpoint is not `Endpoint::ListBuckets`
pub async fn from_request(req: Request<IncomingBody>) -> Result<Self, Error> {
let uri = req.uri().clone();
let path = uri.path();
@@ -89,7 +89,7 @@ impl AdminApiRequest {
]);
if let Some(message) = query.nonempty_message() {
debug!("Unused query parameter: {}", message)
debug!("Unused query parameter: {}", message);
}
Ok(res)
+7 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "garage_api_common"
version = "2.1.0"
version = "2.3.0"
authors = ["Alex Auvolat <alex@adnab.me>"]
edition = "2018"
license = "AGPL-3.0"
@@ -27,6 +27,7 @@ thiserror.workspace = true
hex.workspace = true
hmac.workspace = true
md-5.workspace = true
percent-encoding.workspace = true
tracing.workspace = true
nom.workspace = true
pin-project.workspace = true
@@ -41,7 +42,12 @@ hyper = { workspace = true, default-features = false, features = ["server", "htt
hyper-util.workspace = true
url.workspace = true
quick-xml.workspace = true
serde.workspace = true
serde_json.workspace = true
utoipa.workspace = true
opentelemetry.workspace = true
[lints]
workspace = true
+19 -6
View File
@@ -36,6 +36,10 @@ pub enum CommonError {
#[error("Invalid header value: {0}")]
InvalidHeader(#[from] hyper::header::ToStrError),
/// The client sent a request for an action not supported by garage
#[error("Unimplemented action: {0}")]
NotImplemented(String),
// ---- SPECIFIC ERROR CONDITIONS ----
// These have to be error codes referenced in the S3 spec here:
// https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ErrorCodeList
@@ -55,6 +59,10 @@ pub enum CommonError {
/// Bucket name is not valid according to AWS S3 specs
#[error("Invalid bucket name: {0}")]
InvalidBucketName(String),
/// Tried to create bucket that is already owned by you
#[error("Bucket already owned by you")]
BucketAlreadyOwnedByYou,
}
#[macro_export]
@@ -97,8 +105,11 @@ impl CommonError {
}
CommonError::BadRequest(_) => StatusCode::BAD_REQUEST,
CommonError::Forbidden(_) => StatusCode::FORBIDDEN,
CommonError::NotImplemented(_) => StatusCode::NOT_IMPLEMENTED,
CommonError::NoSuchBucket(_) => StatusCode::NOT_FOUND,
CommonError::BucketNotEmpty | CommonError::BucketAlreadyExists => StatusCode::CONFLICT,
CommonError::BucketNotEmpty
| CommonError::BucketAlreadyExists
| CommonError::BucketAlreadyOwnedByYou => StatusCode::CONFLICT,
CommonError::InvalidBucketName(_) | CommonError::InvalidHeader(_) => {
StatusCode::BAD_REQUEST
}
@@ -120,6 +131,8 @@ impl CommonError {
CommonError::BucketNotEmpty => "BucketNotEmpty",
CommonError::InvalidBucketName(_) => "InvalidBucketName",
CommonError::InvalidHeader(_) => "InvalidHeaderValue",
CommonError::BucketAlreadyOwnedByYou => "BucketAlreadyOwnedByYou",
CommonError::NotImplemented(_) => "NotImplemented",
}
}
@@ -142,15 +155,15 @@ impl TryFrom<HelperError> for CommonError {
}
}
/// This function converts HelperErrors into CommonErrors,
/// for variants that exist in CommonError.
/// This is used for helper functions that might return InvalidBucketName
/// or NoSuchBucket for instance, and we want to pass that error
/// This function converts `HelperErrors` into `CommonErrors`,
/// for variants that exist in `CommonError`.
/// This is used for helper functions that might return `InvalidBucketName`
/// or `NoSuchBucket` for instance, and we want to pass that error
/// up to our caller.
pub fn pass_helper_error(err: HelperError) -> CommonError {
match CommonError::try_from(err) {
Ok(e) => e,
Err(e) => panic!("Helper error `{}` should hot have happenned here", e),
Err(e) => panic!("Helper error `{}` should hot have happened here", e),
}
}
+1 -1
View File
@@ -88,7 +88,7 @@ pub fn handle_options_api(
// the same name, its CORS rules won't be applied
// and will be shadowed by the rules of the globally
// existing bucket (but this is inevitable because
// OPTIONS calls are not auhtenticated).
// OPTIONS calls are not authenticated).
if let Some(bn) = bucket_name {
let helper = garage.bucket_helper();
let bucket_opt = helper.resolve_global_bucket_fast(&bn)?;
+92 -6
View File
@@ -1,5 +1,7 @@
//! Module containing various helpers for encoding
use std::fmt::Write as _;
/// Encode &str for use in a URI
pub fn uri_encode(string: &str, encode_slash: bool) -> String {
let mut result = String::with_capacity(string.len() * 2);
@@ -9,14 +11,98 @@ pub fn uri_encode(string: &str, encode_slash: bool) -> String {
'/' if encode_slash => result.push_str("%2F"),
'/' if !encode_slash => result.push('/'),
_ => {
result.push_str(
&format!("{}", c)
.bytes()
.map(|b| format!("%{:02X}", b))
.collect::<String>(),
);
let mut buf = [0_u8; 4];
let str = c.encode_utf8(&mut buf);
for b in str.bytes() {
write!(&mut result, "%{:02X}", b).unwrap();
}
}
}
}
result
}
#[cfg(test)]
mod tests {
use crate::encoding::uri_encode;
#[test]
fn test_uri_encode() {
let url1_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/documentation/reference-manual/features/",
true,
);
assert_eq!(
&url1_encoded,
"https%3A%2F%2Fgaragehq.deuxfleurs.fr%2Fdocumentation%2Freference-manual%2Ffeatures%2F"
);
let url2_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/blog/2025-06-garage-v2/",
true,
);
assert_eq!(
&url2_encoded,
"https%3A%2F%2Fgaragehq.deuxfleurs.fr%2Fblog%2F2025-06-garage-v2%2F"
);
let url3_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/blog/2025-06-hé_les_gens/",
true,
);
assert_eq!(
&url3_encoded,
"https%3A%2F%2Fgaragehq.deuxfleurs.fr%2Fblog%2F2025-06-h%C3%A9_les_gens%2F"
);
let url4_encoded = uri_encode("/home/local user/Documents/personnel/à_blog.md", true);
assert_eq!(
&url4_encoded,
"%2Fhome%2Flocal%20user%2FDocuments%2Fpersonnel%2F%C3%A0_blog.md"
);
}
#[test]
fn test_uri_encode_without_slash() {
let url1_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/documentation/reference-manual/features/",
false,
);
assert_eq!(
&url1_encoded,
"https%3A//garagehq.deuxfleurs.fr/documentation/reference-manual/features/"
);
let url2_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/blog/2025-06-garage-v2/",
false,
);
assert_eq!(
&url2_encoded,
"https%3A//garagehq.deuxfleurs.fr/blog/2025-06-garage-v2/"
);
let url3_encoded = uri_encode(
"https://garagehq.deuxfleurs.fr/blog/2025-06-hé_les_gens/",
false,
);
assert_eq!(
&url3_encoded,
"https%3A//garagehq.deuxfleurs.fr/blog/2025-06-h%C3%A9_les_gens/"
);
let url4_encoded = uri_encode("/home/local user/Documents/personnel/à_blog.md", false);
assert_eq!(
&url4_encoded,
"/home/local%20user/Documents/personnel/%C3%A0_blog.md"
);
}
#[test]
fn test_uri_encode_most_than_double_size() {
let url_encoded = uri_encode("/home/ùàé ç/çaèù/à_êô.md", true);
assert_eq!(
&url_encoded,
"%2Fhome%2F%C3%B9%C3%A0%C3%A9%20%C3%A7%2F%C3%A7a%C3%A8%C3%B9%2F%C3%A0_%C3%AA%C3%B4.md"
);
}
}
+21 -6
View File
@@ -125,7 +125,7 @@ impl<A: ApiHandler> ApiServer<A> {
}
UnixOrTCPSocketAddress::UnixSocket(ref path) => {
if path.exists() {
fs::remove_file(path)?
fs::remove_file(path)?;
}
let listener = UnixListener::bind(path)?;
@@ -154,7 +154,7 @@ impl<A: ApiHandler> ApiServer<A> {
{
format!("{forwarded_for_ip_addr} (via {addr})")
} else {
format!("{addr}")
addr
};
// we only do this to log the access key, so we can discard any error
let key = self
@@ -162,7 +162,14 @@ impl<A: ApiHandler> ApiServer<A> {
.key_id_from_request(&req)
.map(|k| format!("(key {k}) "))
.unwrap_or_default();
info!("{source} {key}{} {uri}", req.method());
let method = req.method().clone();
if A::API_NAME == "admin" && (uri.path() == "/health" || uri.path() == "/metrics") {
debug!("{source} {key}{method} {uri}");
} else {
info!("{source} {key}{method} {uri}");
}
debug!("{:?}", req);
let tracer = opentelemetry::global::tracer("garage");
@@ -190,15 +197,23 @@ impl<A: ApiHandler> ApiServer<A> {
let mut http_error_builder = Response::builder().status(e.http_status_code());
if let Some(header_map) = http_error_builder.headers_mut() {
e.add_http_headers(header_map)
e.add_http_headers(header_map);
}
let http_error = http_error_builder.body(body)?;
if e.http_status_code().is_server_error() {
warn!("Response: error {}, {}", e.http_status_code(), e);
warn!(
"error {}, {} in response to {source} {key}{method} {uri}",
e.http_status_code(),
e
);
} else {
info!("Response: error {}, {}", e.http_status_code(), e);
info!(
"error {}, {} in response to {source} {key}{method} {uri}",
e.http_status_code(),
e
);
}
Ok(http_error
.map(|body| BoxBody::new(body.map_err(|_: Infallible| unreachable!()))))

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