Expand description
boatramp HTTP server + publishing API.
The server is backend-agnostic: it is handed a DeployStore (blobs in any
boatramp_core::Storage, metadata in any boatramp_core::kv::KvStore)
and exposes:
- a publishing API used by
boatramp sync— negotiate a manifest, upload missing blobs (streamed), then atomically activate; - public serving of the currently-active deployment for each site.
Every byte path streams: uploads flow request→backend, downloads flow backend→response, and only small manifests are ever held in memory.
Modules§
- envelope
- Secrets-at-rest envelope backends.
- signer
- External token signer backends: KMS / HSM / Vault-hosted
control-plane root keys behind the
boatramp_core::cose::Signerseam. ExternalSignerbackends for the control-plane token issuer. - sql_
shim - The compute sql-shim (PLAN-compute-bindings, Phase 0).
Structs§
- Auth
- Control-plane auth configuration: the token trust anchor (root public key)
plus the KV that holds the RBAC policy (
authz/policy) and revocation markers (authz/revoked/<id>).None⇒ auth disabled (development). - Capability
Feature - Capability-surface types (
boatramp capabilities//api/capabilities). Ungated — a build withouthandlersstill names the vocabulary, it just implements nothing. A capability feature this host implements, paired with its stability. Thenameis the token a guest names in its manifestrequires; admission checks the name, andboatramp capabilitiesshows the name + lifecycle so operators can see what’s settled vs. provisional. - Daemon
Runtime - Fast
Serve - The serve fast path (hot-path bypass): the dependencies the axum router’s Extension
layers hold, cloned so
RouterHandlercan call [serve_by_host_inner] directly for a plain site GET/HEAD — skipping the axum Router + middleware future-composition tax (~15–20% of per-core CPU, profiled) — while every security check still runs insideserve_by_host_inner. Non-eligible requests fall through to the full router unchanged. - Handler
Runtime - The WebAssembly handler runtime: the shared engine plus the per-site binding
backends. Cheap to clone (it is an
Arcinside). Without thehandlersfeature it is an empty placeholder, so the serving signatures stay uniform — passHandlerRuntime::disabled. - Mesh
Member - One node’s Raft membership, reported by
GET /api/cluster/members. - Reloadable
Tls - A rustls
ServerConfigthe accept loop reads afresh per connection, so a background task (ACME renewal) can hot-swap the served certificate without a restart — the same capabilityaxum_server’sRustlsConfiggave us. Reads are a single lock-free atomic load (ArcSwap). - Request
Id - A per-request correlation id assigned by the access-log layer and readable downstream via
the request extensions — the handler dispatch tags captured guest logs with it, so a guest
line correlates with its
boatramp::accessline. Public so an embedder (or a test) can seed its own id into the request extensions. - Serve
Input - A
Routerplus the optional hot-path handle, flowed through the serve loops as one unit. A bareRouterconverts in with no fast path (From<Router>), so auxiliary listeners (the:80HTTP→HTTPS redirect, ACME challenge) are unchanged; the main site listeners pass(router, fast)(viaFrom<(Router, FastServe)>) to enable the bypass. Cheap to clone (anArc-yRouterclone + anOption). - Server
Limits - Server-tier upload limits. All
None= unlimited (the default; preserves the unbounded streaming behavior for operators who front boatramp with their own limits). - Server
Metrics - Always-on HTTP + lifecycle counters. Request cells are keyed by
(status_class, cache_result); the rest are scalar totals. - Server
Options - Server runtime knobs that aren’t part of the core (deploy, auth, handlers)
triple: operational request
limitsand an optional custom domain-ownershipDomainProbe(defaults to the live network probe). - Upload
Guard - Runtime guard built from
ServerLimits, shared across requests as an axum extension. Holds the concurrency semaphore (if any) and the per-upload caps.
Enums§
- Join
Outcome - The result of a join admission (
MeshControl::admit). - Lifecycle
- Capability-surface types (
boatramp capabilities//api/capabilities). Ungated — a build withouthandlersstill names the vocabulary, it just implements nothing. The stability of a capability feature — an honest, present-tense signal to operators and guest authors, and the seam the future deprecation clock extends (a deprecated capability is just this with a removal target).Experimental= new or off-by-default surface whose shape or behaviour may still change;Stable= safe to build on. Not a quality judgement — a stable capability isn’t “better”, it’s settled. - Serve
Error - A failure starting or running the HTTP server.
Traits§
- Mesh
Control - The cluster mesh control operations exposed to the control-plane API,
implemented by the cluster runtime over
ClusterNode;Noneon a non-cluster node (the routes then return501).
Functions§
- alpn_
h1_ h2 - The ALPN protocols our HTTPS listeners advertise, in server-preference order:
HTTP/2 first, then HTTP/1.1. (
serve_connectionalso sniffs the h2 preface, so a client that negotiates neither still gets the right codec — ALPN is the fast path, the sniff is the backstop.) - config_
baseline - The daemon-config file baseline derived from
ServerOptions(the resolvedboatramp.cfg).serveuses this to build aDaemonRuntimeit can wake on SIGHUP/changelog; the posture’s upload cap is the ceiling a dynamic override may not exceed. - http_
redirect_ router - A standalone router for a plain
:80listener that permanently redirects every request to its HTTPS equivalent. Bound alongside the HTTPS listener so plain-HTTP visitors are upgraded even when boatramp terminates TLS itself. - require_
auth - Axum middleware enforcing control-plane auth on the routes it wraps.
- router
- Build the application router around a
DeployStore,Authconfig, and the WebAssembly handler runtime (HandlerRuntime::disabledfor none), with defaultServerOptions(unlimited, live probe). - router_
with routerwith explicitServerOptions— lets a caller set request limits or inject a custom domain-ownership probe. Returns just the axumRouter; the serve loop usesrouter_with_fastto also obtain the hot-path handle.- router_
with_ fast - Like
router_withbut also returns theFastServehot-path handle, so the serve loop can dispatch eligible requests directly toserve_by_hostand bypass the axum router/middleware composition tax. The handle is opaque; a caller only passes it (with the router) into a serve loop (serve_tls/serve_plaintext/ the splice loop) viaServeInput. - serve
- Bind
addrand serve until a shutdown signal (Ctrl-C / SIGTERM), then drain in-flight requests under [DRAIN_DEADLINE]. DefaultServerOptions. - serve_
plaintext - Serve plaintext HTTP on
addrthrough the unified dispatcher (h1, or h2c via the preface sniff), bridged intorouter. Used by the:80HTTP→HTTPS redirect listener. Returns onceshutdownresolves, after a bounded drain. - serve_
plaintext_ listener serve_plaintexton an already-boundTcpListener(seeserve_tls_listener).- serve_
router_ conn - Serve one accepted connection (plaintext or already-TLS-terminated) by driving
it through the unified
boatramp_http::serve_connectiondispatcher, bridged intorouter. A clean close is silent; an unexpected IO error is logged at debug. Generic over the IO so a rawTcpStream, a rewound stream, or aTlsStreamall serve identically. - serve_
tls - Serve HTTPS on
addr: accept TCP, terminate TLS with the (reloadable) rustls config, and drive the negotiated protocol throughserve_router_conn. An ACMEacme-tls/1challenge handshake completes and is dropped (it carries no request). Returns onceshutdownresolves, after a bounded drain of in-flight connections. The config SHOULD advertise ALPNh2/http/1.1(alpn_h1_h2); an ACME config additionally carriesacme-tls/1. - serve_
tls_ listener serve_tlson an already-boundTcpListener— for callers that must learn the bound port first (an ephemeral:0bind) or that inherit the socket (systemd activation, tests).- serve_
with servewith explicitServerOptions(e.g. operational request limits).- server_
metrics - The process-wide
ServerMetrics. Cheap to call (no allocation). - shutdown_
signal - Resolve when the process receives Ctrl-C or SIGTERM, so in-flight requests can drain before exit.
- spawn_
compute_ reconcile - Spawn the leader-gated compute reconcile loop:
every
tick, whileis_leader(), run one [reconcile_once] pass over the backend registry + node inventory to converge each workload’s replicas. A no-op while not leader or with an empty registry. Detached for the server’s lifetime; the same leader-gating pattern as cron/cert issuance. - spawn_
domain_ verify_ reconcile - Spawn the domain-verification auto-complete reconcile loop: every
tick, on the leader, re-check all pending challenges and attach any that now pass — so a challenge whose HTTP/DNS token is published (e.g. bydomain add --provider) but never finished withdomain verifyself-heals with no operator action, and no persistent background daemon is needed beyond this tick. Mirrorscrate::spawn_compute_reconcile; the leader gate makes it a single-writer in a cluster. - verification_
pending_ page - The “verification pending” holding page — an HTTP 421 Misdirected Request
served for a non-local
Hostthat isn’t a verified, attached virtualhost (DV-2’s mandatory-verification gate). It looks up any pending challenge for the host to show the exact token / record + path; otherwise it shows generic guidance. Self-contained HTML (no JS, no external assets) — safe on an unverified host.
Type Aliases§
- Cron
Leader Gate - Predicate gating cron firing to the cluster leader (see
[
HandlerRuntime::set_cron_leader_gate]).