mirror of
https://github.com/getnora-io/nora.git
synced 2026-04-12 19:40:31 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 835a6f0b14 | |||
| 340c49bf12 | |||
| c84d13c26e |
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@@ -9,25 +9,9 @@ env:
|
|||||||
IMAGE_NAME: ${{ github.repository }}
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
|
||||||
name: Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Rust
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
|
|
||||||
- name: Cache cargo
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: cargo test --package nora-registry
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build & Push
|
name: Build & Push
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: test
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
@@ -63,7 +47,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ impl Default for RateLimitConfig {
|
|||||||
Self {
|
Self {
|
||||||
auth_rps: 1, // 1 req/sec for auth (strict)
|
auth_rps: 1, // 1 req/sec for auth (strict)
|
||||||
auth_burst: 5, // Allow burst of 5
|
auth_burst: 5, // Allow burst of 5
|
||||||
upload_rps: 10, // 10 req/sec for uploads
|
upload_rps: 50, // 50 req/sec for uploads (Docker needs parallel)
|
||||||
upload_burst: 20, // Allow burst of 20
|
upload_burst: 100, // Allow burst of 100
|
||||||
general_rps: 100, // 100 req/sec general
|
general_rps: 100, // 100 req/sec general
|
||||||
general_burst: 200, // Allow burst of 200
|
general_burst: 200, // Allow burst of 200
|
||||||
}
|
}
|
||||||
@@ -58,15 +58,16 @@ pub fn auth_rate_limiter() -> tower_governor::GovernorLayer<
|
|||||||
|
|
||||||
/// Create rate limiter layer for upload endpoints
|
/// Create rate limiter layer for upload endpoints
|
||||||
///
|
///
|
||||||
/// Default: 10 requests per second, burst of 20
|
/// Default: 50 requests per second, burst of 100
|
||||||
|
/// Higher limits to accommodate Docker client's parallel layer uploads
|
||||||
pub fn upload_rate_limiter() -> tower_governor::GovernorLayer<
|
pub fn upload_rate_limiter() -> tower_governor::GovernorLayer<
|
||||||
tower_governor::key_extractor::PeerIpKeyExtractor,
|
tower_governor::key_extractor::PeerIpKeyExtractor,
|
||||||
governor::middleware::StateInformationMiddleware,
|
governor::middleware::StateInformationMiddleware,
|
||||||
axum::body::Body,
|
axum::body::Body,
|
||||||
> {
|
> {
|
||||||
let config = GovernorConfigBuilder::default()
|
let config = GovernorConfigBuilder::default()
|
||||||
.per_second(10)
|
.per_second(50)
|
||||||
.burst_size(20)
|
.burst_size(100)
|
||||||
.use_headers()
|
.use_headers()
|
||||||
.finish()
|
.finish()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -101,7 +102,7 @@ mod tests {
|
|||||||
let config = RateLimitConfig::default();
|
let config = RateLimitConfig::default();
|
||||||
assert_eq!(config.auth_rps, 1);
|
assert_eq!(config.auth_rps, 1);
|
||||||
assert_eq!(config.auth_burst, 5);
|
assert_eq!(config.auth_burst, 5);
|
||||||
assert_eq!(config.upload_rps, 10);
|
assert_eq!(config.upload_rps, 50);
|
||||||
assert_eq!(config.general_rps, 100);
|
assert_eq!(config.general_rps, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user