diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 773d9b57..798fbd14 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -31,3 +31,4 @@ lint_project apps/dev-auth # lint_project apps/runtime/nodejs # lint_project apps/runtime/python +lint_project apps/runtime/core diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f1721303..72504973 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,4 +1,16 @@ version: 2 + +# The base images for every runtime and sidecar come from Docker Hardened +# Images, so Dependabot needs credentials of its own to see +# what tags exist. These are Dependabot secrets rather than Actions secrets, +# which are a separate store that Dependabot cannot read. +registries: + dhi: + type: docker-registry + url: dhi.io + username: ${{secrets.DOCKERHUB_USERNAME}} + password: ${{secrets.DOCKERHUB_TOKEN}} + updates: # GitHub Actions - package-ecosystem: "github-actions" @@ -79,3 +91,73 @@ updates: python-deps: patterns: ["*"] update-types: ["minor", "patch"] + + # Docker - Core runtime base images + - package-ecosystem: "docker" + directory: "/apps/runtime/core" + registries: + - dhi + schedule: + interval: "weekly" + commit-message: + prefix: "deps(runtime-core)" + groups: + docker-deps: + patterns: ["*"] + update-types: ["minor", "patch"] + + # Docker - Node.js runtime base images + - package-ecosystem: "docker" + directory: "/apps/runtime/nodejs" + registries: + - dhi + schedule: + interval: "weekly" + commit-message: + prefix: "deps(runtime-nodejs)" + groups: + docker-deps: + patterns: ["*"] + update-types: ["minor", "patch"] + + # Docker - Python runtime base images + - package-ecosystem: "docker" + directory: "/apps/runtime/python" + registries: + - dhi + schedule: + interval: "weekly" + commit-message: + prefix: "deps(runtime-python)" + groups: + docker-deps: + patterns: ["*"] + update-types: ["minor", "patch"] + + # Docker - Local events sidecar base images + - package-ecosystem: "docker" + directory: "/apps/local-events" + registries: + - dhi + schedule: + interval: "weekly" + commit-message: + prefix: "deps(local-events)" + groups: + docker-deps: + patterns: ["*"] + update-types: ["minor", "patch"] + + # Docker - Dev auth base images + - package-ecosystem: "docker" + directory: "/apps/dev-auth" + registries: + - dhi + schedule: + interval: "weekly" + commit-message: + prefix: "deps(dev-auth)" + groups: + docker-deps: + patterns: ["*"] + update-types: ["minor", "patch"] diff --git a/.github/workflows/app-runtime-core-ci.yml b/.github/workflows/app-runtime-core-ci.yml new file mode 100644 index 00000000..f540f49c --- /dev/null +++ b/.github/workflows/app-runtime-core-ci.yml @@ -0,0 +1,81 @@ +name: Core Runtime CI + +on: + push: + branches: [main] + paths: + - 'apps/runtime/core/**' + # The app is built from the runtime crates by path, so a change to them + # can break this build without touching anything under apps/. + - 'libs/runtime/**' + - '.github/workflows/app-runtime-core-ci.yml' + - '!**/*.md' + pull_request: + paths: + - 'apps/runtime/core/**' + - 'libs/runtime/**' + - '.github/workflows/app-runtime-core-ci.yml' + - '!**/*.md' + workflow_dispatch: {} + +permissions: + contents: read + +env: + CARGO_TERM_COLOR: always + +jobs: + validate: + name: Validate + runs-on: ubuntu-latest + defaults: + run: + working-directory: apps/runtime/core + steps: + - uses: actions/checkout@v4 + + - name: Install Rust + run: rustup update stable && rustup component add rustfmt clippy + + - uses: Swatinem/rust-cache@v2 + with: + workspaces: apps/runtime/core + + - name: Check formatting + run: cargo fmt --check + + - name: Lint + run: cargo clippy --all-targets --locked -- -D warnings + + - name: Test + run: cargo test --locked + + docker-build: + name: Docker Build (${{ matrix.target }}) + runs-on: ubuntu-latest + strategy: + matrix: + target: [runtime, dev] + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: dhi.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/setup-buildx-action@v3 + + - uses: docker/build-push-action@v6 + with: + # The repository root, because the build needs both apps/runtime/core + # and the runtime crates it depends on under libs/runtime. + context: . + file: apps/runtime/core/Dockerfile + target: ${{ matrix.target }} + push: false + load: true + tags: celerity-runtime-core:${{ matrix.target }}-test + cache-from: type=gha,scope=ci-core-${{ matrix.target }} + cache-to: type=gha,mode=max,scope=ci-core-${{ matrix.target }} diff --git a/.github/workflows/app-runtime-core-release.yml b/.github/workflows/app-runtime-core-release.yml new file mode 100644 index 00000000..7bbd1b23 --- /dev/null +++ b/.github/workflows/app-runtime-core-release.yml @@ -0,0 +1,274 @@ +name: Core Runtime Release + +on: + workflow_dispatch: + inputs: + tag: + description: 'Release tag (e.g. runtime-core-app/v0.1.0)' + required: true + type: string + +permissions: + contents: read + +env: + REGISTRY: ghcr.io + IMAGE_NAME: newstack-cloud/celerity-runtime-core + +jobs: + prepare: + name: Prepare Release + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Extract version from tag + id: version + env: + TAG: ${{ inputs.tag }} + run: | + if [[ ! "$TAG" =~ ^runtime-core-app/v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then + echo "::error::Expected a tag of the form runtime-core-app/v1.2.3, got '$TAG'" + exit 1 + fi + VERSION="${TAG##*/}" + VERSION="${VERSION#v}" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Extracted version: $VERSION from tag: $TAG" + + build-runtime: + name: Build & Push Production Image + runs-on: ubuntu-latest + needs: prepare + permissions: + contents: read + packages: write + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: dhi.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}},value=${{ needs.prepare.outputs.version }} + type=semver,pattern={{major}}.{{minor}},value=${{ needs.prepare.outputs.version }} + type=raw,value=latest,enable=${{ !contains(needs.prepare.outputs.version, '-') }} + labels: | + org.opencontainers.image.title=Celerity Core Runtime + org.opencontainers.image.description=Production runtime for Celerity applications with ahead-of-time compiled handlers + + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + + - id: build + uses: docker/build-push-action@v6 + with: + context: . + file: apps/runtime/core/Dockerfile + target: runtime + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + annotations: ${{ steps.meta.outputs.annotations }} + cache-from: type=gha,scope=runtime-core-prod + cache-to: type=gha,mode=max,scope=runtime-core-prod + + build-dev: + name: Build & Push Dev Image + runs-on: ubuntu-latest + needs: prepare + permissions: + contents: read + packages: write + outputs: + digest: ${{ steps.build.outputs.digest }} + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: dhi.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=dev-${{ needs.prepare.outputs.version }} + type=raw,value=dev-latest,enable=${{ !contains(needs.prepare.outputs.version, '-') }} + labels: | + org.opencontainers.image.title=Celerity Core Runtime (Dev) + org.opencontainers.image.description=Development runtime for Celerity applications with ahead-of-time compiled handlers (includes a shell) + + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + + - id: build + uses: docker/build-push-action@v6 + with: + context: . + file: apps/runtime/core/Dockerfile + target: dev + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + annotations: ${{ steps.meta.outputs.annotations }} + cache-from: type=gha,scope=runtime-core-dev + cache-to: type=gha,mode=max,scope=runtime-core-dev + + scan-images: + name: Scan Container Images + runs-on: ubuntu-latest + needs: [build-runtime, build-dev] + permissions: + contents: read + security-events: write + steps: + - uses: actions/checkout@v4 + + - name: Trivy scan production image (table) + uses: aquasecurity/trivy-action@0.35.0 + with: + image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-runtime.outputs.digest }}" + format: "table" + severity: "CRITICAL,HIGH" + exit-code: "1" + + - name: Trivy scan production image (SARIF) + if: always() + uses: aquasecurity/trivy-action@0.35.0 + with: + image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-runtime.outputs.digest }}" + format: "sarif" + output: "trivy-runtime.sarif" + severity: "CRITICAL,HIGH" + exit-code: "0" + + - name: Upload production scan results + uses: github/codeql-action/upload-sarif@v4 + if: always() + with: + sarif_file: "trivy-runtime.sarif" + category: "container-core-runtime" + + - name: Trivy scan dev image (table) + uses: aquasecurity/trivy-action@0.35.0 + with: + image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-dev.outputs.digest }}" + format: "table" + severity: "CRITICAL,HIGH" + exit-code: "0" + + - name: Trivy scan dev image (SARIF) + if: always() + uses: aquasecurity/trivy-action@0.35.0 + with: + image-ref: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-dev.outputs.digest }}" + format: "sarif" + output: "trivy-dev.sarif" + severity: "CRITICAL,HIGH" + exit-code: "0" + + - name: Upload dev scan results + uses: github/codeql-action/upload-sarif@v4 + if: always() + with: + sarif_file: "trivy-dev.sarif" + category: "container-core-dev" + + sign-and-attest: + name: Sign & Attest Images + runs-on: ubuntu-latest + needs: [build-runtime, build-dev, scan-images] + # A signature and a provenance attestation say this image was built here and + # is fit to pull, so a failed scan has to stop them being made. + if: needs.build-runtime.result == 'success' && needs.build-dev.result == 'success' && needs.scan-images.result == 'success' + permissions: + contents: read + packages: write + id-token: write + attestations: write + env: + # Store signatures and attestations as OCI 1.1 referrers instead of + # tag-based artifacts (.sig/.att/.sbom tags) that pollute the GHCR UI. + COSIGN_REGISTRY_REFERRERS_MODE: oci-1-1 + steps: + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: sigstore/cosign-installer@v3 + - uses: anchore/sbom-action/download-syft@v0 + + # --- Production image --- + - name: Sign production image (cosign keyless) + run: | + cosign sign --yes \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-runtime.outputs.digest }} + + - name: Generate production SBOM + run: | + syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-runtime.outputs.digest }} \ + -o spdx-json=runtime-sbom.spdx.json + + - name: Attest production SBOM + run: | + cosign attest --yes --predicate runtime-sbom.spdx.json --type spdxjson \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-runtime.outputs.digest }} + + - name: GitHub attestation (production) + uses: actions/attest-build-provenance@v3 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + subject-digest: ${{ needs.build-runtime.outputs.digest }} + push-to-registry: true + + # --- Dev image --- + - name: Sign dev image (cosign keyless) + run: | + cosign sign --yes \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-dev.outputs.digest }} + + - name: Generate dev SBOM + run: | + syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-dev.outputs.digest }} \ + -o spdx-json=dev-sbom.spdx.json + + - name: Attest dev SBOM + run: | + cosign attest --yes --predicate dev-sbom.spdx.json --type spdxjson \ + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ needs.build-dev.outputs.digest }} + + - name: GitHub attestation (dev) + uses: actions/attest-build-provenance@v3 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + subject-digest: ${{ needs.build-dev.outputs.digest }} + push-to-registry: true diff --git a/.github/workflows/cargo-deny.yml b/.github/workflows/cargo-deny.yml index 43ea42e8..8584d078 100644 --- a/.github/workflows/cargo-deny.yml +++ b/.github/workflows/cargo-deny.yml @@ -5,9 +5,11 @@ on: branches: [main] paths: - "libs/runtime/**" + - "apps/runtime/core/**" pull_request: paths: - "libs/runtime/**" + - "apps/runtime/core/**" schedule: - cron: "0 5 * * 1" # Weekly Monday 5AM UTC workflow_dispatch: {} @@ -17,17 +19,31 @@ permissions: jobs: cargo-deny: - name: Cargo Deny Check + name: Cargo Deny Check (${{ matrix.manifest }}) runs-on: ubuntu-latest strategy: + # Every manifest and check should report on its own, rather than the + # first failure hiding what the others would have said. + fail-fast: false matrix: checks: - advisories - bans licenses sources + # The core runtime app is a workspace of its own with its own lock + # file, so the crates it ships are not covered by checking the runtime + # libraries. + manifest: + - libs/runtime/Cargo.toml + - apps/runtime/core/Cargo.toml steps: - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v2 with: + # `--config` is an option of the check subcommand rather than a + # global one, so it goes here rather than in `arguments`. Without it + # cargo-deny looks beside the manifest, finds nothing for the app and + # falls back to its default policy. command: check ${{ matrix.checks }} - manifest-path: libs/runtime/Cargo.toml + command-arguments: --config libs/runtime/deny.toml + manifest-path: ${{ matrix.manifest }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 45e00426..20e43f0a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -35,7 +35,7 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_OUTPUTS: ${{ toJSON(steps.release.outputs) }} run: | - GATED_COMPONENTS=("apps/runtime/nodejs" "apps/runtime/python") + GATED_COMPONENTS=("apps/runtime/nodejs" "apps/runtime/python" "apps/runtime/core") for path in "${GATED_COMPONENTS[@]}"; do # release-please outputs use -- as separator for path-based keys @@ -101,6 +101,7 @@ jobs: ["runtime-sdk-ffi"]="lib-java-csharp-sdk-release.yml" ["runtime-nodejs"]="app-runtime-nodejs-release.yml" ["runtime-python"]="app-runtime-python-release.yml" + ["runtime-core-app"]="app-runtime-core-release.yml" ["local-events"]="app-local-events-release.yml" ["dev-auth"]="app-dev-auth-release.yml" ) diff --git a/.gitignore b/.gitignore index cd7de329..04662f00 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,6 @@ node_modules .yarn -**/.claude \ No newline at end of file +**/.claude + +blueprint-ls.log diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64a26444..38949614 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -9,5 +9,6 @@ "libs/runtime/sdk/node": "0.3.5", "libs/runtime/sdk/python": "0.2.2", "apps/runtime/nodejs": "0.8.3", - "apps/runtime/python": "0.5.2" + "apps/runtime/python": "0.5.2", + "apps/runtime/core": "0.1.0" } diff --git a/COMMIT_GUIDELINES.md b/COMMIT_GUIDELINES.md index c90fe239..22addf58 100644 --- a/COMMIT_GUIDELINES.md +++ b/COMMIT_GUIDELINES.md @@ -38,6 +38,7 @@ This list will evolve as more applications and libraries are added to Celerity. - `cli` - CLI for test/build/package/deploy tooling (`apps/cli`) - `local-events` - Local events sidecar for Celerity application event triggers for local and CI testing (`apps/local-events`) - `dev-auth` - Development authentication service for testing authentication flows locally (`apps/dev-auth`) +- `runtime-core` - Core runtime application for ahead-of-time compiled handlers, supervising a handlers executable it streams events to over the IPC protocol (`apps/runtime/core`) - `runtime-nodejs` - Node.js runtime wrapper application (`apps/runtime/nodejs`) - `runtime-python` - Python runtime wrapper application (`apps/runtime/python`) @@ -110,6 +111,7 @@ Release-please routes commits to component groups by **longest file path match** | `runtime-sdk-ffi` | `libs/runtime/sdk` | Triggers Java/.NET release | `lib-rt-sdk-ffi`, `lib-rt-sdk-ffi-java`, `lib-rt-sdk-schema`, `runtime-bindings`, `lib-rt-sdk-java`, `lib-rt-sdk-dotnet` | | `runtime-sdk-node` | `libs/runtime/sdk/node` | NPM | `lib-rt-sdk-node` | | `runtime-sdk-python` | `libs/runtime/sdk/python` | PyPI | `lib-rt-sdk-python` | +| `runtime-core-app` | `apps/runtime/core` | GHCR | `runtime-core` | | `runtime-nodejs` | `apps/runtime/nodejs` | GHCR | `runtime-nodejs` | | `runtime-python` | `apps/runtime/python` | GHCR | `runtime-python` | diff --git a/SOURCE_CONTROL_RELEASE_STRATEGY.md b/SOURCE_CONTROL_RELEASE_STRATEGY.md index 58768062..ce9b6ac1 100644 --- a/SOURCE_CONTROL_RELEASE_STRATEGY.md +++ b/SOURCE_CONTROL_RELEASE_STRATEGY.md @@ -47,6 +47,7 @@ Non-Go components do not need path-based tags — the component tag created by r | `runtime-sdk-ffi` | `libs/runtime/sdk` | FFI binding crates for Java/.NET. A release triggers the downstream Java/.NET SDK build and publish. | | `runtime-sdk-node` | `libs/runtime/sdk/node` | Node.js runtime SDK bindings | | `runtime-sdk-python` | `libs/runtime/sdk/python` | Python runtime SDK bindings | +| `runtime-core-app` | `apps/runtime/core` | Core runtime application for ahead-of-time compiled handlers (Docker image published to GHCR) | | `runtime-nodejs` | `apps/runtime/nodejs` | Node.js runtime wrapper application (Docker image published to GHCR) | | `runtime-python` | `apps/runtime/python` | Python runtime wrapper application (Docker image published to GHCR) | diff --git a/apps/runtime/README.md b/apps/runtime/README.md index 10b5c406..aef97232 100644 --- a/apps/runtime/README.md +++ b/apps/runtime/README.md @@ -23,10 +23,8 @@ Developers should make use of the Celerity Python SDK for a smoother development ## [core runtime](./core/README.md) -**_Coming soon as a part of Celerity v1_** - The core (os-only) runtime is for applications where the handlers need to be written in a language that is compiled ahead of time, such as Rust, C, C++ or Go. -This runtime interfaces with handlers by exposing a HTTP API. +This runtime starts the compiled handlers executable as a separate process and hands it events over the [Celerity IPC protocol](../../libs/runtime/proto/README.md), one long-lived bidirectional gRPC stream over a unix socket. Developers can make use of the Celerity SDKs for Rust and Go for a smoother development experience where interactions with the runtime are taken care of and a useful plugin/middleware system provides standard functionality such as loading secrets and dependency injection. @@ -50,4 +48,5 @@ Developers should make use of the Celerity Java SDK for a smoother development e # Additional docs -- [HTTP API Docs](../../libs/runtime/api-docs/README.md) - API docs for the Local Runtime and Handler Invoke APIs where the former is used for handler <-> runtime communication for the os-only runtime. +- [HTTP API Docs](../../libs/runtime/api-docs/README.md) - API docs for the Local Runtime and Handler Invoke APIs. +- [IPC Handler Protocol](../../libs/runtime/proto/README.md) - The contract used for handler <-> runtime communication for the os-only runtime, one long-lived bidirectional gRPC stream over a unix socket. diff --git a/apps/runtime/core/.env.example b/apps/runtime/core/.env.example new file mode 100644 index 00000000..55bf9930 --- /dev/null +++ b/apps/runtime/core/.env.example @@ -0,0 +1,98 @@ +# ============================================================================= +# Celerity Core Runtime — Environment Variables +# ============================================================================= + +# --- Required --- + +# Path to the blueprint YAML file defining API routes and handler metadata. +CELERITY_BLUEPRINT=./app/blueprint.yaml + +# Path to the compiled handlers executable that the runtime starts and streams +# events to. The runtime exits if it cannot be started. +CELERITY_HANDLERS_EXECUTABLE=./app/handlers + +# Service name used for logging and distributed tracing. +CELERITY_SERVICE_NAME=my-service + +# HTTP server port. +CELERITY_SERVER_PORT=8080 + +# Deployment platform: aws, azure, gcp, local, or other. +CELERITY_RUNTIME_PLATFORM=local + +# Runtime call mode. Must be "ipc" for the core runtime; it has no in-process +# handlers to call. Defaults to "ipc" in the Docker image. +CELERITY_RUNTIME_CALL_MODE=ipc + +# --- Handlers executable --- + +# Arguments passed to the handlers executable, split on whitespace. +# CELERITY_HANDLERS_ARGS=--verbose + +# Directory the handlers executable is started in. The runtime's own working +# directory when unset. +# CELERITY_HANDLERS_WORKING_DIR=./app + +# Seconds between SIGTERM and SIGKILL for the handlers executable on shutdown. +# This covers the executable's own teardown; CELERITY_DRAIN_TIMEOUT covers the +# in-flight events it still owes results for. Defaults to 30. +# CELERITY_HANDLERS_SHUTDOWN_TIMEOUT=30 + +# Seconds the handlers executable has to attach to the handler stream before the +# runtime gives up and exits non-zero. A process that starts but never attaches +# never exits, so without this it looks healthy while every event is shed. +# Set to 0 to wait indefinitely. Defaults to 60. +# CELERITY_HANDLERS_START_TIMEOUT=60 + +# --- Handler stream (IPC) --- + +# Unix socket the handler stream is served on. The handlers executable connects +# to this; a Celerity SDK reads the same variable. +# CELERITY_RUNTIME_SOCKET=/var/run/celerity/runtime.sock + +# Serve the handler stream over loopback TCP when the unix socket cannot be +# bound. Any process that can reach loopback can then register as a handler, so +# this is off by default. +# CELERITY_RUNTIME_SOCKET_FALLBACK_ENABLED=false +# CELERITY_RUNTIME_SOCKET_FALLBACK_PORT=8592 + +# Seconds the runtime waits for in-flight events to come back over the stream +# on shutdown. Derived from the configured handler timeouts when unset. +# CELERITY_DRAIN_TIMEOUT=30 + +# --- Optional --- + +# Bind to loopback (127.0.0.1) only. Set to false in Docker containers. +# CELERITY_SERVER_LOOPBACK_ONLY=true + +# Runtime diagnostics level: trace, debug, info, warn, error. Defaults to info. +# CELERITY_MAX_DIAGNOSTICS_LEVEL=info + +# Log format: json or text. +# CELERITY_LOG_FORMAT=json + +# --- Telemetry --- + +# OTLP collector endpoint for trace export. +# CELERITY_TRACE_OTLP_COLLECTOR_ENDPOINT=http://otelcollector:4317 + +# Emit OpenTelemetry metrics. Defaults to false. +# CELERITY_METRICS_ENABLED=false + +# Ratio of traces sampled, from 0.0 to 1.0. +# CELERITY_TRACE_SAMPLE_RATIO=1.0 + +# --- Advanced --- + +# Disable the default /runtime/health/check endpoint. +# CELERITY_USE_CUSTOM_HEALTH_CHECK=true + +# Client IP detection source. Default: ConnectInfo. +# Options: ConnectInfo, XForwardedFor, XRealIp, Forwarded, TrueClientIp, CFConnectingIp +# CELERITY_CLIENT_IP_SOURCE=ConnectInfo + +# Cache TTL in seconds for the runtime resource store (JWT keys, OIDC discovery). +# CELERITY_RESOURCE_STORE_CACHE_ENTRY_TTL=600 + +# TLS verification for resource store HTTP requests. +# CELERITY_RESOURCE_STORE_VERIFY_TLS=true diff --git a/apps/runtime/core/.gitignore b/apps/runtime/core/.gitignore new file mode 100644 index 00000000..2f7896d1 --- /dev/null +++ b/apps/runtime/core/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/apps/runtime/core/ARCHITECTURE_OVERVIEW.md b/apps/runtime/core/ARCHITECTURE_OVERVIEW.md index 39cb930b..7026d77a 100644 --- a/apps/runtime/core/ARCHITECTURE_OVERVIEW.md +++ b/apps/runtime/core/ARCHITECTURE_OVERVIEW.md @@ -1,17 +1,23 @@ # Architecture Overview -**_Coming soon as a part of Celerity v1_** +The core runtime is an application that acts as a HTTP server, WebSocket server and a message queue consumer. It is responsible for processing incoming requests and messages/events; it then tags each one with the handler that is to run it and puts it on an in-memory queue, from which it is dispatched to the handlers executable that runs the handler developers defined. -The core runtime is an application that acts as a HTTP server, WebSocket server and a message queue consumer. It is responsible for processing incoming requests and messages/events; it then tags and stores them to be retrieved by the handlers executable that is then responsible for routing requests or messages to the appropriate handlers defined by developers. +The core runtime is a Rust application that interacts with handlers over the [Celerity IPC protocol](../../../libs/runtime/proto/README.md): one long-lived bidirectional gRPC stream over a unix socket, carrying events, results, configuration, WebSocket sends, cancellation and shutdown. This means that it doesn't matter what language the handlers are written in, as long as they can be executed and can speak the protocol, which a Celerity SDK for the language does on their behalf. -The core runtime is a Rust application that interacts with handlers by exposing a HTTP API. This means that it doesn't matter what language the handlers are written in, as long as they can be executed and communicate with the local runtime API over HTTP. +The stream is what makes this different from a polling API. The runtime does not dispatch until the handlers executable has declared what it serves and how much work it can take, it grants credit rather than letting work pile up on a process that cannot keep up, and it can cancel an event that has passed its deadline instead of waiting to find out. -When using the core runtime there are two processes that are started, the main runtime process and the process for your compiled binary that contains your application's handlers. The process containing your handlers will contain a loop that reads requests/messages from the runtime via a HTTP API and executes the appropriate handler. +When using the core runtime there are two processes that are started, the main runtime process and the process for your compiled binary that contains your application's handlers. The runtime starts the second itself, once the handler stream is bound, and the two share a lifetime: the runtime drains and stops the executable on shutdown, and stops itself if the executable exits while it is still serving. The core runtime is best suited for applications where the handlers need to be written in a language that is compiled ahead of time, such as Rust, C, C++ or Go. -The core runtime has a plugin system that can be called at the "pre-handle" and "post-handle" stages of processing a request or message. This plugin system is meant to be lightweight and only deal with essential tasks such as authentication and handling CORS headers, the primary interaction developers using the runtime will have with this is configuration for CORS and auth in a blueprint definition for an application. -**_This is not interchangeable with the plugin systems defined for language-specific SDKs for handlers, all core runtime plugins must be written in Rust._** +The core runtime processes a request or message through a stack of **layers**. Each layer wraps the one inside it: it runs whatever it needs to before calling `next`, and whatever it needs to after that call returns, so a single layer sees both the way in and the way out. The innermost `next` is the dispatch to the handlers executable. + +Timing a request, adding a header to whatever response comes back, or turning a handler's error into a response body all need the same layer to see both sides. A layer can also decline to call `next` at all and return its own response, which is how authentication rejects a request before it reaches a handler, and how a cached response is served without one. + +Layers run outermost first on the way in and unwind in the reverse order on the way out, so the order they are declared in is the order they see the request. + +The layer system is meant to be lightweight and only deal with essential tasks such as authentication and handling CORS headers; the primary interaction developers using the runtime will have with it is configuration for CORS and auth in a blueprint definition for an application. +**_This is not interchangeable with the middleware systems defined for language-specific SDKs for handlers, all core runtime layers must be written in Rust._** ## Run-time flow @@ -42,17 +48,21 @@ On receiving a message to be sent to a specific connection, a node will look up The runtime supports a serverless-like approach to sending messages to specific connections, where the runtime will handle the routing of messages to the correct node in the cluster. -Here is some Python pseudo-code to illustrate this for the purpose of relaying a message to all clients in a chat room: - -```python -from celerity_runtime.wsconn import send_message - -def handler(event, chat_room_service, context): - room = event['room'] - message = event['message'] - connection_ids = chat_room_service.get_connections(room) - for connection_id in connection_ids: - send_message(connection_id, message) +Here is some Go pseudo-code to illustrate this for the purpose of relaying a message to all clients in a chat room: + +```go +func Handler(ctx context.Context, event ChatEvent, rooms ChatRoomService) error { + connectionIDs, err := rooms.GetConnections(event.Room) + if err != nil { + return err + } + for _, connectionID := range connectionIDs { + if err := wsconn.SendMessage(ctx, connectionID, event.Message); err != nil { + return err + } + } + return nil +} ``` This allows for implementing features such as chat rooms or real-time collaboration without having to worry about which node a connection is on. diff --git a/apps/runtime/core/CHANGELOG.md b/apps/runtime/core/CHANGELOG.md new file mode 100644 index 00000000..825c32f0 --- /dev/null +++ b/apps/runtime/core/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/apps/runtime/core/CONTRIBUTING.md b/apps/runtime/core/CONTRIBUTING.md new file mode 100644 index 00000000..eef2bf3b --- /dev/null +++ b/apps/runtime/core/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing to the core runtime + +## Setup + +The app is its own cargo workspace, with path dependencies on the runtime crates under `libs/runtime`. It is not a member of that workspace: it pins exact dependency versions and is released as a container image on its own cadence, neither of which fits a workspace whose members are libraries released together. + +```bash +cd apps/runtime/core +cargo build +``` + +Changes to `libs/runtime` are picked up straight away, since the dependencies are paths rather than versions. + +## Before committing + +```bash +cargo fmt +cargo clippy --all-targets -- -D warnings +cargo test +``` + +## Running it locally + +The runtime needs a blueprint and a handlers executable to start: + +```bash +cp .env.example .env +# Point CELERITY_BLUEPRINT and CELERITY_HANDLERS_EXECUTABLE at your own +cargo run +``` + +Or build the image, from the repository root, since the build context needs both directories: + +```bash +docker build -f apps/runtime/core/Dockerfile --target dev -t celerity-runtime-core:dev . +``` + +## What belongs here + +Only the process around the runtime including reading the environment, starting the runtime, starting and supervising the handlers executable, and shutdown ordering. Everything the runtime itself does belongs in `libs/runtime/core` under the `lib-rt-core` commit scope, where it is shared with the language-specific runtimes. + +## Commit scope + +`runtime-core` + +```text +feat(runtime-core): restart the handlers executable on failure +``` + +The release component is `runtime-core-app` rather than `runtime-core`, because the `runtime-core` component name is already the tag prefix for the Rust crates under `libs/runtime`. Scopes and components are separate, release-please routes a commit by the paths it changes, not by its scope, so a `runtime-core` commit touching this directory lands in the `runtime-core-app` component. + +See [COMMIT_GUIDELINES.md](../../../COMMIT_GUIDELINES.md) for the full conventions. diff --git a/apps/runtime/core/Cargo.lock b/apps/runtime/core/Cargo.lock new file mode 100644 index 00000000..d76fe513 --- /dev/null +++ b/apps/runtime/core/Cargo.lock @@ -0,0 +1,3188 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "axum" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" +dependencies = [ + "async-trait", + "axum-core 0.3.4", + "bitflags 1.3.2", + "bytes", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "itoa", + "matchit 0.7.3", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper 0.1.2", + "tower 0.4.13", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b698c5f9a010f6573133b09e0de5408834d0c82f8d7475a89fc1867a71cd90" +dependencies = [ + "axum-core 0.5.6", + "axum-macros", + "base64 0.22.1", + "bytes", + "form_urlencoded", + "futures-util", + "http 1.5.0", + "http-body 1.1.0", + "http-body-util", + "hyper 1.11.0", + "hyper-util", + "itoa", + "matchit 0.8.4", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde_core", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sha1", + "sync_wrapper 1.0.2", + "tokio", + "tokio-tungstenite", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-client-ip" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8ba1af5b620232acf37f2eb6d22151ea465491e0b4c25f552d1990f64ec5a67" +dependencies = [ + "axum 0.8.9", + "client-ip", + "serde", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c78f31d7b1291f7ee735c1c6780ccde7785daae9a9206026862dab7d8792d1" +dependencies = [ + "bytes", + "futures-core", + "http 1.5.0", + "http-body 1.1.0", + "http-body-util", + "mime", + "pin-project-lite", + "sync_wrapper 1.0.2", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-extra" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9963ff19f40c6102c76756ef0a46004c0d58957d87259fc9208ff8441c12ab96" +dependencies = [ + "axum 0.8.9", + "axum-core 0.5.6", + "bytes", + "cookie", + "futures-util", + "headers", + "http 1.5.0", + "http-body 1.1.0", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "serde_core", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aa268c23bfbbd2c4363b9cd302a4f504fb2a9dfe7e3451d66f35dd392e20aca" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +dependencies = [ + "serde", +] + +[[package]] +name = "cc" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "509591b7bcd67f4ef775afad7662703b4935daaa6ec0e5605cfb1090b32a2b6d" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "celerity-runtime-core-app" +version = "0.1.0" +dependencies = [ + "celerity_helpers", + "celerity_runtime_core", + "libc", + "pretty_assertions", + "tokio", + "tracing", +] + +[[package]] +name = "celerity_blueprint_config_parser" +version = "0.1.0" +dependencies = [ + "celerity_blueprint_lang", + "celerity_helpers", + "hashlink", + "json-strip-comments", + "serde", + "serde_json", + "tracing", + "yaml-rust2", +] + +[[package]] +name = "celerity_blueprint_lang" +version = "0.1.0" +dependencies = [ + "hashlink", + "serde", + "tracing", +] + +[[package]] +name = "celerity_helpers" +version = "0.1.0" +dependencies = [ + "async-trait", + "axum 0.8.9", + "axum-extra", + "chrono", + "futures", + "jsonpath-rust", + "opentelemetry", + "rand 0.8.7", + "redis", + "reqwest", + "serde", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "celerity_runtime_core" +version = "0.1.0" +dependencies = [ + "async-trait", + "axum 0.8.9", + "axum-client-ip", + "axum-extra", + "base64 0.22.1", + "bytes", + "celerity_blueprint_config_parser", + "celerity_helpers", + "celerity_ws_registry", + "form_urlencoded", + "futures", + "http-body-util", + "jsonpath-rust", + "jsonwebtoken", + "nanoid", + "opentelemetry", + "opentelemetry-aws", + "opentelemetry-otlp", + "opentelemetry_sdk", + "percent-encoding", + "prost 0.14.4", + "reqwest", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tokio-util", + "tonic 0.14.6", + "tonic-prost", + "tower 0.4.13", + "tower-http", + "tracing", + "tracing-opentelemetry", + "tracing-subscriber", +] + +[[package]] +name = "celerity_ws_registry" +version = "0.1.0" +dependencies = [ + "async-trait", + "axum 0.8.9", + "base64 0.22.1", + "celerity_helpers", + "futures", + "jsonpath-rust", + "serde", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chacha20" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "client-ip" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39d2056bf065c8b4bce5a8898d40e175211ff4410add2a84d695845d3937c729" +dependencies = [ + "http 1.5.0", +] + +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "futures-core", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + +[[package]] +name = "crc16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338089f42c427b86394a5ee60ff321da23a5c89c9d89514c829687b26359fcff" + +[[package]] +name = "crossbeam-channel" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d85363c37faeca707aef026efa9f3b34d077bce547e48f770770625c6013679e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "either" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5e8f6c15a24b9a3ee5efec809ccd006d3b30e8b3bb63c39af737c7f87daa1d" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d45db016d36b838f563236e9193d0ee6ce38f3f68b6c94e914b4929c96bbb890" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a31d2a3fbaaeb2af2368bbdd904aa8e812d3c04a1ee10d3171f52d556e5d0a3" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasm-bindgen", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "h2" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.14.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9f37a958b41b3b19ee2707c06439c0e9e547e847223eb791ecb0cb821c65e27" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.5.0", + "indexmap 2.14.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "hashlink" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" +dependencies = [ + "hashbrown 0.14.5", + "serde", +] + +[[package]] +name = "headers" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3314d5adb5d94bcdf56771f2e50dbbc80bb4bdf88967526706205ac9eff24eb" +dependencies = [ + "base64 0.22.1", + "bytes", + "headers-core", + "http 1.5.0", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http 1.5.0", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http 1.5.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http 1.5.0", + "http-body 1.1.0", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.10", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d22053281f852e11534f5198498373cbb59295120a20771d90f7ed1897490a72" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "h2 0.4.16", + "http 1.5.0", + "http-body 1.1.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http 1.5.0", + "hyper 1.11.0", + "hyper-util", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper 0.14.32", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + +[[package]] +name = "hyper-timeout" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" +dependencies = [ + "hyper 1.11.0", + "hyper-util", + "pin-project-lite", + "tokio", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-channel", + "futures-util", + "http 1.5.0", + "http-body 1.1.0", + "hyper 1.11.0", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2 0.6.5", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92a7ed671a6aad807a8651a2e1782a6598fda9ce5185dd8158549e95a91c6428" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", +] + +[[package]] +name = "ipnet" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a756c3fac73139e83f14c2d742155dd2b78d3ee56597b419a0579b7bdd6dd78" + +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0c1080212aad755ea003d18543e8768dd432c48819efd73a7bf1e39b7a5a3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-strip-comments" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b271732a960335e715b6b2ae66a086f115c74eb97360e996d2bd809bfc063bba" +dependencies = [ + "memchr", +] + +[[package]] +name = "jsonpath-rust" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c00ae348f9f8fd2d09f82a98ca381c60df9e0820d8d79fce43e649b4dc3128b" +dependencies = [ + "pest", + "pest_derive", + "regex", + "serde_json", + "thiserror 2.0.20", +] + +[[package]] +name = "jsonwebtoken" +version = "9.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a87cc7a48537badeae96744432de36f4be2b4a34a05a5ef32e9dd8a1c169dde" +dependencies = [ + "base64 0.22.1", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.189" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matchers" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "matchit" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e1ffaa40ddd1f3ed91f717a33c8c0ee23fff369e3aa8772b9605cc1d22f4c3" + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mio" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d65c71f1ce40ab09135ce117d742b9f8a19ff91a41a8b57ed50bc2de59c427" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "nanoid" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ffa00dec017b5b1a8b7cf5e2c008bfda1aa7e0697ac1508b491fdf2622fb4d8" +dependencies = [ + "rand 0.8.7", +] + +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-integer" +version = "0.1.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl-probe" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" + +[[package]] +name = "opentelemetry" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d57987be3f2aeb70d385fff9b27fb74c5723cc9a52d904d4f9c807a0667bf" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror 1.0.69", + "urlencoding", +] + +[[package]] +name = "opentelemetry-aws" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42c915961c059be65af3be9aeaedb3f8930e1e9590e26e5f23b1919e90d1ed7d" +dependencies = [ + "once_cell", + "opentelemetry", + "opentelemetry_sdk", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a016b8d9495c639af2145ac22387dcb88e44118e45320d9238fbf4e7889abcb" +dependencies = [ + "async-trait", + "futures-core", + "http 0.2.12", + "opentelemetry", + "opentelemetry-proto", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "prost 0.12.6", + "thiserror 1.0.69", + "tokio", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8fddc9b68f5b80dae9d6f510b88e02396f006ad48cac349411fbecc80caae4" +dependencies = [ + "opentelemetry", + "opentelemetry_sdk", + "prost 0.12.6", + "tonic 0.11.0", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9ab5bd6c42fb9349dcf28af2ba9a0667f697f9bdcca045d39f2cec5543e2910" + +[[package]] +name = "opentelemetry_sdk" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e90c7113be649e31e9a0f8b5ee24ed7a16923b322c3c5ab6367469c049d6b7e" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "glob", + "once_cell", + "opentelemetry", + "ordered-float", + "percent-encoding", + "rand 0.8.7", + "thiserror 1.0.69", + "tokio", + "tokio-stream", +] + +[[package]] +name = "ordered-float" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" +dependencies = [ + "num-traits", +] + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "pem" +version = "3.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d30c53c26bc5b31a98cd02d20f25a7c8567146caf63ed593a9d87b2775291be" +dependencies = [ + "base64 0.22.1", + "serde_core", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a07a60cc7a4d00c91f95c685609d1d2f79050e6804b70ebedd7650f0b839bcf" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a83744a5c8455b8b3e0dc5031362780a347c878bdd11584d1a8984228cc88d" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0cd3451aa3de60d4b9a1e736885e4dea6b31617598026f12256ad566d63304a" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pest_meta" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d3a0849e241d7dfce834c83b1c5edc8622009e8dd51a12ba1927c32f05496" +dependencies = [ + "pest", +] + +[[package]] +name = "pin-project" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb1435c188b76130da55f17a466d252ff7b1418b2ad3e037d127b94e3411f29" +dependencies = [ + "bytes", + "prost-derive 0.12.6", +] + +[[package]] +name = "prost" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528ac67416ff8646872a3c02cad9cc4ee5dc9f9540c9b10771855c95cb2e5ae1" +dependencies = [ + "bytes", + "prost-derive 0.14.4", +] + +[[package]] +name = "prost-derive" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81bddcdb20abf9501610992b6759a4c888aef7d1a7247ef75e2404275ac24af1" +dependencies = [ + "anyhow", + "itertools 0.12.1", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "prost-derive" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b570b25f7617e43d59005d0990ccb79e950a423952cea19671b7a876da390adf" +dependencies = [ + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "quinn" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c1a41e437b6bbd489372cd4971de128e85c855f56c57f283d20ff016cf7c0a8" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2 0.6.5", + "thiserror 2.0.20", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04759210543be93709136e28212294a659ef5001836ff4eab4d663e4529bba83" +dependencies = [ + "bytes", + "getrandom 0.4.3", + "lru-slab", + "rand 0.10.2", + "rand_pcg", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.20", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35a133f956daabe89a61a685c2649f13d82d5aa4bd5d12d1277e1072a21c0694" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.5", + "tracing", + "windows-sys 0.61.2", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22f6172bdec972074665ed81ed53b71da00bfc44b65a753cfde883ec4c702a1a" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "rand_pcg" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caa0f4137e1c0a72f4c651489402276c8e8e1cf081f3b0ba156d2cbeef09e86a" +dependencies = [ + "rand_core 0.10.1", +] + +[[package]] +name = "redis" +version = "0.32.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "014cc767fefab6a3e798ca45112bccad9c6e0e218fbd49720042716c73cfef44" +dependencies = [ + "bytes", + "cfg-if", + "combine", + "crc16", + "futures-sink", + "futures-util", + "itoa", + "log", + "num-bigint", + "percent-encoding", + "pin-project-lite", + "rand 0.9.5", + "ryu", + "sha1_smol", + "socket2 0.6.5", + "tokio", + "tokio-util", + "url", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.1", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64 0.22.1", + "bytes", + "futures-core", + "http 1.5.0", + "http-body 1.1.0", + "http-body-util", + "hyper 1.11.0", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-native-certs", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.2", + "tokio", + "tokio-rustls", + "tower 0.5.3", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustls" +version = "0.23.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0527518605e68109d875e248ea259b6758801cf165e4b2c2733ae3b51f12535a" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "schannel" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.1", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "serde_json" +version = "1.0.151" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a978451301f4db1d02937a4ab3ccce137717b81826e79b7d49ffe3244a13c3b8" +dependencies = [ + "cfg-if", + "cpufeatures 0.2.17", + "digest", +] + +[[package]] +name = "sha1_smol" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d" + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simple_asn1" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d585997b0ac10be3c5ee635f1bab02d512760d14b7c468801ac8a01d9ae5f1d" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror 2.0.20", + "time", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e9bae58849f64dfa4f5d5ae372c8341f7305f82a3868709269343628b659a3" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +dependencies = [ + "thiserror-impl 2.0.20", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "thread_local" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad99c4c6d32803332c548b1af0540b357b3f5fc0be8f6c6bfe8b2e6ae784070" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.6.5", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bd86198d9ee903fedd2f9a2e72014287c0d9167e4ae43b5853007205dda1b76" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f72a05e828585856dacd553fba484c242c46e391fb0e58917c942ee9202915c" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + +[[package]] +name = "tokio-util" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "libc", + "pin-project-lite", + "slab", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76c4eb7a4e9ef9d4763600161f12f5070b92a578e1b634db88a6887844c91a13" +dependencies = [ + "async-stream", + "async-trait", + "axum 0.6.20", + "base64 0.21.7", + "bytes", + "h2 0.3.27", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.32", + "hyper-timeout 0.4.1", + "percent-encoding", + "pin-project", + "prost 0.12.6", + "tokio", + "tokio-stream", + "tower 0.4.13", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac2a5518c70fa84342385732db33fb3f44bc4cc748936eb5833d2df34d6445ef" +dependencies = [ + "async-trait", + "axum 0.8.9", + "base64 0.22.1", + "bytes", + "h2 0.4.16", + "http 1.5.0", + "http-body 1.1.0", + "http-body-util", + "hyper 1.11.0", + "hyper-timeout 0.5.2", + "hyper-util", + "percent-encoding", + "pin-project", + "socket2 0.6.5", + "sync_wrapper 1.0.2", + "tokio", + "tokio-stream", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tonic-prost" +version = "0.14.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50849f68853be452acf590cde0b146665b8d507b3b8af17261df47e02c209ea0" +dependencies = [ + "bytes", + "prost 0.14.4", + "tonic 0.14.6", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 1.9.3", + "pin-project", + "pin-project-lite", + "rand 0.8.7", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "indexmap 2.14.0", + "pin-project-lite", + "slab", + "sync_wrapper 1.0.2", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.1", + "bytes", + "futures-util", + "http 1.5.0", + "http-body 1.1.0", + "pin-project-lite", + "tower 0.5.3", + "tower-layer", + "tower-service", + "tracing", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9be14ba1bbe4ab79e9229f7f89fab8d120b865859f10527f31c033e599d2284" +dependencies = [ + "js-sys", + "once_cell", + "opentelemetry", + "opentelemetry_sdk", + "smallvec", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", + "web-time", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tungstenite" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c01152af293afb9c7c2a57e4b559c5620b421f6d133261c60dd2d0cdb38e6b8" +dependencies = [ + "bytes", + "data-encoding", + "http 1.5.0", + "httparse", + "log", + "rand 0.9.5", + "sha1", + "thiserror 2.0.20", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b70935747edd64d89de3efa29d73789b806c15798f8e7dca4d8ac356b50ce70" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b7777d5cc23d0e91404e53ce2d5e8ec7acae3026b16233dba62cd3246457950" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77775f8f3f7217702089053b94958f8f54061a3f663417df76e19cbdcca29bc1" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e11d33f857dc2fb11b8bc75aee111aa9cbeb12cd9f25efd3d4c2a3dd4e235284" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.119", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.127" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef64dbcc55df09c7e5a46182d181c2cfa3e925f3da937ea764728b4bbb9dcbf" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c435338968042f4f59a557f690a253676d47ce13ceb55d70100e7facf6620a30" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yaml-rust2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8902160c4e6f2fb145dbe9d6760a75e3c9522d8bf796ed7047c85919ac7115f8" +dependencies = [ + "arraydeque", + "encoding_rs", + "hashlink", +] + +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556764e583adb45a9f8d413c2a147fa7e8d821e48e12b14fd560b607998b75eb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ab42fc20575779bd240faa45f94a74256f755c0fa9e89f0ede20d91d0cdfc1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b5c6b5976d66c1d703c4fd17d3f5e43c8cedaacf604961b171adc7130896d8" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f212a141d820099d57ffafb9569be9617a6f27d3dc881fbee8fb56642f917a9" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/apps/runtime/core/Cargo.toml b/apps/runtime/core/Cargo.toml new file mode 100644 index 00000000..baec06c1 --- /dev/null +++ b/apps/runtime/core/Cargo.toml @@ -0,0 +1,31 @@ +# A workspace of its own rather than a member of the one under `libs/runtime`. +# The app pins exact dependency versions and is released as a container image on +# its own cadence, neither of which fits a workspace whose members are libraries +# published together. +[workspace] +members = ["."] + +[package] +name = "celerity-runtime-core-app" +version = "0.1.0" +edition = "2021" +license = "Apache-2.0" +publish = false + +[[bin]] +name = "celerity-runtime-core" +path = "src/main.rs" + +[dependencies] +libc = "=0.2.189" +tokio = { version = "=1.53.1", features = ["full"] } +tracing = "=0.1.44" + +[dependencies.celerity_runtime_core] +path = "../../../libs/runtime/core" + +[dependencies.celerity_helpers] +path = "../../../libs/runtime/helpers" + +[dev-dependencies] +pretty_assertions = "=1.4.1" diff --git a/apps/runtime/core/Dockerfile b/apps/runtime/core/Dockerfile new file mode 100644 index 00000000..95b30803 --- /dev/null +++ b/apps/runtime/core/Dockerfile @@ -0,0 +1,102 @@ +# ============================================================================= +# Celerity Core Runtime - Multi-Target Dockerfile (Docker Hardened Images) +# +# The core runtime serves HTTP, WebSockets and queue consumers, and hands the +# events it takes to a handlers executable over the Celerity IPC protocol. This +# image is a base image: it carries the runtime and no handlers. Build your own +# image FROM it, add your compiled handlers executable, and point +# CELERITY_HANDLERS_EXECUTABLE at it. +# +# FROM ghcr.io/newstack-cloud/celerity-runtime-core:1.0.0 +# COPY --chown=nobody handlers /opt/celerity/app/handlers +# COPY --chown=nobody blueprint.yaml /opt/celerity/app/blueprint.yaml +# +# Targets: +# runtime — Production (no shell, no package manager) +# dev — Development (shell and the usual debugging tools) +# +# The build context is the repository root, because the runtime crates the app +# depends on live under libs/runtime: +# docker build -f apps/runtime/core/Dockerfile --target runtime . +# ============================================================================= + +# ----------------------------------------------------------------------------- +# Stage 1: Build the runtime binary +# ----------------------------------------------------------------------------- +FROM dhi.io/rust:1.97 AS builder + +WORKDIR /build + +# The path dependencies have to be in place before the manifest resolves, so +# the whole of libs/runtime is copied rather than just the crates named in +# Cargo.toml — those crates depend on their siblings in turn. +# Copied as the image's own non-root user (uid 65532), which owns none of the +# default /build workdir, so that cargo can write its target directory. +COPY --chown=65532:65532 libs/runtime/ libs/runtime/ +COPY --chown=65532:65532 apps/runtime/core/Cargo.toml apps/runtime/core/Cargo.lock apps/runtime/core/ +COPY --chown=65532:65532 apps/runtime/core/src/ apps/runtime/core/src/ + +WORKDIR /build/apps/runtime/core + +RUN cargo build --release --locked + +# Created here rather than in the later stages, which have no shell to run +# mkdir in, and copied out with the ownership the runtime needs. +RUN mkdir -p /tmp/skeleton/app /tmp/skeleton/socket + +# ----------------------------------------------------------------------------- +# Stage 2: Production runtime (no shell, no package manager) +# ----------------------------------------------------------------------------- +FROM dhi.io/debian-base:trixie AS runtime + +COPY --from=builder /build/apps/runtime/core/target/release/celerity-runtime-core \ + /usr/local/bin/celerity-runtime-core + +# The directory the handler stream socket is bound in, and the one a derivative +# image puts its handlers executable and blueprint in. Both are owned by the +# user the runtime runs as, since it binds the socket and reads the blueprint. +COPY --from=builder --chown=nobody /tmp/skeleton/app/ /opt/celerity/app/ +COPY --from=builder --chown=nobody /tmp/skeleton/socket/ /var/run/celerity/ + +ENV CELERITY_RUNTIME_CALL_MODE=ipc \ + CELERITY_SERVER_PORT=8080 \ + CELERITY_RUNTIME_PLATFORM=other \ + CELERITY_SERVER_LOOPBACK_ONLY=false \ + CELERITY_BLUEPRINT=/opt/celerity/app/blueprint.yaml \ + CELERITY_HANDLERS_EXECUTABLE=/opt/celerity/app/handlers \ + CELERITY_RUNTIME_SOCKET=/var/run/celerity/runtime.sock + +EXPOSE 8080 + +USER nobody + +ENTRYPOINT ["celerity-runtime-core"] + +# ----------------------------------------------------------------------------- +# Stage 3: Development image (has a shell, for getting inside a running app) +# ----------------------------------------------------------------------------- +FROM dhi.io/debian-base:trixie-dev AS dev + +COPY --from=builder /build/apps/runtime/core/target/release/celerity-runtime-core \ + /usr/local/bin/celerity-runtime-core + +COPY --from=builder --chown=nobody /tmp/skeleton/app/ /opt/celerity/app/ +COPY --from=builder --chown=nobody /tmp/skeleton/socket/ /var/run/celerity/ + +# The same defaults as the production image. The dev image differs in having a +# shell and the tools to debug with, not in how the runtime behaves; platform is +# a deploy target rather than a build flavour, and `local` selects different +# consumers. The FFI dev images (e.g. Node.js) behave this way too. +ENV CELERITY_RUNTIME_CALL_MODE=ipc \ + CELERITY_SERVER_PORT=8080 \ + CELERITY_RUNTIME_PLATFORM=other \ + CELERITY_SERVER_LOOPBACK_ONLY=false \ + CELERITY_BLUEPRINT=/opt/celerity/app/blueprint.yaml \ + CELERITY_HANDLERS_EXECUTABLE=/opt/celerity/app/handlers \ + CELERITY_RUNTIME_SOCKET=/var/run/celerity/runtime.sock + +EXPOSE 8080 + +USER nobody + +ENTRYPOINT ["celerity-runtime-core"] diff --git a/apps/runtime/core/Dockerfile.dockerignore b/apps/runtime/core/Dockerfile.dockerignore new file mode 100644 index 00000000..11fae8de --- /dev/null +++ b/apps/runtime/core/Dockerfile.dockerignore @@ -0,0 +1,19 @@ +# The build context is the repository root, so this excludes everything outside +# the two directories the build needs, and the build output inside them. +* +!libs/runtime +!apps/runtime/core + +libs/runtime/**/target/ +libs/runtime/**/.venv/ +libs/runtime/**/node_modules/ +libs/runtime/**/__pycache__/ +libs/runtime/benchmarks/ +libs/runtime/docs/ +libs/runtime/api-docs/ +libs/runtime/**/*.md + +apps/runtime/core/target/ +apps/runtime/core/resources/ +apps/runtime/core/*.md +apps/runtime/core/.env* diff --git a/apps/runtime/core/README.md b/apps/runtime/core/README.md index 8eec3953..050fdb24 100644 --- a/apps/runtime/core/README.md +++ b/apps/runtime/core/README.md @@ -1,10 +1,80 @@ # core runtime -**_Coming soon as a part of Celerity v1_** +The core runtime is for applications where the handlers are written in a language that is compiled ahead of time, such as Rust, C, C++ or Go. +It serves HTTP, WebSockets and queue consumers, and hands the events it takes to a **handlers executable** — a separate process compiled from your own code — over the [Celerity IPC protocol](../../../libs/runtime/proto/README.md). -The core runtime is for applications where the handlers need to be written in a language that is compiled ahead of time, such as Rust, C, C++ or Go. -This runtime interfaces with handlers by exposing a HTTP API. +The IPC protocol is one long-lived bidirectional gRPC stream over a unix socket. It carries events, results, configuration, WebSocket sends, cancellation and shutdown. Your handlers executable is expected to use a Celerity SDK for its language rather than to speak the protocol directly. + +## The image + +`ghcr.io/newstack-cloud/celerity-runtime-core` is a base image: it carries the runtime and no handlers. Build your own image from it and add your compiled executable and blueprint. + +```dockerfile +FROM ghcr.io/newstack-cloud/celerity-runtime-core:0.1.0 + +COPY --chown=nobody handlers /opt/celerity/app/handlers +COPY --chown=nobody blueprint.yaml /opt/celerity/app/blueprint.yaml +``` + +Both paths are the defaults, so nothing else needs configuring to start. A `dev-` tagged image is published alongside each release with a shell and the usual debugging tools, for getting inside a running application locally. + +## Two processes, one lifetime + +The runtime is PID 1 in the container and starts the handlers executable itself, once the handler stream is bound and ready to be connected to. The executable inherits the runtime's environment, which is how it is told where to connect: `CELERITY_RUNTIME_SOCKET` is already there for an SDK to read. It also inherits stdout and stderr, so its logs reach the container's streams as it wrote them. + +The two processes stand or fall together: + +- On `SIGTERM` or `SIGINT`, the runtime stops taking new work and sends `Drain` over the stream, waits for in-flight events to come back within `CELERITY_DRAIN_TIMEOUT`, then sends `SIGTERM` to the executable and gives it `CELERITY_HANDLERS_SHUTDOWN_TIMEOUT` seconds to exit before killing it. +- If the handlers executable exits while the runtime is still serving, the runtime stops and exits non-zero. There is nothing left to dispatch to, so a clean exit from the executable is no better than a crash; exiting non-zero is what gets the pair restarted. +- If the handlers executable starts but never attaches to the handler stream within `CELERITY_HANDLERS_START_TIMEOUT`, the runtime stops and exits non-zero. A process that is alive but not serving never exits on its own, so without a deadline it would sit there looking healthy while every event was shed. + +The runtime does not restart the executable on its own. Restarting the container is the orchestrator's job, and it is the only way to be sure both processes come back in the state they started in. + +## Telling the orchestrator something is wrong + +Two signals, covering the two ways a handlers executable fails. + +A process that **dies** takes the runtime with it, and the container exits non-zero, which is what a restart policy acts on. + +A process that is **alive but not serving** never exits, so it shows up in the health check instead. `GET /runtime/health/check` answers the question an orchestrator is really asking which is can this instance serve? In the core runtime it returns `503` while no handlers executable is attached, and `200` once one is. It is the same endpoint, at the same path, that every Celerity runtime serves and that container orchestration services and `celerity dev test` already poll, so nothing needs repointing. The other runtimes are unaffected: their handlers run in-process and cannot be absent, so the check stays unconditionally `200` there. + +An instance is therefore unhealthy between binding its port and its handlers attaching. That is accurate rather than awkward as it cannot serve a request yet but it does mean a deployment wants a start period long enough to cover the executable's own startup, `healthCheck.startPeriod` on ECS or `startupProbe` on Kubernetes. + +`CELERITY_USE_CUSTOM_HEALTH_CHECK` disables the built-in endpoint as before, at which point reporting readiness is the custom handler's job. + +An application with no API in its blueprint whether that be queue consumers or schedules only, has no HTTP server to serve the check from. The start timeout is what covers it, by turning a handler that never attaches into a restart. + +## Configuration + +Every setting is an environment variable. See [.env.example](./.env.example) for the full list with defaults; the ones specific to this runtime are: + +| Variable | Default | Description | +|----------|---------|-------------| +| `CELERITY_HANDLERS_EXECUTABLE` | `/opt/celerity/app/handlers` | Path to the compiled handlers executable. Set it only to override the default path; the executable itself is required either way, and the runtime exits if it cannot be started. | +| `CELERITY_HANDLERS_ARGS` | — | Arguments passed to the executable, split on whitespace. | +| `CELERITY_HANDLERS_WORKING_DIR` | the runtime's own | Directory the executable is started in. | +| `CELERITY_HANDLERS_SHUTDOWN_TIMEOUT` | `30` | Seconds between `SIGTERM` and `SIGKILL` for the executable. | +| `CELERITY_HANDLERS_START_TIMEOUT` | `60` | Seconds the executable has to attach to the handler stream before the runtime gives up and exits non-zero. `0` waits indefinitely. | +| `CELERITY_RUNTIME_SOCKET` | `/var/run/celerity/runtime.sock` | Unix socket the handler stream is served on. | + +## Building locally + +The app is its own cargo workspace with path dependencies on the runtime crates under `libs/runtime`: + +```bash +cd apps/runtime/core +cargo build --release +``` + +The container image builds from the repository root, since the build needs both directories: + +```bash +docker build -f apps/runtime/core/Dockerfile --target runtime -t celerity-runtime-core:local . +``` ## Additional documentation - [Architecture Overview](./ARCHITECTURE_OVERVIEW.md) +- [Contributing](./CONTRIBUTING.md) +- [Releasing](./RELEASING.md) +- [IPC handler protocol](../../../libs/runtime/proto/README.md) diff --git a/apps/runtime/core/RELEASING.md b/apps/runtime/core/RELEASING.md new file mode 100644 index 00000000..cde9b68c --- /dev/null +++ b/apps/runtime/core/RELEASING.md @@ -0,0 +1,47 @@ +# Releasing the Core Runtime + +## Version Strategy + +The core runtime is versioned independently. It has no language SDK to track: the contract it has to stay compatible with is the [IPC handler protocol](../../../libs/runtime/proto/README.md), which is versioned in the proto package path (`celerity.runtime.v1`) rather than in this app's version. + +A change to the protocol that handlers have to be rebuilt for is a breaking change for this app, and gets a `!` or a `BREAKING CHANGE` footer so release-please bumps it accordingly. + +Releases are **not** automatic. Like the Node.js and Python runtimes, this component is gated in `release-please.yml`, so a release PR opened without an explicit `Release-As` footer is closed automatically. Publishing an image is a deliberate act rather than something an ordinary `feat` commit triggers, and it is what lets the version be chosen rather than derived. + +```bash +git commit -m "feat(runtime-core): add the core runtime application + +Release-As: 0.1.0" +``` + +## Release Flow + +1. **release-please** collects commits that change files under `apps/runtime/core` on `main` with the conventionally scoped `runtime-core` and opens a release PR for the `runtime-core-app` component when one of them carries a `Release-As` footer. The component name differs from the scope because `runtime-core` is already the tag prefix for the crates under `libs/runtime`. +2. **Merge** the release PR — release-please creates tag `runtime-core-app/v0.1.0`. +3. The `release-please.yml` `post-process-tags` job dispatches `app-runtime-core-release.yml` with the tag. +4. The release workflow builds and pushes Docker images to GHCR: + - Production: `ghcr.io/newstack-cloud/celerity-runtime-core:0.1.0`, `:0.1`, `:latest` + - Dev: `ghcr.io/newstack-cloud/celerity-runtime-core:dev-0.1.0`, `:dev-latest` +5. Images are scanned (Trivy), signed (cosign keyless), and attested (SBOM + build provenance). + +Both images are built for `linux/amd64` and `linux/arm64`. + +## Image Verification + +```bash +# Verify cosign signature +cosign verify \ + ghcr.io/newstack-cloud/celerity-runtime-core:0.1.0 \ + --certificate-identity="https://github.com/newstack-cloud/celerity/.github/workflows/app-runtime-core-release.yml@refs/heads/main" \ + --certificate-oidc-issuer="https://token.actions.githubusercontent.com" + +# Verify SBOM attestation +cosign verify-attestation --type spdxjson \ + ghcr.io/newstack-cloud/celerity-runtime-core:0.1.0 \ + --certificate-identity="https://github.com/newstack-cloud/celerity/.github/workflows/app-runtime-core-release.yml@refs/heads/main" \ + --certificate-oidc-issuer="https://token.actions.githubusercontent.com" +``` + +## Changelog + +`CHANGELOG.md` is generated by release-please from the conventional commits that change files in this directory. Do not edit it by hand. diff --git a/apps/runtime/core/resources/celerity-runtime-core-aws.png b/apps/runtime/core/resources/celerity-runtime-core-aws.png index 513b7782..9512494a 100644 Binary files a/apps/runtime/core/resources/celerity-runtime-core-aws.png and b/apps/runtime/core/resources/celerity-runtime-core-aws.png differ diff --git a/apps/runtime/core/resources/celerity-runtime-core-startup.png b/apps/runtime/core/resources/celerity-runtime-core-startup.png index 3f7f438a..3426622d 100644 Binary files a/apps/runtime/core/resources/celerity-runtime-core-startup.png and b/apps/runtime/core/resources/celerity-runtime-core-startup.png differ diff --git a/apps/runtime/core/resources/celerity-runtime-core.png b/apps/runtime/core/resources/celerity-runtime-core.png index a75e7c58..9f44fd59 100644 Binary files a/apps/runtime/core/resources/celerity-runtime-core.png and b/apps/runtime/core/resources/celerity-runtime-core.png differ diff --git a/apps/runtime/core/scripts/lint.sh b/apps/runtime/core/scripts/lint.sh new file mode 100755 index 00000000..751269da --- /dev/null +++ b/apps/runtime/core/scripts/lint.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# `--all-targets` so the tests are linted too, which the pre-commit hook is the +# last chance to catch before CI runs the same check with `-D warnings`. +cargo clippy --all-targets -- -D warnings || exit 1 +# `--check` rather than a rewrite, so that formatting drift fails the commit +# instead of being silently fixed in the working tree after the files staged for +# the commit have already been read. +cargo fmt --check || exit 1 diff --git a/apps/runtime/core/src/config.rs b/apps/runtime/core/src/config.rs new file mode 100644 index 00000000..ac7f7a3e --- /dev/null +++ b/apps/runtime/core/src/config.rs @@ -0,0 +1,267 @@ +use std::time::Duration; + +use celerity_helpers::env::EnvVars; + +/// How long to wait for the handlers executable to exit after it has been asked +/// to stop, before it is killed. +const DEFAULT_HANDLERS_SHUTDOWN_TIMEOUT_SECS: u64 = 30; + +/// How long to wait for the handlers executable to attach to the handler stream +/// before giving up on it. +/// +/// Generous enough for an executable that has real work to do before it +/// registers, and for a cold start on a loaded host. +const DEFAULT_HANDLERS_START_TIMEOUT_SECS: u64 = 60; + +/// Settings for the handlers executable that this runtime supervises. +/// +/// The runtime's own settings come from +/// [`celerity_runtime_core::config::RuntimeConfig`]; these cover only the child +/// process, which is this application's reason to exist. +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct SupervisorConfig { + /// Path to the compiled handlers executable, from + /// `CELERITY_HANDLERS_EXECUTABLE`. + pub executable: String, + /// Arguments passed to the executable, from `CELERITY_HANDLERS_ARGS`, split + /// on whitespace. Empty when the variable is unset. + pub args: Vec, + /// Directory the executable is started in, from + /// `CELERITY_HANDLERS_WORKING_DIR`. The runtime's own working directory + /// when unset. + pub working_dir: Option, + /// Grace period between `SIGTERM` and `SIGKILL` for the child, from + /// `CELERITY_HANDLERS_SHUTDOWN_TIMEOUT` in seconds. + /// + /// This is deliberately separate from `CELERITY_DRAIN_TIMEOUT`, which + /// bounds how long the runtime waits for in-flight events to come back over + /// the stream. A handler that has returned every result may still have its + /// own teardown to do. + pub shutdown_timeout: Duration, + /// How long the executable has to attach to the handler stream before the + /// runtime gives up and exits, from `CELERITY_HANDLERS_START_TIMEOUT` in + /// seconds. Zero waits indefinitely. + /// + /// A process that starts but never attaches is the one failure an + /// orchestrator cannot otherwise see: it has not exited, so the container + /// stays up, while every event is shed because nothing serves it. + pub start_timeout: Duration, +} + +#[derive(Debug)] +pub enum ConfigError { + /// A required variable is missing, or one that is set cannot be read as the + /// type it needs to be. + Invalid(String), +} + +impl std::fmt::Display for ConfigError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ConfigError::Invalid(message) => write!(f, "{message}"), + } + } +} + +impl std::error::Error for ConfigError {} + +impl SupervisorConfig { + pub fn from_env(env: &dyn EnvVars) -> Result { + let executable = env.var("CELERITY_HANDLERS_EXECUTABLE").map_err(|_| { + ConfigError::Invalid( + "CELERITY_HANDLERS_EXECUTABLE must be set to the path of the compiled handlers \ + executable that this runtime should start and stream events to" + .to_string(), + ) + })?; + + if executable.trim().is_empty() { + return Err(ConfigError::Invalid( + "CELERITY_HANDLERS_EXECUTABLE is set but empty, it must be the path of the \ + compiled handlers executable" + .to_string(), + )); + } + + let args = env + .var("CELERITY_HANDLERS_ARGS") + .map(|value| { + value + .split_whitespace() + .map(ToString::to_string) + .collect::>() + }) + .unwrap_or_default(); + + let working_dir = env + .var("CELERITY_HANDLERS_WORKING_DIR") + .ok() + .filter(|dir| !dir.trim().is_empty()); + + let shutdown_timeout = seconds( + env, + "CELERITY_HANDLERS_SHUTDOWN_TIMEOUT", + DEFAULT_HANDLERS_SHUTDOWN_TIMEOUT_SECS, + )?; + let start_timeout = seconds( + env, + "CELERITY_HANDLERS_START_TIMEOUT", + DEFAULT_HANDLERS_START_TIMEOUT_SECS, + )?; + + Ok(SupervisorConfig { + executable, + args, + working_dir, + shutdown_timeout, + start_timeout, + }) + } +} + +/// Reads a whole number of seconds from `key`, or `default` when it is unset. +fn seconds(env: &dyn EnvVars, key: &str, default: u64) -> Result { + let Ok(value) = env.var(key) else { + return Ok(Duration::from_secs(default)); + }; + value.parse::().map(Duration::from_secs).map_err(|_| { + ConfigError::Invalid(format!( + "{key} must be a whole number of seconds, got \"{value}\"" + )) + }) +} + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + use std::env::VarError; + + use pretty_assertions::assert_eq; + + use super::*; + + struct MapEnv(HashMap); + + impl EnvVars for MapEnv { + fn var(&self, key: &str) -> Result { + self.0.get(key).cloned().ok_or(VarError::NotPresent) + } + + fn clone_env_vars(&self) -> Box { + Box::new(MapEnv(self.0.clone())) + } + } + + fn env(pairs: &[(&str, &str)]) -> MapEnv { + MapEnv( + pairs + .iter() + .map(|(key, value)| (key.to_string(), value.to_string())) + .collect(), + ) + } + + #[test] + fn test_from_env_applies_defaults() { + let config = + SupervisorConfig::from_env(&env(&[("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers")])) + .unwrap(); + + assert_eq!( + config, + SupervisorConfig { + executable: "/app/handlers".to_string(), + args: Vec::new(), + working_dir: None, + shutdown_timeout: Duration::from_secs(DEFAULT_HANDLERS_SHUTDOWN_TIMEOUT_SECS), + start_timeout: Duration::from_secs(DEFAULT_HANDLERS_START_TIMEOUT_SECS), + } + ); + } + + #[test] + fn test_from_env_reads_every_setting() { + let config = SupervisorConfig::from_env(&env(&[ + ("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers"), + ( + "CELERITY_HANDLERS_ARGS", + "--verbose --config /etc/app.json", + ), + ("CELERITY_HANDLERS_WORKING_DIR", "/app"), + ("CELERITY_HANDLERS_SHUTDOWN_TIMEOUT", "5"), + ("CELERITY_HANDLERS_START_TIMEOUT", "90"), + ])) + .unwrap(); + + assert_eq!( + config, + SupervisorConfig { + executable: "/app/handlers".to_string(), + args: vec![ + "--verbose".to_string(), + "--config".to_string(), + "/etc/app.json".to_string(), + ], + working_dir: Some("/app".to_string()), + shutdown_timeout: Duration::from_secs(5), + start_timeout: Duration::from_secs(90), + } + ); + } + + #[test] + fn test_from_env_requires_an_executable() { + let err = SupervisorConfig::from_env(&env(&[])).unwrap_err(); + assert!(err.to_string().contains("CELERITY_HANDLERS_EXECUTABLE")); + } + + #[test] + fn test_from_env_rejects_an_empty_executable() { + let err = SupervisorConfig::from_env(&env(&[("CELERITY_HANDLERS_EXECUTABLE", " ")])) + .unwrap_err(); + assert!(err.to_string().contains("set but empty")); + } + + #[test] + fn test_from_env_rejects_a_non_numeric_shutdown_timeout() { + let err = SupervisorConfig::from_env(&env(&[ + ("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers"), + ("CELERITY_HANDLERS_SHUTDOWN_TIMEOUT", "a while"), + ])) + .unwrap_err(); + assert!(err.to_string().contains("whole number of seconds")); + } + + #[test] + fn test_from_env_rejects_a_non_numeric_start_timeout() { + let err = SupervisorConfig::from_env(&env(&[ + ("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers"), + ("CELERITY_HANDLERS_START_TIMEOUT", "forever"), + ])) + .unwrap_err(); + assert!(err.to_string().contains("CELERITY_HANDLERS_START_TIMEOUT")); + assert!(err.to_string().contains("whole number of seconds")); + } + + #[test] + fn test_from_env_takes_zero_as_waiting_indefinitely() { + let config = SupervisorConfig::from_env(&env(&[ + ("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers"), + ("CELERITY_HANDLERS_START_TIMEOUT", "0"), + ])) + .unwrap(); + + assert_eq!(config.start_timeout, Duration::ZERO); + } + + #[test] + fn test_from_env_ignores_a_blank_working_dir() { + let config = SupervisorConfig::from_env(&env(&[ + ("CELERITY_HANDLERS_EXECUTABLE", "/app/handlers"), + ("CELERITY_HANDLERS_WORKING_DIR", " "), + ])) + .unwrap(); + + assert_eq!(config.working_dir, None); + } +} diff --git a/apps/runtime/core/src/main.rs b/apps/runtime/core/src/main.rs new file mode 100644 index 00000000..e5af0622 --- /dev/null +++ b/apps/runtime/core/src/main.rs @@ -0,0 +1,189 @@ +//! The Celerity core runtime. +//! +//! Serves HTTP, WebSockets and queue consumers, and hands the events it takes +//! to a handlers executable over the Celerity IPC protocol —which is one long-lived +//! bidirectional gRPC stream. +//! The handlers executable is a separate process compiled from the developer's own code, in +//! any language with a Celerity SDK for ahead-of-time compiled languages. +//! +//! Everything the runtime itself does lives in `celerity_runtime_core`. This +//! binary is the process around it that reads the environment, starts the runtime, +//! starts the handlers executable, and holds the two together until one of them +//! stops. + +use std::process::{ExitCode, ExitStatus}; +use std::time::Duration; + +use celerity_helpers::{env::ProcessEnvVars, runtime_types::RuntimeCallMode}; +use celerity_runtime_core::{ + application::Application, config::RuntimeConfig, dispatcher::HandlerReadiness, +}; +use tokio::signal::unix::{signal, SignalKind}; +use tracing::{error, info}; + +mod config; +mod supervisor; + +use config::SupervisorConfig; +use supervisor::Handlers; + +/// Returned when the runtime or the handlers executable fails to start, or when +/// the handlers executable exits while the runtime is still serving. +const EXIT_FAILURE: u8 = 1; + +#[tokio::main] +async fn main() -> ExitCode { + match run().await { + Ok(code) => code, + Err(err) => { + // Tracing may not be up yet, since most of what can fail here fails + // before the runtime starts, so this goes to stderr as well. + error!("{err}"); + eprintln!("celerity-runtime-core: {err}"); + ExitCode::from(EXIT_FAILURE) + } + } +} + +async fn run() -> Result> { + let env_vars = ProcessEnvVars::new(); + let runtime_config = RuntimeConfig::from_env(&env_vars); + + if runtime_config.runtime_call_mode != RuntimeCallMode::Ipc { + return Err(format!( + "the core runtime only serves handlers over the IPC protocol, but \ + CELERITY_RUNTIME_CALL_MODE is set to \"{:?}\". Unset it, or use the runtime for the \ + language your handlers are written in", + runtime_config.runtime_call_mode + ) + .into()); + } + + let supervisor_config = SupervisorConfig::from_env(&env_vars)?; + + let mut application = Application::new(runtime_config, Box::new(ProcessEnvVars::new())); + // `ApplicationStartError` carries a `Display` message but does not + // implement `std::error::Error`, so it cannot cross into the boxed error + // this function returns on its own. + application.setup().map_err(|err| err.to_string())?; + + // `false` so that this returns once everything is serving; the servers keep + // running on their own tasks, and waiting is this function's job from here. + let app_info = application + .run(false) + .await + .map_err(|err| err.to_string())?; + info!( + http_server_address = ?app_info.http_server_address, + "the core runtime is serving, starting the handlers executable" + ); + + let start_timeout = supervisor_config.start_timeout; + + // Start the handlers executable now that the handler stream is bound, + // so the executable's first connection attempt has something to reach. + let mut handlers = match Handlers::start(supervisor_config) { + Ok(handlers) => handlers, + Err(err) => { + application.shutdown(); + return Err(err.into()); + } + }; + + let mut terminate = signal(SignalKind::terminate())?; + let mut interrupt = signal(SignalKind::interrupt())?; + + // A handlers executable that never attaches is the one failure nothing else + // reports: it has not exited, so the container stays up, while every event + // is shed because no stream serves it. Giving up turns that into a restart. + let attached = wait_until_attached(application.handler_readiness(), start_timeout); + tokio::pin!(attached); + + let exit_code = tokio::select! { + attached = &mut attached => { + if !attached { + error!( + timeout_secs = start_timeout.as_secs(), + "the handlers executable did not attach to the handler stream within the \ + start timeout, stopping. Set CELERITY_HANDLERS_START_TIMEOUT to allow \ + longer, or 0 to wait indefinitely" + ); + application.shutdown(); + handlers.shutdown().await; + return Ok(ExitCode::from(EXIT_FAILURE)); + } + info!("the handlers executable attached, the application is ready"); + // Attaching is not a reason to stop waiting on everything else, so + // this arm falls through to a second select that no longer watches + // for it. + tokio::select! { + status = handlers.wait() => handlers_exited(status), + _ = terminate.recv() => { + info!("received SIGTERM, draining"); + ExitCode::SUCCESS + } + _ = interrupt.recv() => { + info!("received SIGINT, draining"); + ExitCode::SUCCESS + } + } + } + status = handlers.wait() => handlers_exited(status), + _ = terminate.recv() => { + info!("received SIGTERM, draining"); + ExitCode::SUCCESS + } + _ = interrupt.recv() => { + info!("received SIGINT, draining"); + ExitCode::SUCCESS + } + }; + + // Shutdown the runtime first as it stops taking new work and sends `Drain` over the + // stream, so the handlers executable has both the signal and a stream to + // return its in-flight results on. Only then is the child told to stop. + application.shutdown(); + handlers.shutdown().await; + + info!("the core runtime has stopped"); + Ok(exit_code) +} + +/// Resolves to whether a handlers executable attached within `timeout`. +/// +/// A zero timeout waits indefinitely, which is what a deployment that would +/// rather hang than restart asks for. So does the FFI call mode, where there is +/// no readiness to wait on, though this runtime refuses to start in that mode. +async fn wait_until_attached(readiness: Option, timeout: Duration) -> bool { + let Some(mut readiness) = readiness else { + // Unreachable while this runtime refuses to start outside the IPC call + // mode, but waiting forever on a handle that will never be filled would + // hang the process with nothing to say for it. + error!("the runtime reported no handler readiness to wait on"); + return false; + }; + + if timeout.is_zero() { + return readiness.wait_until_ready().await; + } + + tokio::time::timeout(timeout, readiness.wait_until_ready()) + .await + .unwrap_or(false) +} + +/// The exit code for the handlers executable going away on its own. +/// +/// Nothing is left to dispatch to, so the runtime cannot keep serving. Exiting +/// non-zero either way lets the orchestrator restart the pair, which a clean +/// exit here would not. +fn handlers_exited(status: Result) -> ExitCode { + match status { + Ok(status) => error!( + ?status, + "the handlers executable exited while the runtime was serving, stopping" + ), + Err(err) => error!("{err}, stopping"), + } + ExitCode::from(EXIT_FAILURE) +} diff --git a/apps/runtime/core/src/supervisor.rs b/apps/runtime/core/src/supervisor.rs new file mode 100644 index 00000000..3b5b5135 --- /dev/null +++ b/apps/runtime/core/src/supervisor.rs @@ -0,0 +1,159 @@ +//! Starts the handlers executable and ties its lifetime to the runtime's. +//! +//! The two processes are a pair where neither is useful without the other, so when +//! one goes the other follows. The runtime is PID 1 in the container and owns +//! the ordering, which matters on shutdown as handlers have to be drained over +//! the IPC stream before the process serving that stream is allowed to die. + +use std::process::{ExitStatus, Stdio}; + +use tokio::process::{Child, Command}; +use tracing::{error, info, warn}; + +use crate::config::SupervisorConfig; + +/// A running handlers executable. +pub struct Handlers { + child: Child, + config: SupervisorConfig, +} + +#[derive(Debug)] +pub enum SupervisorError { + /// The executable could not be started at all. + Spawn { + executable: String, + source: std::io::Error, + }, + /// The child was started but waiting on it failed. + Wait(std::io::Error), +} + +impl std::fmt::Display for SupervisorError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + SupervisorError::Spawn { executable, source } => write!( + f, + "could not start the handlers executable at {executable}: {source}" + ), + SupervisorError::Wait(source) => { + write!(f, "could not wait for the handlers executable: {source}") + } + } + } +} + +impl std::error::Error for SupervisorError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + SupervisorError::Spawn { source, .. } => Some(source), + SupervisorError::Wait(source) => Some(source), + } + } +} + +impl Handlers { + /// Starts the handlers executable. + /// + /// Call this only once the runtime is serving the handler stream, so that + /// the executable's first connection attempt has something to reach. + /// + /// The child inherits this process's environment, which is how it is told + /// where to connect: `CELERITY_RUNTIME_SOCKET` and the loopback fallback + /// settings are already there. It also inherits stdout and stderr, so its + /// logs reach the container's streams in the form the SDK wrote them rather + /// than wrapped in a line of ours. + pub fn start(config: SupervisorConfig) -> Result { + let mut command = Command::new(&config.executable); + command + .args(&config.args) + .stdin(Stdio::null()) + .stdout(Stdio::inherit()) + .stderr(Stdio::inherit()) + // Without this the child is left running whenever the runtime dies + // in a way that skips `shutdown`. + .kill_on_drop(true); + + if let Some(working_dir) = &config.working_dir { + command.current_dir(working_dir); + } + + let child = command.spawn().map_err(|source| SupervisorError::Spawn { + executable: config.executable.clone(), + source, + })?; + + info!( + executable = %config.executable, + pid = child.id().unwrap_or_default(), + "started the handlers executable" + ); + + Ok(Handlers { child, config }) + } + + /// Resolves when the handlers executable exits on its own. + /// + /// A handler process that exits while the runtime is still serving is a + /// failure however it exited, there is nothing left to dispatch to, so a + /// zero exit code is no better than a crash. + pub async fn wait(&mut self) -> Result { + self.child.wait().await.map_err(SupervisorError::Wait) + } + + /// Asks the handlers executable to stop and waits for it to. + /// + /// `SIGTERM` first, so an SDK gets to run whatever teardown it registered, + /// then `SIGKILL` once the grace period is up. Returns the exit status when + /// the child was still running, and `None` when it had already gone. + pub async fn shutdown(&mut self) -> Option { + let Some(pid) = self.child.id() else { + // Already cleaned up, which is the case whenever the child exiting is + // what started the shutdown. + return None; + }; + + info!(pid, "asking the handlers executable to stop"); + signal_terminate(pid); + + match tokio::time::timeout(self.config.shutdown_timeout, self.child.wait()).await { + Ok(Ok(status)) => { + info!(pid, ?status, "the handlers executable stopped"); + Some(status) + } + Ok(Err(err)) => { + warn!(pid, "could not wait for the handlers executable: {err}"); + None + } + Err(_) => { + warn!( + pid, + timeout_secs = self.config.shutdown_timeout.as_secs(), + "the handlers executable did not stop within the grace period, killing it" + ); + if let Err(err) = self.child.kill().await { + error!(pid, "could not kill the handlers executable: {err}"); + } + self.child.wait().await.ok() + } + } + } +} + +/// Sends `SIGTERM` to `pid`. +/// +/// `Child::kill` sends `SIGKILL`, which gives the handlers executable no chance +/// to close its stream cleanly, so the polite signal has to go through libc. +fn signal_terminate(pid: u32) { + // Safe: `kill` takes two integers by value and touches no memory owned + // here. The pid comes from a child this process has not yet reaped, so it + // cannot have been recycled onto an unrelated process. + let result = unsafe { libc::kill(pid as libc::pid_t, libc::SIGTERM) }; + if result != 0 { + let err = std::io::Error::last_os_error(); + warn!( + pid, + "could not send SIGTERM to the handlers executable: {err}" + ); + } +} diff --git a/apps/runtime/nodejs/ARCHITECTURE_OVERVIEW.md b/apps/runtime/nodejs/ARCHITECTURE_OVERVIEW.md index 44527980..fd9623f4 100644 --- a/apps/runtime/nodejs/ARCHITECTURE_OVERVIEW.md +++ b/apps/runtime/nodejs/ARCHITECTURE_OVERVIEW.md @@ -8,8 +8,12 @@ _FFI stands for [Foreign Function Interface](https://en.wikipedia.org/wiki/Forei When the runtime launches, it parses a blueprint file that defines the handles and then waits for each handler to be registered. Once all handlers are registered, the runtime will start listening for incoming requests, messages and events. -The Node.js runtime has the same plugin system as all other runtimes that can be called at the "pre-handle" and "post-handle" stages of processing a request or message. This plugin system is meant to be lightweight and only deal with essential tasks such as authentication and handling CORS headers, the primary interaction developers using the runtime will have with this is configuration for CORS and auth in a blueprint definition for an application. -**_This is not interchangeable with the plugin systems defined for language-specific SDKs for handlers, all core runtime plugins must be written in Rust._** +The Node.js runtime processes a request or message through the same stack of **layers** as every other runtime. Each layer wraps the one inside it: it runs whatever it needs to before calling `next`, and whatever it needs to after that call returns, so a single layer sees both the way in and the way out. The innermost `next` is the call into the handler. A layer can also decline to call `next` at all and return its own response, which is how authentication rejects a request before it reaches a handler. + +Layers run outermost first on the way in and unwind in the reverse order on the way out, so the order they are declared in is the order they see the request. + +The layer system is meant to be lightweight and only deal with essential tasks such as authentication and handling CORS headers; the primary interaction developers using the runtime will have with it is configuration for CORS and auth in a blueprint definition for an application. +**_This is not interchangeable with the middleware systems defined for language-specific SDKs for handlers, all core runtime layers must be written in Rust._** ## Run-time flow diff --git a/docs/INDEX.md b/docs/INDEX.md index be7f8d31..fe273123 100644 --- a/docs/INDEX.md +++ b/docs/INDEX.md @@ -16,6 +16,7 @@ Container images that host developer application code, interfacing with handlers | Path | Description | Language | Release Component | |------|-------------|----------|-------------------| +| [apps/runtime/core](../apps/runtime/core) | Core runtime application for ahead-of-time compiled handlers, supervising a handlers executable it streams events to over the IPC protocol. | Rust | `runtime-core-app` | | [apps/runtime/nodejs](../apps/runtime/nodejs) | Node.js runtime application using bi-directional FFI calls to host handler code. | Node.js | `runtime-nodejs` | | [apps/runtime/python](../apps/runtime/python) | Python runtime application. | Python | `runtime-python` | | [apps/runtime/java](../apps/runtime/java) | Java runtime application (not yet implemented). | Java | — | diff --git a/libs/runtime/core/README.md b/libs/runtime/core/README.md index 0ecec7e8..1cc0c563 100644 --- a/libs/runtime/core/README.md +++ b/libs/runtime/core/README.md @@ -1,9 +1,9 @@ # celerity runtime core This package provides the core components designed to be used in the Celerity runtime. -This includes a HTTP server, WebSocket server, Queue consumers and a plugin system. +This includes a HTTP server, WebSocket server, Queue consumers and a layer system, where each layer runs before and after the `next` call it wraps. This package provides an API to start different kinds of servers and consumers from a blueprint file and a set of handlers. -This also provides APIs for the registration of handlers and plugins. +This also provides APIs for the registration of handlers and layers. This package only provides traits for queue consumers and queue event message handlers. Implementations of these traits can be found in specific packages such as `celerity_runtime_consumer_sqs`. diff --git a/libs/runtime/core/src/application.rs b/libs/runtime/core/src/application.rs index e23030bb..4b0e555d 100644 --- a/libs/runtime/core/src/application.rs +++ b/libs/runtime/core/src/application.rs @@ -2,12 +2,12 @@ use std::{ collections::HashMap, fmt::Display, net::SocketAddr, - sync::{Arc, Mutex}, + sync::{Arc, Mutex, OnceLock}, time::Duration, }; use async_trait::async_trait; -use axum::http::{HeaderName, HeaderValue, Method as HttpMethod}; +use axum::http::{HeaderName, HeaderValue, Method as HttpMethod, StatusCode}; use axum::{ extract::{MatchedPath, RawPathParams, Request}, handler::Handler, @@ -59,7 +59,7 @@ use crate::{ consumer_handler::{ ConsumerEventHandler, EventQueueConsumerEventHandler, SharedConsumerEventHandler, }, - dispatcher::{drain_timeout, Dispatcher, DispatcherCommand}, + dispatcher::{drain_timeout, Dispatcher, DispatcherCommand, HandlerReadiness}, errors::{ApplicationStartError, ConfigError}, event_queue::{ collect_handler_timeouts, http_handler_tag, timeout_from_seconds, websocket_handler_tag, @@ -114,6 +114,11 @@ pub struct Application { /// Built during setup, served in `run` once there is a runtime to spawn on. ipc_stream_context: Option>, ipc_dispatcher: Option, + /// Taken from the dispatcher during setup, since starting it consumes it. + /// + /// Shared with the health check route, which is registered before the + /// dispatcher is built, and stays empty in the FFI call mode. + handler_readiness: Arc>, ipc_commands_rx: Option>, ipc_dispatcher_shutdown_signal: Option>, ipc_server_shutdown_signal: Option>, @@ -166,6 +171,7 @@ impl Application { event_cleanup_task_shutdown_signal: None, ipc_stream_context: None, ipc_dispatcher: None, + handler_readiness: Arc::new(OnceLock::new()), ipc_commands_rx: None, ipc_dispatcher_shutdown_signal: None, ipc_server_shutdown_signal: None, @@ -284,6 +290,16 @@ impl Application { self.event_queue.clone() } + /// Whether a handlers executable is attached, or `None` in the FFI call + /// mode where handlers run in-process and cannot be absent. + /// + /// A runtime that starts the handlers executable itself uses this to give + /// up when nothing attaches, which is the only signal an orchestrator gets + /// for a handler process that is alive but never serves. + pub fn handler_readiness(&self) -> Option { + self.handler_readiness.get().cloned() + } + pub fn websocket_registry(&self) -> Arc { if let Some(ws_connections) = &self.ws_connections { ws_connections.clone() @@ -321,12 +337,39 @@ impl Application { let mut http_server_app = Router::new(); let use_custom_health_check = self.runtime_config.use_custom_health_check.unwrap_or(false); if !use_custom_health_check { + let handler_readiness = self.handler_readiness.clone(); http_server_app = http_server_app.route( DEFAULT_RUNTIME_HEALTH_CHECK_ENDPOINT, - get(|()| async { - Json(HealthCheckResponse { - timestamp: get_epoch_seconds(), - }) + get(move |()| { + let handler_readiness = handler_readiness.clone(); + async move { + // In the IPC call mode this includes + // whether a handlers executable is attached, since a + // runtime without one sheds every event it takes. + // + // An instance is therefore unhealthy from the moment it + // binds its port until its handlers attach. A deployment + // has to allow for that before it treats a 503 as a + // failure, through a startup probe or a start period + // longer than CELERITY_HANDLERS_START_TIMEOUT, or it + // will kill every instance during its cold start. + let serving = handler_readiness + .get() + .is_none_or(HandlerReadiness::is_ready); + let status = if serving { + StatusCode::OK + } else { + // 503 rather than 500 as nothing has failed, there is + // just nothing to hand work to yet. + StatusCode::SERVICE_UNAVAILABLE + }; + ( + status, + Json(HealthCheckResponse { + timestamp: get_epoch_seconds(), + }), + ) + } }), ); } @@ -592,11 +635,15 @@ impl Application { "shutdown will wait this long for in-flight events" ); - self.ipc_dispatcher = Some(Dispatcher::new( + let dispatcher = Dispatcher::new( event_queue.in_flight.clone(), handler_timeouts, drain_timeout, - )); + ); + // Filled before anything serves, so the health check never answers on a + // readiness handle that is missing only because setup is still running. + let _ = self.handler_readiness.set(dispatcher.readiness()); + self.ipc_dispatcher = Some(dispatcher); self.ipc_commands_rx = Some(commands_rx); self.ipc_stream_context = Some(Arc::new(StreamContext { runtime_config, diff --git a/libs/runtime/core/src/dispatcher.rs b/libs/runtime/core/src/dispatcher.rs index e89e6dd7..03af5bce 100644 --- a/libs/runtime/core/src/dispatcher.rs +++ b/libs/runtime/core/src/dispatcher.rs @@ -28,7 +28,7 @@ use std::sync::Arc; use std::time::Duration; use tokio::{ - sync::{mpsc, oneshot}, + sync::{mpsc, oneshot, watch}, time::Instant, }; use tracing::{debug, info, warn}; @@ -177,6 +177,45 @@ pub struct Dispatcher { timeouts: HandlerTimeouts, /// How long a shutdown waits for in-flight events before abandoning them. drain_timeout: Duration, + /// Publishes whether any stream is attached, for readiness probes and for + /// the startup deadline a supervising runtime applies. + readiness: watch::Sender, +} + +/// Whether a handlers executable is attached and able to be given work. +/// +/// A handler process that has died takes the runtime down with it, which an +/// orchestrator sees as a non-zero exit. This covers the other case: a process +/// that is alive but not serving, because it never completed its handshake, was +/// refused over a handler tag mismatch, or detached and never came back. None +/// of those exit, so without this they look healthy while every event is shed. +/// +/// Readiness here means at least one stream is attached, not that every handler +/// tag the blueprint declares is served. A partially attached application can +/// still serve some of its routes, and refusing traffic outright would be a +/// worse answer than shedding the events that have nowhere to go. +#[derive(Debug, Clone)] +pub struct HandlerReadiness { + ready: watch::Receiver, +} + +impl HandlerReadiness { + /// Whether a handlers executable is attached right now. + pub fn is_ready(&self) -> bool { + *self.ready.borrow() + } + + /// Waits for a handlers executable to attach, returning whether one did. + /// + /// Returns `false` when the dispatcher has gone, since nothing will attach + /// after that and a caller waiting on readiness would otherwise wait + /// forever. A caller has to tell that apart from an attach, or it treats a + /// runtime that is shutting down as one that is ready to serve. + pub async fn wait_until_ready(&mut self) -> bool { + // `wait_for` checks the current value before waiting, so an attach that + // happened before this was called is not missed. + self.ready.wait_for(|ready| *ready).await.is_ok() + } } /// Waits until an instant, or forever when there is nothing to wait for. @@ -239,9 +278,32 @@ impl Dispatcher { in_flight, timeouts, drain_timeout, + readiness: watch::Sender::new(false), + } + } + + /// A handle to whether a handlers executable is attached. + /// + /// Take this before [`Dispatcher::run`], which consumes the dispatcher. + pub fn readiness(&self) -> HandlerReadiness { + HandlerReadiness { + ready: self.readiness.subscribe(), } } + /// Publishes the current readiness, notifying only on a change so that a + /// waiter is not woken by every attach on an application that has several. + fn publish_readiness(&self) { + let serving = !self.streams.is_empty(); + self.readiness.send_if_modified(|ready| { + if *ready == serving { + return false; + } + *ready = serving; + true + }); + } + /// Runs dispatch until the event queue closes or shutdown is signalled, /// then drains what is already in flight. pub async fn run( @@ -442,6 +504,7 @@ impl Dispatcher { dispatch_tx: registration.dispatch_tx, }, ); + self.publish_readiness(); // A receiver that has gone away just means the caller stopped // waiting, which is not a reason to fail the attach. let _ = registered.send(()); @@ -492,6 +555,7 @@ impl Dispatcher { let Some(stream) = self.streams.remove(&stream_id) else { return; }; + self.publish_readiness(); if stream.holding.is_empty() { debug!(stream_id, "handler stream detached"); return; @@ -792,6 +856,7 @@ mod tests { queue: crate::event_queue::EventQueue, commands: mpsc::Sender, shutdown: Option>, + readiness: HandlerReadiness, _cleanup_shutdown: oneshot::Sender<()>, } @@ -815,12 +880,14 @@ mod tests { let (shutdown_tx, shutdown_rx) = oneshot::channel(); let dispatcher = Dispatcher::new(handles.in_flight.clone(), timeouts(), drain_timeout); + let readiness = dispatcher.readiness(); tokio::spawn(dispatcher.run(receivers, command_rx, shutdown_rx)); Harness { queue: handles.queue.clone(), commands: command_tx, shutdown: Some(shutdown_tx), + readiness, _cleanup_shutdown: cleanup_shutdown, } } @@ -1435,4 +1502,88 @@ mod tests { .expect("the caller should be woken"); assert!(outcome.is_err(), "the result channel should have closed"); } + + #[tokio::test] + async fn is_not_ready_until_a_handler_stream_attaches() { + let harness = start(16); + assert!( + !harness.readiness.is_ready(), + "nothing has attached, so there is nothing to give work to" + ); + + let _stream = attach(&harness, 1, &["schedule::a"], 4, HashMap::new()).await; + + assert!(harness.readiness.is_ready()); + } + + #[tokio::test] + async fn stops_being_ready_when_the_last_handler_stream_detaches() { + let harness = start(16); + let _stream = attach(&harness, 1, &["schedule::a"], 4, HashMap::new()).await; + assert!(harness.readiness.is_ready()); + + harness + .commands + .send(DispatcherCommand::Detach { stream_id: 1 }) + .await + .unwrap(); + + let mut readiness = harness.readiness.clone(); + tokio::time::timeout(Duration::from_secs(5), async { + while readiness.is_ready() { + readiness.ready.changed().await.unwrap(); + } + }) + .await + .expect("readiness should drop once the last stream detaches"); + } + + #[tokio::test] + async fn stays_ready_while_another_handler_stream_is_still_attached() { + let harness = start(16); + let _first = attach(&harness, 1, &["schedule::a"], 4, HashMap::new()).await; + let _second = attach(&harness, 2, &["schedule::b"], 4, HashMap::new()).await; + + harness + .commands + .send(DispatcherCommand::Detach { stream_id: 1 }) + .await + .unwrap(); + // Round-trips a command so the detach above has certainly been applied. + let _third = attach(&harness, 3, &["schedule::c"], 4, HashMap::new()).await; + + assert!( + harness.readiness.is_ready(), + "one stream going does not leave the application unable to serve" + ); + } + + #[tokio::test] + async fn wait_until_ready_returns_for_a_stream_that_attached_earlier() { + let harness = start(16); + let _stream = attach(&harness, 1, &["schedule::a"], 4, HashMap::new()).await; + + let mut readiness = harness.readiness.clone(); + let attached = tokio::time::timeout(Duration::from_secs(5), readiness.wait_until_ready()) + .await + .expect("readiness should not be missed by a later waiter"); + + assert!(attached); + } + + #[tokio::test] + async fn wait_until_ready_gives_up_once_the_dispatcher_has_gone() { + let mut harness = start(16); + let mut readiness = harness.readiness.clone(); + harness.stop(); + + // Waiting has to end, and it has to end saying nothing attached. A + // caller that read this as an attach would take a runtime on its way + // out for one that is ready to serve. + let attached = tokio::time::timeout(Duration::from_secs(5), readiness.wait_until_ready()) + .await + .expect("a waiter should not outlive the dispatcher it waits on"); + + assert!(!attached); + } } diff --git a/release-please-config.json b/release-please-config.json index e7874cb6..20b1c869 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -86,6 +86,11 @@ "release-type": "simple", "component": "runtime-python", "package-name": "celerity-runtime-python" + }, + "apps/runtime/core": { + "release-type": "rust", + "component": "runtime-core-app", + "package-name": "celerity-runtime-core-app" } } }