Commit graph

48 commits

Author SHA1 Message Date
2559f63e9b
Make all HTTP services optionnal 2022-09-07 17:54:16 +02:00
382e74c798 First version of admin API (#298)
**Spec:**

- [x] Start writing
- [x] Specify all layout endpoints
- [x] Specify all endpoints for operations on keys
- [x] Specify all endpoints for operations on key/bucket permissions
- [x] Specify all endpoints for operations on buckets
- [x] Specify all endpoints for operations on bucket aliases

View rendered spec at <https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/admin-api/doc/drafts/admin-api.md>

**Code:**

- [x] Refactor code for admin api to use common api code that was created for K2V

**General endpoints:**

- [x] Metrics
- [x] GetClusterStatus
- [x] ConnectClusterNodes
- [x] GetClusterLayout
- [x] UpdateClusterLayout
- [x] ApplyClusterLayout
- [x] RevertClusterLayout

**Key-related endpoints:**

- [x] ListKeys
- [x] CreateKey
- [x] ImportKey
- [x] GetKeyInfo
- [x] UpdateKey
- [x] DeleteKey

**Bucket-related endpoints:**

- [x] ListBuckets
- [x] CreateBucket
- [x] GetBucketInfo
- [x] DeleteBucket
- [x] PutBucketWebsite
- [x] DeleteBucketWebsite

**Operations on key/bucket permissions:**

- [x] BucketAllowKey
- [x] BucketDenyKey

**Operations on bucket aliases:**

- [x] GlobalAliasBucket
- [x] GlobalUnaliasBucket
- [x] LocalAliasBucket
- [x] LocalUnaliasBucket

**And also:**

- [x] Separate error type for the admin API (this PR includes a quite big refactoring of error handling)
- [x] Add management of website access
- [ ] Check that nothing is missing wrt what can be done using the CLI
- [ ] Improve formatting of the spec
- [x] Make sure everyone is cool with the API design

Fix #231
Fix #295

Co-authored-by: Alex Auvolat <alex@adnab.me>
Reviewed-on: Deuxfleurs/garage#298
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-05-24 12:16:39 +02:00
5768bf3622 First implementation of K2V (#293)
**Specification:**

View spec at [this URL](https://git.deuxfleurs.fr/Deuxfleurs/garage/src/branch/k2v/doc/drafts/k2v-spec.md)

- [x] Specify the structure of K2V triples
- [x] Specify the DVVS format used for causality detection
- [x] Specify the K2V index (just a counter of number of values per partition key)
- [x] Specify single-item endpoints: ReadItem, InsertItem, DeleteItem
- [x] Specify index endpoint: ReadIndex
- [x] Specify multi-item endpoints: InsertBatch, ReadBatch, DeleteBatch
- [x] Move to JSON objects instead of tuples
- [x] Specify endpoints for polling for updates on single values (PollItem)

**Implementation:**

- [x] Table for K2V items, causal contexts
- [x] Indexing mechanism and table for K2V index
- [x] Make API handlers a bit more generic
- [x] K2V API endpoint
- [x] K2V API router
- [x] ReadItem
- [x] InsertItem
- [x] DeleteItem
- [x] PollItem
- [x] ReadIndex
- [x] InsertBatch
- [x] ReadBatch
- [x] DeleteBatch

**Testing:**

- [x] Just a simple Python script that does some requests to check visually that things are going right (does not contain parsing of results or assertions on returned values)
- [x] Actual tests:
  - [x] Adapt testing framework
  - [x] Simple test with InsertItem + ReadItem
  - [x] Test with several Insert/Read/DeleteItem + ReadIndex
  - [x] Test all combinations of return formats for ReadItem
  - [x] Test with ReadBatch, InsertBatch, DeleteBatch
  - [x] Test with PollItem
  - [x] Test error codes
- [ ] Fix most broken stuff
  - [x] test PollItem broken randomly
  - [x] when invalid causality tokens are given, errors should be 4xx not 5xx

**Improvements:**

- [x] Descending range queries
  - [x] Specify
  - [x] Implement
  - [x] Add test
- [x] Batch updates to index counter
- [x] Put K2V behind `k2v` feature flag

Co-authored-by: Alex Auvolat <alex@adnab.me>
Reviewed-on: Deuxfleurs/garage#293
Co-authored-by: Alex <alex@adnab.me>
Co-committed-by: Alex <alex@adnab.me>
2022-05-10 13:16:57 +02:00
ba6b56ae68
Fix some new clippy lints 2022-03-14 12:27:49 +01:00
d9a35359bf
Add metrics to web endpoint 2022-03-14 10:53:50 +01:00
8a5bbc3b0b
More permissive OPTIONS on S3 API 2022-03-01 11:15:16 +01:00
8129a98291
Process CORS earlier in pipeline 2022-02-28 12:22:39 +01:00
6dab836f3a
Multipart improvements
- support part_number for HeadObject
- add checks in complete_multipart_upload
2022-01-24 21:04:40 +01:00
513a6b15f9
Handle OPTIONS on website endpoint 2022-01-24 12:32:28 +01:00
ea7fb901eb
Implement {Put,Get,Delete}BucketCors and CORS in general
- OPTIONS request against API endpoint
- Returning corresponding CORS headers on API calls
- Returning corresponding CORS headers on website GET's
2022-01-24 11:58:00 +01:00
d4dd2e2640
Make use of website config, return error document on error 2022-01-13 14:25:19 +01:00
df35feba18
New buckets for 0.6.0: make bucket id a SK and not a HK, CLI updates 2022-01-04 12:53:14 +01:00
1bcd6fabbd
New buckets for 0.6.0: small changes
- Fix bucket delete

- fix merge of bucket creation date

- Replace deletable with option in aliases
    Rationale: if two aliases point to conflicting bucket, resolving
    by making an arbitrary choice risks making data accessible when it
    shouldn't be. We'd rather resolve to deleting the alias until
    someone puts it back.
2022-01-04 12:52:47 +01:00
b1cfd16913
New buckets for 0.6.0: small fixes, including:
- ensure bucket names are correct aws s3 names
- when making aliases, ensure timestamps of links in both ways are the
  same
- fix small remarks by trinity
- don't have a separate website_access field
2022-01-04 12:46:41 +01:00
0bbb6673e7
Model changes 2022-01-04 12:45:52 +01:00
5b1117e582
New model for buckets 2022-01-04 12:45:46 +01:00
7f26ed55cd Improved handling of HTTP ranges
- correct HTTP code when range syntax is invalid (fix #140)
- when multiple ranges are given, simply ignore and send whole file

Co-authored-by: Trinity Pointard <trinity.pointard@gmail.com>
Reviewed-on: Deuxfleurs/garage#157
Reviewed-by: Alex <alex@adnab.me>
Co-authored-by: trinity-1686a <trinity.pointard@gmail.com>
Co-committed-by: trinity-1686a <trinity.pointard@gmail.com>
2021-11-29 11:52:42 +01:00
9c58ec28d3 add support for vhost-style s3 bucket 2021-11-16 15:41:41 +01:00
ada7899b24
Fix clippy lints (fix #121) 2021-10-26 10:20:05 +02:00
f8ae8fc4be
fix clippy warnings on web 2021-05-03 22:11:42 +02:00
a2e1617d84
document web crate 2021-04-27 16:37:10 +02:00
b4c903371c add support for caching headers 2021-03-18 15:46:33 +01:00
851893a3f2 Do not accept domains such as [hello 2021-01-15 17:49:10 +01:00
f8a40e8c4f Explicitly set code path unreachable 2021-01-15 17:11:15 +01:00
fad7bc405b Behavior problem: do not panic anymore + add tests 2021-01-15 17:03:54 +01:00
2f4378a9c4 Fix formatting 2020-12-17 22:51:44 +01:00
3132deca58 Web server access control 2020-12-17 20:43:14 +01:00
b7a377308b Handle HEAD 2020-11-21 17:58:14 +01:00
a88fd49f71 Use handle_get 2020-11-21 17:50:19 +01:00
0f33231ee6 We are able to serve a file 2020-11-21 15:15:25 +01:00
d4c7f4e374 Fix host to key 2020-11-21 12:01:02 +01:00
5b363626f4 Support punnycode 2020-11-20 21:23:32 +01:00
04f455ff7f Make it compile again 2020-11-19 14:56:00 +01:00
6076d869b1 Build error 2020-11-11 21:17:34 +01:00
2765291796 Build path correctly 2020-11-11 19:48:01 +01:00
d445c4ef9c WIP fetch object 2020-11-11 15:24:25 +01:00
3cb3994cd2 Add documentation to host_to_bucket 2020-11-10 17:05:10 +01:00
cacf8ddf2d Panic when it is a logical error 2020-11-10 15:52:20 +01:00
d1b2fcc1e7 Rewrite for clarity 2020-11-10 15:48:40 +01:00
ab62c59acb Fix indent again 2020-11-10 15:40:33 +01:00
8797eed0ab Fixes due to integration tests 2020-11-10 15:32:04 +01:00
1e52ee9f5b Rewrite authority to host while staying on stack 2020-11-10 15:26:48 +01:00
27795a390c Fix formatting 2020-11-10 09:59:52 +01:00
4093833ae8 Extract bucket 2020-11-10 09:57:07 +01:00
09137fd6b5 Log host 2020-11-08 16:06:52 +01:00
c78df603d7 Add some documentation 2020-11-08 16:02:16 +01:00
0791e7164e Parse host header 2020-11-08 15:47:25 +01:00
cea871d944 Skeleton to the new web API 2020-11-02 15:48:39 +01:00