Architecture
Components, processes, ports, data flows, data model, and trust boundaries of the console repository.
Components
| Component | Location | Responsibility |
|---|---|---|
| Console | apps/console | Web UI, UI endpoint /rpc, public API /api/v1, node channel, pg-boss worker; one image, one Node.js process |
edgeweir-certd | helpers/certd | ACME and DNS helper written in Go, shipped in the console image; the worker runs it as a child process and exchanges JSON over stdin/stdout, so credentials never appear in process arguments |
| PostgreSQL 18 | External service | The only required dependency: application data, migration history (schema drizzle), pg-boss queues (schema pgboss), LISTEN/NOTIFY |
| ClickHouse | Compose profile analytics | Optional; with EDGEWEIR_ANALYTICS=clickhouse it stores access logs and a copy of per-minute statistics |
| Node | edgeweir-node | Go agent and OpenResty data plane; pulls configuration and tasks over the node channel and reports status, host metrics, statistics, and logs |
| Regional probe | edgeweir-node (probe mode) | Runs no OpenResty; probes the nodes' scheduling addresses from its region and reports through the node channel's ProbeService |
Console (ROLE=app|worker|all)
├── :3000 HTTP ◀── browsers, API clients
│ /node-channel (WebSocket, closed by default) ──▶ loopback connection to :8443
├── :8443 Connect-RPC (TLS + mTLS) ◀── edgeweir-node agent ── OpenResty ──▶ origins
│ ◀── edgeweir-node probe (regional probe) ──▶ node listeners
├── SQL, LISTEN/NOTIFY ──▶ PostgreSQL 18
├── HTTP (optional) ──▶ ClickHouse
└── child process stdin/stdout ──▶ edgeweir-certd ──▶ ACME CA, DNS provider APIsThe only contract between the console and the nodes is edgeweir.node.v1 in proto/ (current tag proto/v0.29.0). The boundary between the open core and commercial products is defined in LICENSING.en.md.
Repository layout
| Path | Contents |
|---|---|
apps/console/src/server | Server: app.ts (HTTP routes), bootstrap.ts (startup sequence), main.ts (production entry), dev.ts (development entry with Vite middleware in the same process), rpc/ (oRPC router and guards), node-channel/ (node channel), pki/ (internal CA), services/ (domain services), jobs/worker.ts (pg-boss queues), lib/ (environment, authentication, envelope encryption, client IP, logging), install/install.sh (node installer), downloads.ts (release mirror) |
apps/console/src/web | React 19 SPA: TanStack Router file routes (routes/), TanStack Query, shadcn components (components/ui), appica wrappers (components/appica/); Paraglide messages in apps/console/messages/{zh-CN,en}.json, compiled to src/web/paraglide |
apps/console/test | Vitest: server/ (in-process PGlite database), web/ (i18n, UI rules, preset, theme) |
apps/console/e2e | Playwright specs, run by scripts/e2e.sh |
packages/contract | oRPC contract and zod schemas, error codes (errors.ts), node error codes (node-errors.ts), origin address rules (addresses.ts); shared by the UI, the server, and OpenAPI |
packages/db | Drizzle schema (src/schema/) and plain SQL migrations (migrations/) |
packages/config-compiler | Compiles sites, rules, IP lists, certificate references, and platform policy into the NodeConfig IR; canonical ordering, content hash, diff |
packages/rule-engine | Rule expression fields, phases, functions, parser (conditions, value expressions, cache rule conditions), list reference binding, and reference evaluation |
packages/proto | TypeScript generated from proto/ (protoc-gen-es); not edited by hand |
proto/ | buf module edgeweir/node/v1/{node,config,probe}.proto; edgeweir-node generates its Go code from a proto/vX.Y.Z tag |
helpers/certd | edgeweir-certd source |
helpers/http3probe | HTTP/3 probe used in CI |
Dockerfile, docker/ | Image build, container health check script, end-to-end fixtures |
compose*.yml, deploy.sh | compose.yml (production), compose.baota.yml and compose.baota-host.yml (宝塔 / aaPanel), compose.dev.yml (development database), compose.e2e.yml (end-to-end); deploy.sh installs and upgrades 宝塔 / aaPanel deployments |
scripts/ | e2e.sh (end-to-end tests), image-version.sh (rolling version), bench.sh (performance baseline of cache hits, requests with a pass and challenge pages) |
docs/ | deploy/ (deployment), guide/ (feature guides), reference/ (reference) |
Processes and roles
ROLE selects what a process runs. All roles use the same image and the same database; deployment shapes and scaling: Deployment overview; all variables: Environment variables.
ROLE | Runs |
|---|---|
app | HTTP server, node channel, setup token, LISTEN/NOTIFY subscription |
worker | pg-boss queues and schedules |
all (default) | Everything in app and worker |
Startup sequence
- Parse and validate the environment (
lib/env.ts); on failure, list the invalid variables and exit. - Wait up to 60 seconds for PostgreSQL.
- Apply pending migrations on a dedicated connection under an advisory lock; instances that start together run them one at a time.
- Check that the internal CA key's envelope was sealed with
EDGEWEIR_MASTER_KEYorEDGEWEIR_MASTER_KEY_PREVIOUS, or stop. Resolve the session secret (BETTER_AUTH_SECRET, or derived from the master key; after a master key rotation, the stored original) and compare it with the HMAC check value in the database: a derived secret that differs from the one the database was used with stops startup; a new explicit value is accepted with a warning (SECURITY.en.md). - Re-encrypt v1 envelopes written by older versions as v2; with
EDGEWEIR_MASTER_KEY_PREVIOUSset, re-encrypt every envelope it sealed with the current master key and log how many still use it (services/envelope-rotation.ts). - Load the internal CA; generate it when the database has none.
app,all: before setup, create or read the setup token and write it to the log; start LISTEN; issue the node channel server certificate from the internal CA and start listening.worker,all: start pg-boss, create the queues, register the schedules.app,all: the HTTP server starts listening.
On SIGTERM or SIGINT the process stops the HTTP and node channel listeners, ends the nodes' config watch streams and stops pg-boss at the same time: requests in flight get up to 3 more seconds, pg-boss up to 5 seconds to finish running jobs; then the database pool is closed. If all of this takes more than 8 seconds the process exits with 1.
Ports and routes
| Port | Variables | Protocol | Constraint |
|---|---|---|---|
| 3000 | HOST, PORT | HTTP; /node-channel is the node channel's WebSocket entry | May sit behind a reverse proxy; list the proxy addresses in EDGEWEIR_TRUSTED_PROXIES |
| 8443 | NODE_API_HOST (defaults to HOST), NODE_API_PORT | HTTPS, TLS 1.2 or later, HTTP/2 and HTTP/1.1 | Expose directly or pass through at layer 4; a proxy that terminates TLS breaks node mTLS |
Reverse proxy and layer-4 passthrough configuration: Ports, reverse proxy, and trusted proxies.
HTTP routes
| Path | Handler | Credentials |
|---|---|---|
/healthz | Returns {"status":"ok","version":…} | None |
/api/auth/* | better-auth, allow-listed endpoints only | See Authentication and authorization |
/rpc/* | oRPC, UI only | Session cookie + x-csrf-token |
/api/v1/openapi.json | OpenAPI document | None |
/api/v1/* | OpenAPI handler for the same router as /rpc | x-api-key |
/install.sh | Node installer with the console address replaced by EDGEWEIR_PUBLIC_URL; cache-control: no-store | None |
/downloads/* | Node release mirror (EDGEWEIR_DOWNLOADS_DIR), GET and HEAD | None |
/assets/* | SPA assets, max-age=31536000, immutable | None |
| Any other path | SPA static files; index.html when no file matches | None |
Unmatched requests under /api, /rpc, and /downloads, and other methods on /install.sh and /healthz, return a 404 JSON body and never fall back to the SPA. Every response carries security headers; the CSP is default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; frame-ancestors 'none'.
UI areas
| Area | Paths | Access |
|---|---|---|
| Entry | / (redirects to /setup, /overview, or /login by state), /setup, /login | Everyone |
| Console | Sites: /overview, /sites (with L4 apps at /l4), /certificates, /purge; access control: /rules, /ip-lists (with bans at /bans), /protection; infrastructure: /clusters (with the regions view ?view=regions), /dns; system: /alerts, /audit, /system (tabs: general, monitoring ?tab=probes, service accounts ?tab=service-accounts); account (user menu): /security, /settings; /regions and /service-accounts redirect to their new places | The signed-in operator |
Authentication and authorization
| Entry | Credentials | Rules |
|---|---|---|
/api/auth/* | Email and password, TOTP, backup codes, passkeys | Only the methods and paths in AUTH_HTTP_ROUTES (lib/auth.ts) are served (session, sign-in, sign-out, password change, two-factor, passkeys); everything else returns 404; x-api-key is dropped; public sign-up is disabled, the only account is created by the setup wizard; passwords have at least 12 characters |
/rpc/* | Session cookie + x-csrf-token | x-api-key is dropped |
/api/v1/* | x-api-key (AccessKey or service account key) | Cookies are dropped; an AccessKey acts as the account with the same permissions as a session; a read-only AccessKey can call GET procedures and rules.validate only; a service account can call only the procedures listed in serviceAccountProcedures that its scopes allow |
:8443 | Client certificate | See Node channel |
/node-channel | The WebSocket handshake is not authenticated; the node channel TLS inside it is the same as on :8443 | 404 by default; 403 with an Origin header; see Node channel |
Endpoints, the OpenAPI document, and AccessKey details: API and endpoints. The console has one operator account, with no organizations or roles: every procedure except system.status and system.setup goes through authed in rpc/base.ts (a valid session, an enabled AccessKey or a service account key).
The client IP (audit log, sign-in rate limiting) is the TCP peer; X-Forwarded-For and X-Real-IP are used only when the peer is in EDGEWEIR_TRUSTED_PROXIES (resolveClientIp). Rate-limit counters for the authentication endpoints live in the rate_limit table and are shared by all instances. Sign-ins and account changes completed by better-auth are audited by the hooks in lib/auth-audit.ts.
Account recovery has no HTTP entry and happens on the server only: dist/server/recover.js (services/recovery.ts) reads the console's environment and, in one transaction, resets the password (better-auth's password.hash), turns two-factor authentication off, deletes the account's sessions and pending two-factor sign-ins, and writes the audit entry account.recover (Command line).
Configuration publishing
A change to node configuration runs in one transaction:
- Write the application tables (sites, domains, origins, cache rules, rules, IP lists, L4 apps, certificates, ACME HTTP-01 responses, the origin allow list, the full-site purge generation).
publishRevision()takes an advisory lock on the cluster, reads the cluster's enabled sites and L4 apps, global rules, every IP list, the origin allow list, certificate references, and unexpired HTTP-01 responses, andcompileNodeConfig()produces the canonical NodeConfig IR.- Compute
content_hash: SHA-256 of the binary encoding withrevisionandcontent_hashcleared. Identical content produces no new revision. - The new revision number is one more than the larger of the latest stored revision and the highest verified applied revision reported by the cluster's nodes; restoring the database from a backup never moves revisions backwards.
- Insert into
config_revision, runpg_notify('edgeweir_config', …)in the same transaction, and write the audit entry. - After commit, every
appinstance receives the notification through LISTEN and pushes it to theWatchConfigstreams of the cluster's nodes. - The node calls
GetConfig(base_revision=applied revision), receives a diff or a snapshot plus a revision receipt, verifies the hash, stores it as last-known-good, applies it to OpenResty, and reports withReportStatus. - The console records each node's applied revision and heartbeat in
node_config_status; a node with a heartbeat in the last 45 seconds is online.
| Constraint | Value |
|---|---|
| Enabled sites per cluster | At most 512 (MAX_SITES_PER_CLUSTER); more returns CLUSTER_SITE_LIMIT |
| L4 apps per cluster | At most 256 (MAX_L4_APPS_PER_CLUSTER); more returns L4_APP_LIMIT |
| New node capabilities | A change that needs a capability some active node lacks returns NODE_CAPABILITY_REQUIRED when a service account or a background job publishes it; the operator (session or AccessKey) may publish it; GetConfig returns FailedPrecondition to a node missing a required capability |
| Revision retention | Newest 200 per cluster, pruned hourly |
| Rollback | Publishes the IR of an older revision as a new revision with the current origin allow list; audit action cluster.rollback |
Revision reasons are codes (revision_reason_<code>) defined in packages/contract/src/errors.ts. Rule language: Rules.
Node tasks
URL, prefix, host, Cache-Tag, and full-site purges and URL and sitemap prefetches produce no revision; they are delivered as typed tasks:
cacheTasks.createinserts acache_taskand acache_task_nodefor every enabled node (disabled nodes are marked skipped), then runspg_notify('edgeweir_tasks', …).- The
WatchConfigstream emitsWATCH_EVENT_TASKS. - The node pulls tasks with
PullTasksand reports results withReportTaskResult. - A task without a result 5 minutes after hand-out is handed out again; a task not finished within 7 days fails. When a node reconnects, the console issues a full-site purge for each site whose purges the node missed.
For a site with the PURGE method on, the node has its agent check the key of a PURGE request and hands it to the console with SubmitPurge; the console creates a URL purge task for the cluster as in step 1.
The hosts of URL, prefix, host and prefetch tasks resolve to sites by the nodes' domain precedence (resolveHosts): a purge goes to the site of every cluster that serves the host (purging more is harmless); prefetches and sitemap prefetches make nodes fetch from origins and go to one cluster only, the cluster of the site the same precedence picks over every cluster's sites (disabled ones included), and there to the site its nodes route the host to (SITE_DISABLED if none is enabled); another cluster's broad suffix or pattern never sends its nodes to a different site's origins, not even while that site is disabled. Host and Cache-Tag purges need the node feature purge-tag-v1, mobile and sitemap prefetches prefetch-v2; while an active node of a cluster the task goes to lacks it, the console refuses the task (NODE_CAPABILITY_REQUIRED). Nodes derive cache keys from the purge markers' points in time and an index of the cached objects' Cache-Tag, so purged objects (stale ones included) are never looked up again; nodes fetch sitemaps through their own edge layer. Behavior: Origins and cache.
Node upgrades are delivered through PullTasks as well: an upgrade first runs on one node group and is promoted after the health observation passes; the remaining nodes follow at most a quarter at a time, and each task must finish within 30 minutes after it is sent. A node pulling tasks first checks without a lock whether it has an upgrade task, and takes the cluster's upgrade lock only if it does. Behavior: Node upgrades.
Dynamic bans
IP bans (ip_ban) create no revision and skip the configuration canary; they have their own path over the node channel:
- Every write (create, ban again, unban, automatic ban writes and overflow removal) takes
nextval('ip_ban_seq')as the row'ssequnder one transaction-level advisory lock, so commits follow sequence order; the same transaction runspg_notify('edgeweir_bans', …)with the affected clusters (all of them for platform bans). Manual actions are audited asban.create,ban.update,ban.delete. - Nodes with
bans-v1receiveWATCH_EVENT_BANS(ban_sequenceis the sequence's current value) when theirWatchConfigstream opens and after every notification. - The node calls
GetBans(after_sequence): from 0, or from a sequence above the current value (after a database restore), it returns a snapshot (reset); otherwise the active bans and lifted ids changed afterwards. Expired bans are left out; nodes drop them at expiry. Reads take the same lock in shared mode first, so the current value never passes an uncommitted write. Pages hold 2000 entries by default and at most 5000;sequenceis the page's highest sequence, or the current value on the last page. - Nodes upload their own automatic bans with
ReportBans(at most 1000 per call), merged per node, site and address, and report the applied sequence, capacity and unapplied bans inReportStatus.bans, kept innode.ban_status. - Greylist entries are
ip_banrows whoseactionischallengeorrate_limit; they share the sequence, lock, notifications and pruning, and go only to nodes that sendgreylist = trueinGetBans(greylist-v1).Ban.actionand its fields describe the action; nodes never write them to the kernel. A cluster's kernel connection limits (cluster.connection_limits) travel in revisions instead (NodeConfig.connection_limits); nodes report whether they enforce them inBanStatus.connection_limits_active/_error.
| Limit | Value |
|---|---|
| Shortest prefix | IPv4 /16, IPv6 /48 |
| Lifetime | 1 minute to 7 days; deleted by maintenance.prune-bans an hour after expiry |
| Count | Platform limit of manual bans (system settings, 10000 by default); at most 10000 automatic bans per cluster |
Behavior: Bans.
Challenges and CC mitigation
Nodes enforce challenges, Under Attack and tiered CC mitigation locally; the console holds the settings, keys and events:
- A site's protection (
site_protection), global Under Attack (system settingprotection_settings) and the CC template (cc_template) are compiled into NodeConfig. Only clusters that use challenges (global Under Attack, a site's Under Attack, an enabled CC policy or achallengerule) carrychallenge_keys,platform_protectionand every site'sprotection, withchallenge-v1inrequired_features; a site that only records JA4 carries itsprotectionalone. Rules that readtls.ja4(or rate limit by it) and sites that record JA4 addja4-v1. Other clusters keep their content hash. - Pass HMAC keys are per cluster, three of them (
next,current,previous), created the first time a cluster uses challenges. The IR holds only key ids and roles (sorted by id); nodes fetch the 32-byte secrets withGetChallengeKeys, only those of their own cluster. A secret is generated the first time it is fetched and stored envelope-encrypted (purposechallenge_key.secret, bound to the row id). maintenance.rotate-challenge-keyschecks every hour and rotates keys once the newest one is a day old:previousis deleted,currentbecomesprevious,nextbecomescurrentand a newnextis created; clusters whose latest revision carries keys get a new revision (reasonchallenge_keys_rotated), audited ascluster.challenge_keys_rotate.- Nodes report level changes, escalated paths and automatic bans with
ReportSecurityEvents(at most 500 per call); the console stores them insecurity_event, idempotent by (node, event id). A site leaving the normal level raises thecc_mitigationalert, at most once per site in 15 minutes.ReportStatus.securityof the heartbeat is kept innode.security_state.maintenance.prune-security-eventsdeletes events after the retention (default 30 days).
| Management action | Audit |
|---|---|
| Site protection | site.protection_update (publishes the site's cluster) |
| Global Under Attack, event retention | system.protection_update (publishes every cluster when Under Attack changes) |
| CC template | system.cc_template_update (publishes clusters with sites that follow it) |
Behavior: Challenges and CC mitigation.
Compression and OWASP CRS
Nodes compress and run CRS with OpenResty built for Edgeweir (edgeweir-openresty, optional module package edgeweir-openresty-modsecurity) and report brotli-v1, zstd-v1 and modsecurity-v1 according to their build. The console holds the settings, the capability gate and the match statistics:
- A site's Brotli and Zstandard settings live with Gzip in
site.tls_settingsand are compiled intoTlsOptions; only algorithms that are on carry their level, minimum length and types (types sorted and unique), so the content hash stays the same while they are off. Enabled sites with them on addbrotli-v1/zstd-v1torequired_features. - A site's CRS settings live in
site_waf; unless the mode is off they compile intoSite.waf(excluded rule ids ascending and unique) and addmodsecurity-v1. - As with other capabilities, a service account or background publish that introduces a capability an active node of the cluster lacks gets
NODE_CAPABILITY_REQUIRED; the operator may publish it.sites.featurestells per site whether each feature can be turned on (reasonnodeswhen not), and the UI disables the switches accordingly. Rollback recomputes the three capabilities from the sites it ships. waf_rulesofReportStats(rule id → requests) keeps at most 50 rules per node, site and minute (nodes report only the 20 most-matched), rolls up into hours and days with the other per-minute statistics and is copied to ClickHouseminute_stats;waf.topRulessums a range. Access logs keep the matched rule ids (at most 16, ascending) andwaf_blocked(PostgreSQL, ClickHouse, CSV). Rules with the log action likewise:MinuteStats.logged_rules(proto v0.18.0, node capabilityrule-log-v1; rule id → requests, UUIDs only) keeps at most 50 rules per node, site and minute (nodes report 20 as well) aslogged_rules, with the same rollups and ClickHouse copy;rules.topLoggedsums a range, joins the rules' current names (the site's own rules and global rules) and counts the active nodes of the site's cluster that lackrule-log-v1.
| Management action | Audit |
|---|---|
| A site's HTTPS and compression | site.https_update (publishes the site's cluster) |
| A site's CRS | site.waf_update (publishes the site's cluster, reason site_waf_updated) |
Behavior: HTTPS and certificates and OWASP CRS managed rules.
Rule engine extensions
The console is the only authority on expression syntax: packages/rule-engine parses conditions and value expressions and packages/config-compiler emits typed IR; nodes validate the IR field by field and run it, and never receive expression text. Functions, value expressions, bulk redirects, origin groups, cache rule conditions and the new rule actions are marked by the node capability rules-v2:
- Function calls are encoded as
call,fieldandconstnodes ofRuleExpression. Value expressions of redirect targets and rewrite paths go intoRuleAction.target;set_queryis sorted by name andremove_querysorted and unique;preserve_queryis written only when it differs from the action's default. - Cache rules are stored as expressions (
cache_rule.expression, with the lists they reference inlist_ids). Expressions in the builder's shape compile into the formerpath_prefixes,pathsandextensions, so older nodes run them as before and the content hash stays the same; other expressions compile intoCacheRuleMatch.condition.browser_ttl_secondsgoes intoCacheRule. - Bulk redirects compile into
Site.bulk_redirects(sorted by source) and origin groups intoOrigin.group. - A configuration that uses any of these (the
compressionphase and the new fields ofconfigactions included) addsrules-v2torequired_features; others encode exactly as before. As with other capabilities, a change by a service account or background job that introducesrules-v2while an active node of the cluster lacks it getsNODE_CAPABILITY_REQUIRED, while the operator may publish it;rulesV2ofsites.featureslets the UI lock the controls.
The additions of proto v0.22.0 are marked by the capability rules-v3: cookies and query parameters by name (http.request.cookies.<name>, http.request.uri.args.<name>, the first raw value), new request and connection fields, http.response.cache_status, encoding and digest functions, substring (its integer arguments are const nodes of value_type number), to_string (an argument of any type), and the wildcard and strict_wildcard comparisons; request and response header values reuse RuleAction.target for their value expression, QueryParam.expression computes a query parameter, and RuleAction.append adds a response header line; redirect status 303; {{time}} and {{path}} in error pages. Nodes compute these fields only for sites whose rules read them; a computed header value over 4096 bytes or with a control character skips the action (one NOTICE per rule and node every 60 seconds, its message naming only the site and rule IDs), while a failed query parameter value still fails closed. Configurations that use none of them encode byte for byte as before (cross-language content hash vector content_hash_vector_v0220.json).
Proto v0.23.0 adds three capabilities. edge-ports-v1: a Listener may use a port besides 80 / 443 (the cluster's extra ports), Site.ports lists the listener ports a site is bound to (empty means every listener, the former semantics; a site on 80 / 443 in a cluster without extra ports compiles to empty), and TlsOptions.redirect_status / redirect_port / redirect_excluded_domains are the HTTPS redirect options; nodes render a site's server blocks on its ports only, and the router and the TLS callbacks treat its hosts on other ports as unknown. client-ip-v1: NodeConfig.client_address is the cluster's client address source; in the PROXY protocol mode every Listener.proxy_protocol is set, the trusted header mode reads the header with nginx realip (real_ip_recursive on); X-Forwarded-For towards the origins is the received chain plus the direct peer ($realip_remote_addr), the rule field ip.peer is the direct peer, and trusted CIDRs are never banned and not counted per address by CC. l4-v2: L4App.port_end (a port range, a stream listen range), L4Origin.port 0 for the arriving port, L4App.certificate_id / tls_minimum_version (stream ssl_client_hello_by_lua / ssl_certificate_by_lua check the SNI and terminate TLS; the certificate travels with the layer-4 table). Listener ports and the client address are the cluster's current state: a rollback keeps the current ones, and sites take their current ports and redirect options (refreshDerived(config, edge)). Cross-language content hash vector content_hash_vector_v0230.json.
| Management action | Audit |
|---|---|
| A site's rules | site.rules_update (publishes the site's cluster, reason rules_updated) |
| Global rules | platform.rules_update (publishes every cluster) |
| A site's bulk redirects | site.bulk_redirects_update (publishes the site's cluster, reason rules_updated) |
Behavior: Rules, IP lists, and GeoIP and Origins and cache.
Layer-4 forwarding
The nodes' stream subsystem forwards TCP / UDP L4 apps; the console handles ports, configuration, DNS, and statistics:
- Port pools (
cluster_port_pool) exist in the console only: an L4 app's port must fall inside a pool of its cluster for its protocol (1024–65535, no overlap within a protocol, never a port of the cluster's HTTP / HTTPS listeners). Writes to pools and apps are checked one at a time under an advisory lock of the cluster; changing pools publishes no revision. - L4 apps (
l4_app,l4_origin) ship with the cluster's revision: enabled apps compile toNodeConfig.l4_apps(sorted by id, with the ids of the IP lists they reference) and addl4-v1torequired_features; disabled apps are not shipped. Origins follow the same origin address policy as sites. - Nodes render the port, protocol, whether PROXY protocol is accepted, and the version sent as a
serverinstream {}and reload, old workers serving open TCP connections until they end; origins, passive health check settings, timeouts, lists, and connection limits are hot-updated over the local control socket. Only apps that both accept and send PROXY protocol use a Lua relay; all others (v2 included) use native nginx forwarding. - DNS:
compileBindingPlanwrites a<app id>.<cluster domain>CNAME for every enabled app (with line aliases also<line>.<app id>.<cluster domain>), sharing the all-lines record, resolution lines, and backup node groups with sites. - Statistics: nodes report per app and minute
connections,refused,peak_concurrent,bytes_received, andbytes_sentinReportStatsV2Request.l4_stats, in the same batch as the sites' minute buckets and deduplicated by the same batch sequence; the console accepts only apps of the node's cluster and writesl4_minute_stats(no rollup, kept 7 days);l4Apps.statsbuckets a range by 60, 300, or 3600 seconds. - Rollbacks and the canary's stable revision treat L4 apps by their current state: apps disabled now are not shipped; an app deleted since, whose port is no longer inside a pool, or that references a deleted list fails the operator's rollback (
ROLLBACK_RESOURCE_UNAVAILABLE) and is left out of the stable revision.
| Limit | Value |
|---|---|
| L4 apps per cluster | At most 256 (MAX_L4_APPS_PER_CLUSTER); more returns L4_APP_LIMIT |
| Port pools per cluster | At most 64 |
| Origins per app | 1–32 |
| Management action | Audit |
|---|---|
| Changing port pools | cluster.port_pools_update (publishes no revision) |
| Creating, changing, deleting an L4 app | l4_app.create, l4_app.update, l4_app.delete (publishes the app's cluster, reasons l4_app_created, l4_app_updated, l4_app_deleted) |
| Enabling, disabling an L4 app | l4_app.enable, l4_app.disable (reason l4_app_updated) |
Behavior: Layer-4 forwarding.
Domain matching and unknown hosts
Proto v0.25.0 adds two capabilities. domains-v2: Domain.match (SUFFIX subdomains at any depth, REGEX a pattern for the whole host) and Domain.order (the precedence key of patterns: the site's creation time in milliseconds × 16 plus the pattern's index in the site), and OfflineHost.match for disabled sites. unknown-host-v1: NodeConfig.unknown_hosts (the handling of unknown hosts and of node IP access each: the platform's page, 444 or the default site; the default site's certificate for unknown SNI; scan protection's threshold and ban time) and AutoBan.scope (scan protection's platform-wide bans). Exact and *. domains and the default settings stay out of the encoding: configurations that use neither encode as before.
- The console converts Unicode host names to Punycode by UTS #46 (
tr46, nontransitional processing) when domains are saved; patterns use the rule engine's regular expression subset with lowercase letters and a bounded shape (domainPatternError: at most two repeating quantifiers, a fixed{n}not counted; the alternatives of each group and the optional parts multiply to at most 16; no comma outside{n,m}), which bounds nginx's PCRE matching on nodes, where no limit is set. The console process turns on V8's--enable-experimental-regexp-engine-on-excessive-backtracksinlib/regexp-engine.ts(imported byservices/cache-tasks.ts): a match that backtracks too much finishes on the linear engine and never stalls the single console process. A name in one form belongs to one site; forms may overlap, and nodes look up "exact >*.> the longest.suffix > patterns (byorder, then site id)"; IP literals and an empty Host match exact names only, and a Host longer than 253 characters tries no pattern. The console finds sites by Host as nodes do (matchHost;inPatternOrdershares the pattern order with the compiler), and node sitemap prefetches use the same order (shared vectorshost_match_vectors.json). The UI shows a label in Unicode only when it is in one script. - Node Lua looks up
host:,wild:andsfx:keys in the shared dictionary; patterns come with the site table settings and are compiled once per version (ngx.rewithjo;lua_regex_cache_max_entriesgrows with them). Hits through suffixes and patterns go to an LRU of their own and never evict exact names. A host found through a suffix or pattern completes TLS only where the certificate's DNS names cover it, and gets no Force HTTPS redirect where they do not. - With suffix or pattern domains in the configuration (or a default site), nodes render
*.xas a one-label regular expressionserver_name, and give each suffix (longest first) and each pattern (by precedence, case-sensitive, no PCRE limit) a server block of its own after every site's (patterns never match a Host longer than 253 characters); node IP access hosts (_, IPv4,[IPv6]) match exact names only, their regex name comes before any other on the server their handling is served by, so nginx picks the server block of the site Lua routes to; the names of a site not bound to the port go into the default site's block (when unknown hosts go to it and it listens there) or the generic server's, never taking another site's server-level settings. The default site's server block is thedefault_serverwhile requests are handed to it, a request without a Host goes to the server block named_ ""(the generic server, or one with the default site's settings while node IP access is handed to it) and stays node IP access, and h2c stays on plain listeners. Requests handed to the default site always keep the Host in their cache key; under Force HTTPS a default site without a certificate returns 503, and the redirect happens only withdefault_certificateon and a certificate that covers the host. - Unknown hosts, node IP access (a Host that is an IP or empty) and sites' unbound ports follow the cluster's setting; domains of disabled sites keep the disabled page. Scan protection counts by
ip.src(IPv4 address, IPv6 /64) inedgeweir_cc; over the threshold the node creates a platform-wide automatic ban and reports it throughReportBans(reasonunknown_host_scan), which the console stores as an automatic ban withscope = platformand no cluster (one covering another cluster's trusted proxies or node addresses is not shared and stays with the reporting node; one covering a node address of the reporting cluster or an allow list is lifted at once and records that cluster, so only its nodes get the release; lifting an unshared one in the console reaches every node withunknown-host-v1, guarded by the longest scan ban time the node's cluster has had); nodes' kernel bans never drop their cluster's trusted proxies. - CNAME prefixes: new sites and L4 apps get 8 random characters, existing ones keep their UUID. After a change the old prefix is written to
cname_retired(not one an Automatic binding never wrote to the provider) and stays in the DNS plan for 24 hours (published at once, reasoncname); the per-minutedns.reconciledeletes expired ones cluster by cluster and publishes (reasoncname_expired; one failing cluster holds up neither the others nor the reconciliation). An object can take back its own old prefix during the transition, the UUID from before the upgrade included. Prefixes are unique across sites and L4 apps and neverall,all-<n>or a binding's all-lines record or line name.
| Management action | Audit |
|---|---|
| Change the unknown host settings | cluster.unknown_hosts_update (publishes the cluster, reason unknown_hosts_updated) |
| Change a site's / L4 app's CNAME prefix | site.cname_update / l4.cname_update (publishes the cluster's DNS, reason cname) |
Behavior: domains and unknown hosts.
Node channel
Connect-RPC over HTTPS; the console process terminates TLS itself.
| Item | Value |
|---|---|
| Internal CA | ECDSA P-256, valid for 10 years, generated on first start; private key envelope-encrypted in pki_authority |
| Server certificate | Issued by the internal CA at every start, valid for 90 days; checked hourly and reissued in-process when less than a third of the lifetime remains, and at once when the node channel URL in system settings changes (every instance hears of it through LISTEN/NOTIFY), so new handshakes get the new certificate and established connections keep theirs; SANs are the host name of EDGEWEIR_NODE_API_URL (the host name of EDGEWEIR_PUBLIC_URL when unset), EDGEWEIR_NODE_API_HOSTNAMES, the hosts of the node channel URL saved in system settings and of the URLs in effect before it (the latest 32), localhost, 127.0.0.1, ::1, and the container host name |
| Node certificate | CN is the node ID, client authentication only, valid for 30 days (server and node certificates are valid from 1 hour before issue, for nodes whose clocks run behind); with less than a third of the lifetime left, ReportStatus asks the node to call RenewCertificate. After a renewal the old certificate (node.previous_cert_serial) stays valid until the node first authenticates with the new one; a node that could not install the new one renews again with the old one. A disabled node may still renew; its other calls are refused |
| Probe certificate | CN is the probe ID, O=Edgeweir Probe (node certificates carry O=Edgeweir Node), client authentication only, valid for 30 days; with less than a third left, GetProbeTargets asks the probe to call RenewProbeCertificate, and the replaced certificate is handled as for nodes. The node channel tells them apart by organization: probe certificates can only call ProbeService, NodeService refuses every certificate that is not a node's, and node certificates call GetProbeTargets and ReportProbeResults only while the node also probes, never enrolling or renewing probes |
| Heartbeat | Every 15 seconds; WatchConfig sends a keepalive every 15 seconds |
| WebSocket entry | GET /node-channel on the web port (subprotocol edgeweir-node-channel, node-channel/websocket.ts): each WebSocket maps to one loopback TCP connection to this process's node channel port, and the node channel's TLS runs inside the WebSocket with the same checks as on :8443. Open with EDGEWEIR_NODE_API_WEBSOCKET=true, while the node channel URL in effect is a wss:// or ws:// one, or once such a URL was saved in system settings; otherwise 404. Requests with an Origin header get 403, requests without the subprotocol 400. A node's connection source address is the client address of the WebSocket request (resolveClientIp) |
Enrollment:
- The operator generates an install command: a single-use token (valid for 5 minutes to 7 days, default 60 minutes, stored as SHA-256 only) and the SHA-256 fingerprint of the internal CA (
--ca-sha256). The token travels in theEDGEWEIR_TOKENenvironment variable. - The node checks the CA fingerprint in the server certificate chain, then sends the token and a locally generated CSR (
Enroll). - The console verifies the CSR signature, issues the node certificate, and marks the token used and writes the audit entry in the same transaction.
Install command and install.sh checks: Adding nodes.
The console never stores SSH credentials; nodes join only through the one-time install command generated by the console and enroll themselves.
Every RPC other than Enroll and EnrollProbe requires a client certificate verified by the internal CA whose serial number equals the current serial stored for the node or probe: a rotated certificate stops working at once, and deleting a node or probe writes its serial to node_certificate_revocation. Disabled or deleted nodes are refused on every RPC, and their open WatchConfig streams close; a disabled probe may only renew its certificate.
| RPC | Purpose |
|---|---|
Enroll | Exchange a single-use token and a CSR for a node certificate |
RenewCertificate | Rotate the node certificate |
WatchConfig | Server stream: revision notifications, task notifications, ban notifications (bans-v1), keepalives |
GetConfig | Snapshot, or diff against base_revision, with a revision receipt |
ReportStatus | Heartbeat, apply receipt, origin health and error codes (passive and active checks reported apart), ban state, host metrics (metrics-v1), cache zone usage (cache-zone-v1, kept in node.cache_usage), the node's clock offset from the console (clock_offset_millis, kept in node.clock_offset_ms); probe in the response tells the node whether it also probes, and console_time is the console's time when it answered: the node reports the difference to the middle of the request's round trip as its next clock offset |
CheckChannel | No side effects: returns the node id of the certificate, the current node channel address and the console's time, also for disabled nodes; used before a node switches address, by edgeweir-node set-server to check a new address and by edgeweir-node diagnose to check connectivity and the clock |
ReportStats, ReportStatsV2 | Per-minute pre-aggregated traffic statistics (ReportStatsV2 also carries the L4 apps' minute statistics, l4-v1); deduplicated by batch sequence |
ReportLogs | Sampled access logs; deduplicated by batch sequence |
UploadDebugLogs | The node's one answer to a debug log pull (DebugLogsTask, debug-logs-v1): the matching entries of its in-memory buffers, at most 10,000 entries / 4 MiB; the console removes secrets again and stores them in node_debug_log |
ReportNodeLogs | The node's own warnings, errors and whitelisted events (agent, supervisor, OpenResty's error log; node-logs-v1); deduplicated by batch sequence and stored in node_log_entry; the console removes secrets again before storing, and the drops the node counts (rate limit, backlog) become one dropped row |
GetOriginCredentials | S3 origin keys, PURGE keys (site_secret) and access authentication secrets (site_auth_rule, JSON) referenced by the cluster's sites; the latter two with an empty access_key_id |
SubmitPurge | A PURGE request the node hands on (site-content-v1): the console checks that the node's cluster serves the site, that the site has PURGE on and that the URL belongs to it, then creates a URL purge task as the node (source purge_method), at most 120 per site and minute |
GetCertificates | Certificate chains and private keys referenced by the cluster's sites (further certificates included) |
GetSessionTicketKeys | The cluster's TLS session ticket keys (80 bytes); a node only gets its own cluster's |
PullTasks, ReportTaskResult | Purge, prefetch, upgrade, and debug log pull tasks |
GetBans, ReportBans | Incremental ban changes of the node's cluster by sequence; upload of the node's automatic bans |
EnrollProbe (ProbeService) | Exchange a single-use probe token (ewp_) and a CSR for a probe certificate; the same request size limit as Enroll, and the token is used up only by a successful enrollment |
RenewProbeCertificate | Rotate the probe certificate (nodes use RenewCertificate) |
GetProbeTargets | Probe targets (node, address, port, method, PROXY protocol), interval, timeout, and attempts |
ReportProbeResults | One round of probe results, at most 10,000 per call; the clusters concerned are evaluated right after |
A revision receipt is sealed with the master key (purpose node.revision_receipt, bound to the node ID) and carries the cluster, the revision, and the content hash. The node stores the receipt locally and returns it in ReportStatus; a report of an applied revision above the console's latest revision without a valid receipt is refused. During a master key rotation, receipts sealed with the old key stay valid.
Certificates and DNS
edgeweir-certd performs ACME issuance, renewal, and revocation and DNS record operations.
- The pg-boss queue
certificates.sweepselects, every minute, certificates waiting for issuance and certificates pastrenew_at(new requests and manual renewals first, then byrenew_at, three at a time). A failure backs off by the remaining validity (a tenth, 10 minutes to 12 hours; one hour for a first issuance); an HTTP-01 certificate that failed because names did not resolve to the nodes (http01_dns_not_pointing) has its names looked up again every 5 minutes and is retried once they point to the nodes. Issued certificates read their ARI renewal window after the CA's Retry-After (1 to 24 hours, 6 by default) and renew earlier when the window ends beforerenew_at. - The worker starts
EDGEWEIR_CERTD_BIN(/usr/local/bin/edgeweir-certdin the image) with onlyPATHandEDGEWEIR_DNS_TEST_ENDPOINTin its environment. The directory URL, its CA certificates (rootCa, trusted with the system roots), EAB and key type (ec256/rsa2048) are request parameters: the built-in CAs' directories (Let's Encrypt, ZeroSSL, Google Trust Services) are inACME_CA_DIRECTORIES;customtakes the system settingacme_directory(URL, EAB key id, the envelope-encrypted HMAC key with purposesystem_setting.acme_directory, CA certificates, and themeta.caaIdentitiesread from the directory when saved), each field falling back toEDGEWEIR_ACME_DIRECTORY/EDGEWEIR_ACME_CA_FILEwhen not saved. - It writes one JSON request line to stdin (command and parameters, including the ACME account and DNS credentials). certd writes JSON event lines to stdout (
account,http01.present,http01.cleanup,dns01.prepare,dns01.cleanup); the console handles each one and acknowledges it on stdin. The last line is the result. - One
http01.presentcarries all HTTP-01 challenges of an order: they are written toacme_challenge, each cluster involved publishes one revision, and once nodes apply it certd has the CA validate them (four at a time);http01.cleanuponly deletes the rows and publishes nothing (nodes and the next revision drop a challenge once it expires or its operation ends). Challenge revisions do not count toward the 200 kept revisions and are deleted after an hour.dns01.preparerecords the cleanup obligation indns_challenge_leasebefore certd writes the TXT record; after completion, failure, or a restart, only the values written by that operation are removed. The ACME account from anaccountevent is envelope-encrypted intoacme_account; certificates with the same directory, EAB key id, and email share one account. Certificates record their account (certificate.acme_account_id), which the account list counts, and an account certificates use cannot be deleted (ACME_ACCOUNT_IN_USE). At worker startmaintenance.link-acme-accountslinks the certificates issued before, and records those issued in the environment-variable era (whose last directory is not the chosen built-in CA's) ascustom. - The result is written back to
certificate: chain (certificates only), fingerprint, expiry, next renewal time, and the envelope-encrypted private key (PKCS #8); a request withbindSiteId(one-click HTTPS on a site's HTTPS tab, preceded byhttps.check, which lists every blocker at once: nodes, DNS, the DNS credential and CAA) is bound to the site in the same transaction (the HTTPS redirect and other settings unchanged); clusters that reference the certificate publish a new revision.
Domains a site's certificate does not cover yet (the certificate is being reissued for them) are published with Domain.tls_pending (proto v0.19.0) when every active node of the cluster has tls-pending-domains-v1, and nodes serve them over HTTP only; otherwise they are left out until the new certificate is issued.
Uploads and issued certificates with EC keys that spell out the curve's parameters are refused: nodes (Go crypto/tls) cannot load them. Uploads stored before are checked by maintenance.check-certificates at worker start, which opens their private keys: those nodes cannot load get status error with last_error certificate_chain_explicit_curve or certificate_key_explicit_curve, audited as certificate.unloadable. Saving a site's HTTPS settings checks the chosen certificate itself and refuses such a certificate with CERTIFICATE_CHAIN_EXPLICIT_CURVE / CERTIFICATE_KEY_EXPLICIT_CURVE; a site bound to one is not changed automatically, and its cluster's nodes apply a new revision once another certificate (or none) is bound.
| Limit | Value |
|---|---|
| Duration per call | 5 minutes for dns.*, 8 minutes otherwise, then SIGKILL |
| stdout size | 16 MiB for dns.* commands, 2 MiB otherwise |
| stderr | Discarded (dependency diagnostics may quote credentials) |
| Commands | version, providers, obtain, renew, revoke, renewal-info, dns.list, dns.set, dns.present, dns.cleanup, dns.zones, dns.test |
| DNS providers | The provider catalog helpers/certd/catalog.json, see Providers and credentials |
DNS steering is bound per cluster (dns_binding, mode Not managed, Manual, or Automatic): dns.reconcile computes, every minute, the records of each cluster in Automatic mode from healthy nodes and site domains (one set of address records per cluster, all.<domain> once per resolution line, one CNAME per site; node addresses and backup node groups as in Regional probes and scheduling), creates a dns_revision for that cluster, and writes it to the zone of the binding's provider account (platform_dns_provider); clusters publish and reconcile on their own, so an unavailable provider does not affect other clusters, and one process at a time writes a cluster (dns_lease). Nodes keep their records while they apply a revision published less than 2 minutes ago. Names are recorded in dns_managed_name before external records are written, so partial writes can be repaired; new records are written before the records they replace. Manual mode only produces the records to create and a zone file and writes no DNS. DNS steering provider accounts and DNS-01 credentials use the same provider catalog. A site's domains route as soon as they are saved; a domain belongs to one site. Behavior: HTTPS and certificates, DNS steering and alerts.
Site TLS: several certificates, client certificates, and session resumption
- A site's first certificate is
site.certificate_id, up to 3 more are insite_certificate(positions 1–3, foreign keyrestrict); on save every domain of the site must be covered by one of them. The IR carriesSite.additional_certificate_idsin the site's order, and a configuration with further certificates requiresmulti-certificate-v1. Nodes set one certificate per handshake inssl_client_hello_by_luafrom the ClientHello (among the key types the client can use, exact names before wildcards, then ECDSA, then the site's order), and staple the OCSP response of that certificate. - Client certificates live in
site.tls_settings(mode, CA PEM, depth, forwarding); the IR hasSite.client_certificateand requiresclient-cert-v1, as do rules readingtls.client.*. Nodes ask for a certificate withngx.ssl.verify_clientwithout aborting the handshake and decide in the request phase (403client-cert-requiredwhen Required). Visitors' ownX-Client-*request headers are removed on every site. Not together with HTTP/3 (CLIENT_CERTIFICATE_HTTP3). - Session resumption: nodes' HTTPS listeners use
ssl_session_cache shared:edgeweir_tls:16mandssl_session_timeout 1h, withssl_early_data offwritten out; each site has its own session context (SSL_set_session_id_context), so sessions resume on the same site only. Ticket keys are per cluster (session_ticket_key:next,current,previous), created when a cluster with a site using a certificate publishes; the IR holds ids and roles only (NodeConfig.session_ticket_keys, sorted by id, no capability required, ignored by older nodes), and nodes fetch the 80-byte keys withGetSessionTicketKeys. A key is generated the first time it is fetched and stored envelope-encrypted (purposesession_ticket_key.secret). maintenance.rotate-session-ticket-keyschecks hourly and rotates once the newest key is 12 hours old (the same way as challenge keys); clusters whose latest revision carries ticket keys publish a new revision (reasonsession_ticket_keys_rotated), audited ascluster.session_ticket_keys_rotate. Nodes writessl_session_ticket_keyin the order current, previous, next; file names follow the keys, so a rotation reloads.
Origin protection: origin client certificates and the Origin CA
- Two authorities apart from the node channel's CA, both in
pki_authority(origin-client,origin-ca), ECDSA P-256, private keys envelope-encrypted (purposepki_authority.private_key_envelope, bound to the row id), created by the operator on the certificates page: the origin client CA for 10 years, the Origin CA for 20. - Origin client certificates are issued per cluster (
origin_client_certificate: CN the cluster id, OEdgeweir Origin Client, client auth only, 90 days), keys envelope-encrypted (purposeorigin_client_certificate.private_key_envelope); one is issued when a site turns on presenting a client certificate, andmaintenance.rotate-origin-client-certificateschecks hourly, issuing a new one 30 days before expiry and publishing the clusters whose latest revision carries client certificates (reasonorigin_client_certificate_rotated). Earlier ones stay until they expire and are deleted 7 days later. IR:OriginPool.client_certificate_idandNodeConfig.origin_client_certificates(CertificateRef, sorted by id), requiringorigin-mtls-v1; nodes fetch chain and key withGetCertificates(only for clusters whose published revisions reference them). - Nodes write the key to
<prefix>/conf/origin-client/<id>-<first 16 of the fingerprint>.key(0600, owned by the nginx worker user) and the chain to the.crtof the same name; the three origin layers (HTTP/1.1, HTTP/2, gRPC) render*_ssl_certificate $edgeweir_origin_certand*_ssl_certificate_cache, set per chosen origin inbalancer_by_lua(empty for S3 and HTTP origins, which present nothing). Keep-alive pools are keyed by SNI, trust and client certificate (edgeweir.origin.pool_key): requests with another certificate or trust never reuse the connection. Active health checks present the same certificate. - Certificates the Origin CA issues for origins are in
origin_certificate(host names, key type, sourcegenerated/csr, serial, revocation time); keys are never stored (a generated key is returned once), and they cannot be uploaded as certificates for visitors (CERTIFICATE_ORIGIN_CA). A revocation re-signs the CRL with the Origin CA (unexpired revoked certificates only,nextUpdatethe CA's expiry), stored inpki_authority.crl_pem, and publishes the clusters that trust the Origin CA (reasonorigin_certificate_revoked); rollbacks also get the current CRL and client certificate. - Trust:
OriginPool.tls_trust(ORIGIN_TLS_TRUST_ORIGIN_CA) needs verification and no S3 origin in the pool, withNodeConfig.origin_ca(certificate and CRL), requiringorigin-ca-v1. Nodes render the three origin layersorigin-oca[-h2|-grpc].sockonly while a site trusts it, with*_ssl_trusted_certificateand*_ssl_crlpointing at<prefix>/conf/origin-ca/<content hash>.pem/.crl(the names follow the content, so a revocation reloads). nginx checks CRLs along the whole chain, which is why the Origin CA is a trust of its own and never combined with the system CAs. - Rotation: every
pki_authorityrow has akind(node-channel,origin-client,origin-ca), astatus(activesigns,nextis only trusted,previouswas replaced but is still trusted) and ageneration, with(kind, status)unique; the first generation's id is the kind, later ones are<kind>-g<n>named withG<n>(two authorities trusted at once never share a subject, which is how OpenSSL finds issuers and CRLs).origin_certificateandorigin_client_certificaterecord the issuingauthority_id. The Origin CA:rotate(the new CA issues, the old one becomesprevious;NodeConfig.origin_ca_previouscarries it with its own CRL and requiresorigin-ca-rotation-v1, refused while active nodes of the clusters lack it), thenretire(the old row and its key are deleted, nodes stop trusting it);cancelwhile the new CA has no valid certificates. A revocation rebuilds the CRL of the CA that issued the certificate; rollbacks and the canary's stable revision use the two current CAs. The origin client CA:rotate(next, only in the trust bundle), thenactivate(nextbecomes active and every cluster switches to a certificate of it and publishes; failures are caught up by the hourly replacement, and issuing takes the active rowFOR SHARE), thenretire(refused while a cluster presents the old CA's certificates);cancelbeforeactivate. Every step writes its audit entry in the same transaction (origin_ca.rotation_start|retire|rotation_cancel,origin_client_ca.rotation_start|activate|retire|rotation_cancel).
Access authentication
- A site has at most 16 authentication rules (
site_auth_rule, ordered byposition): kindbasic,forwardorurl_a–url_d, a scope (domains, path prefixes, extensions, excluded path prefixes) and the kind's settings; the secret (Basic users with PBKDF2-HMAC-SHA256 hashes, the primary and backup keys of signed URLs) is one JSON document envelope-encrypted in the same row (purposesite_auth_rule.secret_envelope, bound to the rule ID), andsecret_versiongrows with every change. The IR isSite.auth_rules(the enabled rules in order, scope lists sorted) with references to the secrets only (credential_id,credential_version); it requiresaccess-auth-v1. - Nodes fetch the rules' secrets of their cluster's sites with
GetOriginCredentials(the path of S3 and PURGE keys), keep them incredentials.jsonin the state directory (0600) and attach them, parsed, to the site table in the data plane's shared memory; a rule without its secret stays but has no users or keys and refuses every request in its scope. - In the edge layer's access phase the first enabled rule whose scope the request matches is chosen after the PURGE method, and a signed URL loses its signature at once (A and D their query parameters, B and C two segments of the normalized
$uri); the check runs after the platform allow and block lists and before the rule phases (a plain HTTP request the site forces to HTTPS is redirected first). Basic keeps results per worker (successes 60 s, failures 10 s) and limits failures per site and client network (shared dictionaryedgeweir_auth). Forward authentication sends anngx.location.capturesubrequest to the internal location/./edgeweir-auth, which goes through the origin layer to the service (origin address policy, TLS verification, the rule's timeout, only the forwarded request headers); 2xx and 401/403 answers may be cached inedgeweir_auth. - Refused requests are counted in
MinuteStats.auth_failures(node_minute_stats.auth_failures, the hourly and daily rollups and the ClickHouse mirror) and shown on the site's Attacks tab. The console's "Sign a URL" computes with the primary key on the server and neither stores nor sends the result. See Access control.
Access control
- A site's access control lives in
site.access_control(jsonb: hotlink protection, user agents, CORS, geo, WebSocket and security headers, each keeping its settings while off) andsite.block_list_ids,site.allow_list_ids(referencingip_list; a list in use cannot be deleted);accessControl.updatereplaces the parts in the request only and publishes the site's cluster. - The compiler writes only the parts that are on into
Site.access_control(protov0.28.0), capabilityaccess-control-v1; geo access also needsgeoip-city-v1/geoip-asn-v1by its lists (subdivisions: the console checksgeoip-subdivision-v1). A site without any setting encodes byte for byte as before. Origins, host forms, Referer parsing, user agent wildcards and every decision have a reference implementation in@edgeweir/rule-enginethat shares its test vectors with the node's Lua. - Edge access phase: once the site is known the node works out "site allowed" (
ip.srcon a site allow list), which skips site bans and CC bans of single clients, site block lists, geo, hotlink, user agents and Under Attack / CC challenges; after the platform allow and block lists come site block lists → geo → CORS preflights answered at the edge (204 / 403, never sent to the origin) → hotlink → user agents → access authentication → rule phases; WebSocket upgrades have their origin checked after the rules. The header filter adds CORS and security headers before the response phase rules run (rules win), cache hits included. The origin layer gives upgraded connections the site's WebSocket idle timeout; the edge layer's local hop to it allows 86400 seconds. ipCheck.checkis read-only: the lists holding the address, the active bans covering it, what each cluster's client address setting makes of it (trusted proxy, node address), and for a chosen site the outcome in the edge's order; no GeoIP. See Access control.
WAF actions, request bodies and verified crawlers
- Rule actions stay in
edge_rule.action: the custom WAF phase adds Ban, Custom response, Close connection and Skip; the log action hasaccessLog, rate limitsbanSeconds, config actionscrs. The compiler writesRuleActionfields 34–43 (protov0.29.0, capabilitywaf-v2) only when used, defaults as zero values (the /32 and /64 ban prefixes as 0, for one). CRS exclusions live insite_waf.exclusions: whole-site entries without targets merge into the formerexcluded_rule_ids, those with a path or targets go intoSiteWaf.exclusions. - Request body fields,
form_valueandjson_valuework in the request phases only (capabilityrules-body-v1); sites whose rules reference them (every site when a global rule does) carrySite.rules_body_limit(site.rules_body_limit).@edgeweir/rule-enginehas the reference parsing of forms, multipart and JSON, sharing test vectors with the node's Lua. Nodes read a body only when an expression evaluates such a field, and only requests whoseContent-Lengthis within the limit; ModSecurity in the CRS location then inspects the same body. - The ban action and a rate limit's ban are written by the node through the automatic ban channel and reported with
ReportBans(AutoBan.rule_id); the console stores them with sourcerule(reasonswaf_rule,rate_limit,trigger.ruleId), sharing the unique index (now with the source), the sharing setting and the per-cluster cap with automatic bans. When a log rule asks for an access log line, the node writes it whatever the sample rate withAccessLog.rule_ids, stored inaccess_log.rule_ids. - CRS by path: nodes match exclusions and the config rules' CRS override against the normalized path in the edge layer, hand the matching entries' content tokens to the generated ModSecurity rules (
ctl:ruleRemoveById/ctl:ruleRemoveTargetById) in the internal headerX-Edgeweir-Waf-Ex, and rewrite the mode inX-Edgeweir-Wafor skip the CRS location for an override; both internal headers are removed before the origin. SiteProtectionfields 8–11 (capabilitychallenge-v2): verified search engine crawlers (reverse and forward DNS through the node's own resolver, cached in a shared dictionary), challenge page text and challenge failure bans (reasonchallenge_failures), stored in new columns ofsite_protection. See Rules, OWASP CRS and Challenges.
Access log fields and statistics dimensions
- Once the edge layer knows the site, it looks the client up in GeoIP once per request (no call to the agent on a worker cache hit; these lookups time out after 50 ms and, after a failure, the worker skips them for 5 seconds); logs and statistics share the result. The origin layer hands the origin address back in the internal response header
X-Edgeweir-Upstream(the edge appliesproxy_hide_header; cache hits record no origin). - Nodes record block reasons where they refuse (
edgeweir.reasons, the first one of a request wins); requests refused once the site is known are counted and logged. WithSite.log_blocked(protov0.30.0, featureaccess-logs-v2), requests with a block reason get a line whatever the sample rate, sharing the budget of 100 lines per site and second on a node with log rules;log_query,log_headersandlog_peerselect the optional fields, which the console keeps only while the site records them. - Statistics dimensions (
MinuteStats14–24, featurestats-dims-v1, statistics only) accumulate in each worker's minute buckets and reach the shared dictionaryedgeweir_topstatswith the top URLs and IPs once the minute ends; the console adds them key by key (networks and referrers keep the top 50), rolls them up by minute, hour and day, andanalytics.dimensionsreads them. AS names are kept inasn_name. - Fetches per origin (
MinuteStats.origins, featureorigin-stats-v1, statistics only): the node counts every attempt in the origin layer's log phase by site and origin id (attempts, no connection, timeouts, TLS failures, invalid answers, 5xx, and the time to the response header of answered attempts as 11 buckets and a sum) in the same minute bucket, at most 64 origins per site and minute. The console keeps UUID origin ids only, stores them asorigin_stats(keys<origin id>:<field>), adds them key by key and rolls them up by minute, hour and day;sites.originQualityanswers the site's current origins, with percentiles interpolated inside a bucket. See Origins and cache. - Access log retention is the system setting
log_retention: PostgreSQL partition maintenance and the earliest time of writes and searches follow it; ClickHouse runsALTER TABLE access_log MODIFY TTLon save and at the first maintenance after a process starts. edgeweir-node accesslogreads the shared dictionaryedgeweir_tapthrough the control APIGET /v1/logs/tap: only while a viewer's renewed marker exists does the log phase record requests (expiring after 10 seconds, at most 2,000 per node and second), independent of the sample rate and outside the upload queue. Nodes write no local log files. See Access logs and AccessKeys.
Site tags, batch operations and copying settings
- Tags live in
tag(key: the NFC name in lower case, unique) andsite_tagand are used by the console only: they never enterNodeConfigand changing them publishes nothing. Tag writes take the advisory lockedgeweir.tagsbefore the site rows, which they lock FOR KEY SHARE in id order.sites.listfilters bytagIds(any or all) andsearchalso matches tag names. - Batch on/off and delete run in one transaction: each site that changes gets the same audit entry as the single action, each cluster is published once (
publishRevision, the reason with the number of sites); deletion works asdeleteSite,lockStatsfirst and the usage computed. A batch purge is the existing whole-site task for several sites. - Copying settings (
services/site-copy.ts) splits a site's settings into 16 parts, each read (defaults filled in, comparable), checked and adjusted against the target, then written, with the same checks as saving each tab (origin groups, domains, certificate and HTTPS ports, IP lists FOR SHARE). The source is read once (access authentication secrets decrypted in memory only); each target is one transaction that writes only the parts that differ, publishes the target's cluster for it and auditssite.settings_copied; a failing target rolls back as a whole. A preview runs the same and rolls the transaction back. Access authentication secrets, PURGE keys and S3 secrets are sealed again with the master key for the new rows (envelopes bound to the new record ids). Copies and clones keep no link between source and target: changing the source later does not change them. See Managing many sites.
Image format conversion
- Settings live in
site.image_convert(jsonb,{}is the defaults, off); only while on are they compiled intoSite.image_convert(protov0.31.0, featureimage-convert-v1), so a site with it off compiles byte for byte as before. Changes are hot updates. - After the cache decision, for GET / HEAD requests that are cached, the edge layer picks a class from
Accept(avif > webp > original; explicit types only, navigations namingtext/htmland paths with another extension than the source types' get the original), appends|i=<class>to the cache key (before the purge epoch; the original's key is unchanged), never slices a variant request and sends it to upstreamedgeweir_image(the agent'simage.sock) withX-Edgeweir-Imagenaming the class, quality, ranges and the origin layer it would have used. Image responses of eligible requests getVary: Accept. - The agent's converter passes the request on as it came (method, raw URI, headers, without
X-Edgeweir-Image) to that origin layer, which picks the origin and writesX-Accel-Expiresas always; a 200 of a chosen source type within the size and pixel range is converted in a child processedgeweir-node imgconv(pure Go: gen2brain/webp and gen2brain/avif built withnodynamic,wasm2go, libwebp 1.6.0 and libavif 1.4.2 / aom 3.14.1 transpiled to Go; the standard library decodes). The child hasRLIMIT_DATAof its estimate plus 256 MiB, cannot write files, drops its capabilities, runs withGOMAXPROCS=1and is killed at the timeout. A converted response gets a newContent-Type,Content-LengthandETag(-webp/-avifappended) and the internal headerX-Edgeweir-Image-Saved(hidden from clients by the edge, read on cache hits too); failures, limits and variants that are not smaller answer with the original, and only a missing conversion slot capsX-Accel-Expiresat 60 seconds. When the origin layer closes on purpose so that the edge serves its stale copy, the converter closes too. - Concurrency, the memory total and the timeout are node flags (
--image-workers,--image-memory-mb,--image-timeout); with--image-workers 0the agent does not listen onimage.socknor announceimage-convert-v1, and configurations that convert are rejected, keeping the last-known-good one. - Saved bytes are added up per minute in the edge layer's log phase (complete 200 GET responses), reported as
MinuteStats.image_bytes_saved, and kept in minute, hour and day statistics and the viewtraffic_hour_stats. See Image format conversion.
Markdown for Agents
- Settings live in
site.markdown(jsonb,{}is the defaults, off); only while on are they compiled intoSite.markdown(include and exclude prefixes, sorted and unique; protov1.9.0, featuremarkdown-v1), so a site with it off compiles byte for byte as before. Changes are hot updates. - Before the cache decision, for GET / HEAD requests on an eligible path (no extension or an HTML-like one, prefixes matched), the edge layer adds
Vary: Acceptto HTML and Markdown responses; whenAcceptnamestext/markdown(q > 0) it never slices the request and sends it to upstreamedgeweir_markdown(the agent'smarkdown.sock) withX-Edgeweir-Markdownnaming the origin layer it would have used; cached requests append|m=mdto the cache key (before the purge epoch; the HTML's key is unchanged), and purge markers, Cache-Tags and the cache generation reach both variants.Varyis added only towards clients; cached objects carry none, so the cache is not split by every client'sAccept. - The agent's converter fetches the whole document from that origin layer as a GET (HEAD too: the Markdown's headers depend on the whole document), without conditions or Range, accepting identity or gzip only; a 2xx (not 204, 205, 206)
text/htmlof at most 6 MiB after gzip decoding is converted in a child processedgeweir-node mdconv(JohannesKaufmann/html-to-markdownv2 andgolang.org/x/net/html, charsets detected byx/net/html/charset): navigation, page-level headers and footers, sidebars, forms, scripts and hidden elements are dropped, a single visible<main>is converted alone, links become absolute, YAML frontmatter goes first and JSON-LD last. The child has the same limits as image conversion (internal/sandbox). A converted response getsContent-Type: text/markdown; charset=utf-8,X-Markdown-Tokensand the defaultContent-Signal, losesETag,Last-Modifiedand the encoding and range headers, and carries the internal headerX-Edgeweir-Markdown-Converted(hidden from clients by the edge, read on cache hits too); failures, limits and empty results pass unchanged, and only a missing conversion slot or a slow origin capsX-Accel-Expiresat 60 seconds. - Concurrency, the memory total and the timeout are node flags (
--markdown-workers,--markdown-memory-mb,--markdown-timeout); with--markdown-workers 0the agent does not listen onmarkdown.socknor announcemarkdown-v1, and configurations that convert are rejected, keeping the last-known-good one. - Markdown responses are counted per minute in the edge layer's log phase (complete 200 GET responses), reported as
MinuteStats.markdown_responses, and kept in minute, hour and day statistics and the viewtraffic_hour_stats. See Markdown for Agents.
Tiered Cache
- The console-wide setting is
system_settingtiered_cache(topology, upper tier port 8444, custom nodes and node groups); a site's issite.tiered_cache(null follows the console-wide one). ADR-0073. - Nodes taking part: active nodes of the cluster with a heartbeat in the last 10 minutes that report
tiered-cache-v1; upper tiers also reporttier-upper-v1(the node certificate carries serverAuth and the SAN<node id>; nodes with an older one are asked to renew by the heartbeat'srenewCertificateat most once a day) and have a primary scheduling address (IPv4 first). - Selection (
chooseTiersinconfig-compiler/src/tiers.ts, a pure function): Smart, Generic, Regional and custom, see Tiered Cache. Latencies are the TCP round trip times nodes measure every minute to the first primary origin of each site's default origin group (ReportStatusRequest.tier_latencies→tier_latency; only successful measurements of the last 10 minutes count). A chosen upper tier stays while within 120% + 5 ms of the fastest. Choices are kept intier_selection(one row per site: topology, each node's upper tiers and why, the measured target, when chosen). - Every
publishRevisionrunssyncTierSelectionsunder the publish lock first;loadConfigInputthen compiles the choices intoNodeConfig.tiered_cache: sites with the same hops share a plan (its id a hash of the hops) thatSite.tier_plan_idnames; only upper tiers carry an address; the latency targets are the origins of every tiered site (ids a hash ofhost:port). Without plans and targets the field is left out, so a cluster without tiers compiles byte for byte as before. - The pg-boss queue
tiers.selectchooses again every minute for clusters with tiered sites and publishes withtier_selection_changedwhen upper tiers change. Changing the console-wide setting publishes the clusters of the sites that follow it (tiered_cache_updated). - Statistics: nodes report
MinuteStats.tier_fetches(lower tiers, by the upper tier's cache status,originfor fallbacks) andtier_served(answers to lower tiers); the console keeps them astier_stats(f:<status>/v:<status>) of the minute, hour and day statistics and the viewtraffic_hour_stats. The access log'stierfield is<node id> <status>ororigin.
Node extensions
Generic, signed Lua extensions of the edge request path (format edgeweir-node-extension-v1, Lua API 1, ADR-0071; contract in Node extensions). The console and the node know no particular extension, check no licenses and contact nobody about them.
- Trust: the operator adds publisher keys (Ed25519 public JWKs,
extension_key, kid = RFC 7638 thumbprint); there are none by default. Installing (POST /extensions, base64 package + compact JWS) verifies the archive (strict ustar, limits, no links / native code / bytecode), the manifest (strict schema) and the signature against a trusted key whose publisher matches, then stores the version (extension_version, bytes in the database). A new id starts disabled; installing a newer version of an installed id activates it. - Settings: per extension enabled, failure mode and global configuration (
extension), per site enabled and site configuration (site_extension), the kill switch (system settingextensions). Configuration is validated against the manifest's JSON Schema subset;x-secretvalues are masked in answers. Manifest rule fields registerext.<id>.<name>in the rule engine, which rules may use in request phases; removing an extension or version that rules still read is refused. - Compilation (
packages/config-compiler):NodeConfig.extensionslists, in install order, the active version of each enabled extension that an enabled site of the cluster turns on (digest, size, signature, signing key, failure mode, global configuration, shared dicts), with the kill switch; each site lists its extensions with their site configuration. Delivered extensions or rules readingext.*requireextensions-v1; enabling is refused while an active node of an affected cluster lacks it. - Node: the agent fetches missing packages by digest (
GetExtensionPackage, mTLS), verifies them again (and against--extension-keyswhen set), unpacks them to<state>/extensions/<sha256>/and lists the loadable ones innginx.conf(init parameterextensions, onelua_shared_dict ewx_<hex id>_<name>per declared dict). A change of the loaded set reloads nginx; settings and site lists are hot.--no-extensionsturns it off. - Runtime (
lua/edgeweir/ext.lua): each worker loads packages into an environment of their own, runsiniton first use and callsaccess(before access control, rules and challenges),access_late(after them, before the CRS, cache and origin),header_filter,body_filter(with HTML injection) andlog, and answers/.edgeweir/ext/<id>/…(assets, endpoints). Hooks run underpcallwith time budgets; faults trip an extension per worker; failure modeclosedanswers 503X-Edgeweir-Error: extension. - Reporting: access logs carry
AccessLog.ext(log fields, verdicts) and block reasonextensionwith rule idext:<id>; minute statistics carryMinuteStats.ext_counters; heartbeats carryExtensionStatusper extension (state, faults, trips), shown per node in the console.
Regional probes and scheduling
- Probers: regional probes (
probe;edgeweir-node probeenrolls throughEnrollProbewith a one-timeprobe_token), or nodes withnode.probe_enabledwhose node group has a region (probe=truein theReportStatusresponse). GetProbeTargetsreturns every enabled node's scheduling addresses (node_ip: only theconfiguredrows and their levels when there are any, otherwise the publicreportedaddresses) × the listener ports of the cluster's latest revision, with interval, timeout, and attempts; HTTP / HTTPS listeners are probed through the health endpoint when every active node of the cluster hasprobe-health-v1, otherwise with TCP only. A node that also probes skips itself.ReportProbeResultsaccepts current targets only and writesprobe_result(one row per prober, node, address, and port, latest value); rows not updated for 1 hour are deleted.- Every 10 seconds (an in-process timer of the worker; a lease lets one process run at a time) and after every probe report (at most every 2 seconds per cluster and process), each cluster is evaluated in a transaction (advisory lock): first
node_address_statefrom the results in the window (3 intervals, at least 15 seconds; a strict majority of probers failing foripDownSecondsmakes an address unreachable,ipUpSecondswithout failing makes it reachable), thenscheduling_statefor everyscheduling_ruleand node (since when each condition holds, the action started, the conditions cleared). - An address level change publishes the cluster's DNS revision (reason
health). Every activation and recovery of a rule publishes one (reasonscheduling,reason_paramswith rule, node, action, and event), is audited with the system identity asscheduling.activate/scheduling.recover, and raises or resolves the platform alertscheduling_action. Clusters with a new revision are written to DNS right away. compileBindingPlancomputes each binding line's addresses from the nodes' effective levels (the lowest reachable level, at least backup 1 under abackup_ipaction), rule removals, and the line's backup node groups (fewer healthy addresses thanminHealthyIps, or abackup_groupaction);all.<domain>is written per resolution line. The mass removal protection compares per name, type, and resolution line, and counts backup group switches only when they empty a record set.
Node metrics (ReportStatusRequest.metrics, metrics-v1) are kept in node.metrics, latest value only; scheduling treats metrics older than 60 seconds as missing.
| Management action | Audit |
|---|---|
| Probe tokens, renaming and enabling, deletion (revokes the certificate) | probe.token_create, probe.update, probe.delete |
| Probe enrollment and certificate renewal | probe.enroll, probe.certificate_renew (actor: the probe) |
| Probe settings | system.probes_update |
| Scheduling addresses, probing nodes | node.set_addresses (publishes the cluster's DNS, reason manual), node.set_probe |
| Scheduling rules | scheduling.rule_create, scheduling.rule_update, scheduling.rule_delete (disabling, deleting, or changing line, conditions, or action first ends the actions in effect) |
Behavior: Regional probes and scheduling.
Statistics, logs, and alerts
| Mode | EDGEWEIR_ANALYTICS | Access logs | Per-minute statistics | Charts and alerts |
|---|---|---|---|---|
| lite (default) | lite | PostgreSQL access_log, one partition per UTC day | PostgreSQL | PostgreSQL |
| ClickHouse | clickhouse | ClickHouse access_log | PostgreSQL, with a copy in ClickHouse minute_stats | PostgreSQL |
Access logs are sampled per site; the sample rate defaults to 0 (off). Per-minute statistics pre-aggregated by nodes go to node_minute_stats; the worker rolls them up into node_hour_stats and node_day_stats, and the view traffic_hour_stats combines rolled-up and pending data. Overview, site statistics, and the platform overview query 1-hour, 6-hour, 24-hour, 7-day, and 30-day ranges in buckets (date_bin); the 7-day and 30-day ranges read hourly data.
| Data | Retention |
|---|---|
| Access logs | System setting log_retention: PostgreSQL 1–30 days, ClickHouse 1–90 days, 7 by default |
| Node logs | System setting node_log_retention: 1–30 days (7 by default), at most 1,000–100,000 entries per node (10,000 by default) |
| Per-minute statistics (PostgreSQL and ClickHouse) | 7 days |
| Per-minute statistics of L4 apps | 7 days |
| Hourly statistics | 90 days |
| Daily statistics | 365 days |
Alerts (alerts.sweep, every minute) detect offline nodes, skewed node clocks (the offset of the last heartbeat at or above the alert policy's seconds; one alert per node, like offline nodes), expiring certificates, unavailable origins, and high 5xx rates (the cc_mitigation alert fires on a node's event and resolves once no node reports the site above normal), create alert_event rows, fan them out to alert_delivery by alert_subscription (one per channel, covering a set of sites in alert_subscription_site or all sites with all_sites), and send them through an alert_channel (webhook, email, DingTalk, WeCom, or Telegram); at delivery the channel must still be enabled and the subscription still valid, and "receive every alert" channels get every alert. Cluster alerts (configuration canary rolled back, DNS mass removal blocked, DNS reconciliation failing dns_reconcile_failed (5 minutes of failures; resolved by a success or once nothing needs writing), a scheduling rule acting on a node scheduling_action, and others) are raised and resolved by their own flows, resolved when the cluster is deleted, and go only to "receive every alert" channels. Access logs and AccessKeys: Access logs and AccessKeys.
Background jobs
| Queue | Schedule | Work |
|---|---|---|
alerts.sweep | Every minute | Alert detection and delivery |
mitigation.evaluate | Every minute (one job at start) | Evaluates every site's automatic mitigation: turns on the site's Under Attack when a node's CC level reaches the threshold, and turns it off once the level has stayed below it for the configured time; the state and the expiry are in site_auto_mitigation, so a restart or a repeated job only evaluates again |
development-mode.expire | Every minute (one job at start) | Turns off development modes whose deadline (site.development_mode_until) passed: clears it, publishes and audits as the system; nodes resumed caching at the deadline already, so a restart or a repeated job only checks again |
rollouts.evaluate | Every minute | Evaluates running configuration canaries: promote, await promotion, or roll back (canary node heartbeats trigger an evaluation too) |
dns.reconcile | Every minute | Deletes expired old CNAME prefixes and publishes the DNS of their clusters; DNS steering publishing and external record maintenance |
traffic.rollup | Every minute | Traffic rollup and cleanup (L4 app minute statistics included), usage rollup and retention (then every site's usage protection, with an immediate alert sweep when its alerts change), access log partition maintenance, upgrade expiry; one failing part does not stop the others |
certificates.sweep | Every minute | Certificate issuance and renewal |
tiers.select | Every minute | Chooses the tiered cache's upper tiers again and publishes when they change |
maintenance.recompile | At start; skipped while config_recompiled in system_setting matches the current marker | Republishes every cluster once when an upgrade changes what stored data compiles to |
maintenance.check-certificates | At start | Checks uploaded certificates not marked yet and marks those nodes cannot load (EC keys with explicit curve parameters) as failed |
maintenance.link-acme-accounts | At start | Links certificates to the ACME account that issued them; records certificates of the environment-variable era as the custom ACME directory |
maintenance.prune-revisions | Minute 17 of every hour | Deletes revisions and DNS revisions beyond the retention count |
maintenance.prune-idempotency-keys | Minute 29 of every hour | Deletes expired idempotency keys (older than 24 hours) |
maintenance.expire-cache-tasks | Minute 43 of every hour | Fails purge and prefetch deliveries past their deadline; deletes tasks older than 90 days (purges a node has yet to make up stay) |
maintenance.prune-oauth | Minute 47 of every hour | Deletes expired MCP access tokens, refresh tokens expired or revoked more than a day ago, and OAuth clients nobody authorized within 30 days |
maintenance.expire-enrollment-tokens | Every 30 minutes | Deletes enrollment tokens expired or used more than 7 days ago |
maintenance.prune-bans | Every 10 minutes | Deletes bans that expired more than an hour ago |
maintenance.rotate-challenge-keys | Hourly at minute 11 | Rotates challenge keys that are a day old |
maintenance.rotate-session-ticket-keys | Hourly at minute 13 | Rotates TLS session ticket keys that are 12 hours old |
maintenance.rotate-origin-client-certificates | Hourly at minute 19 | Issues clusters a new origin client certificate 30 days before expiry, deletes those expired a week ago |
maintenance.prune-security-events | Hourly at minute 37 | Deletes security events past the retention |
maintenance.prune-node-logs | At start, then every 10 minutes | Deletes node logs past the retention and each node's oldest entries beyond its limit; debug log pulls go after as many days, the last 10 of each node kept |
| Scheduling evaluation (an in-process timer, not a pg-boss queue) | Every 10 seconds; one process at a time (lease), a tick is skipped while the previous run is busy | Probe-driven address reachability and scheduling rules, see Regional probes and scheduling |
Data model
Tables are defined in packages/db/src/schema; migrations are plain SQL generated by drizzle-kit in packages/db/migrations and run at console startup (see Startup sequence).
Account and identities
| Table | Contents |
|---|---|
user | The operator's account, the only one, created by the setup wizard |
session | Sign-in sessions |
account | Sign-in credentials (password hash) |
verification | better-auth verification records |
two_factor | TOTP secrets and backup codes |
passkey | Passkey public keys |
apikey | AccessKeys: hash, permissions, enabled state |
oauth_client | OAuth clients of MCP: registered dynamically or resolved from a client metadata document (client_discovery_id), redirect URIs and scopes |
oauth_resource, oauth_client_resource | The OAuth resource (<console URL>/mcp) and client-to-resource bindings (better-auth's schema) |
oauth_consent | Grants: the scopes the operator approved for a client; last_used_at is the last /mcp request |
oauth_access_token, oauth_refresh_token | Opaque access and refresh tokens, stored as SHA-256 only; bound to the resource, session and refresh token, rotated on refresh |
oauth_client_assertion | Used private_key_jwt assertion ids (replay protection) |
service_account | Service accounts: name, scopes, enabled (cannot sign in) |
service_account_key | Service account keys: SHA-256, prefix, last use, revocation |
idempotency_key | Idempotency keys of /api/v1 writes: caller, method, path, body hash and final response, kept 24 hours |
rate_limit | Rate-limit counters of the authentication endpoints |
Infrastructure
| Table | Contents |
|---|---|
region | Region dictionary |
cluster | Clusters: sets of nodes that share one revision stream; extra listener ports, client IP, unknown host settings (unknown_hosts) and the default site (default_site_id, cleared when the site is deleted) |
node_group | Node groups, optionally tied to a region |
node | Nodes: status, capabilities, certificate serial and fingerprint (after a renewal also the replaced certificate's serial), last heartbeat and its connection's source address, why its certificate was last refused, last reported ban state, CC level per site and host metrics, whether the node also probes, last reported clock offset and when |
node_ip | Node IP addresses: reported by the node (reported) and scheduling addresses the operator configured (configured, level 0 primary, 1 backup 1, 2 backup 2) |
node_address_state | Probe reachability of scheduling addresses: failing since, down flag, answering since |
probe | Regional probes: name, region, enabled, certificate serial and expiry, last seen, version |
probe_token | SHA-256, prefix, name, region, expiry and usage of probe enrollment tokens |
probe_result | Latest result of each prober (probe or node that also probes) per node address and port: sent, lost, latency, error code |
enrollment_token | SHA-256 and usage of enrollment tokens |
node_certificate_revocation | Certificate serials revoked when a node is deleted |
pki_authority | Internal CAs (node channel, origin client, Origin CA), private keys envelope-encrypted; the Origin CA's current CRL |
system_setting | Platform key/value settings: setup token, session secret HMAC check value, origin allow list, SMTP, node release source, alert policy, bans, platform protection and the CC template, platform error pages, one-time migration markers |
audit_log | Audit of management actions |
Sites and configuration
| Table | Contents |
|---|---|
site | Sites: cluster, enabled state, cache key, slicing, Cache-Tag forwarding, WebSocket, certificate, TLS settings, cache generation, log sample rate, whether error pages replace origin errors and when they were saved, when development mode ends |
site_domain | Site domains: name and form (kind: exact, wildcard, suffix, pattern); a name in one form is unique across the console |
site_star | Per-user stars |
tag | Site tags: a name (1–32 characters) and a key (NFC, lower case, unique: names differing only in case are one tag); console only, never sent to nodes |
site_tag | Sites and their tags (at most 10 per site) |
origin_pool | Origin pools: timeouts, keepalive, failure thresholds, origin TLS verification, HTTP version towards the origins and gRPC, active health check and session affinity (kept while off) |
origin | Origins and their origin group (empty for the default group) |
origin_credential | S3 origin keys, envelope-encrypted |
site_secret | Other site secrets (the PURGE method's key), envelope-encrypted, delivered over the node channel only |
site_auth_rule | A site's access authentication rules (at most 16, ordered); Basic user hashes and signing keys envelope-encrypted in the same row, delivered over the node channel only |
cache_rule | Cache rules: condition expression and list references, status and size conditions, action, edge and browser TTLs |
edge_rule | Site or global rules: phase, expression, action, list references |
edge_rule_version | Rule versions: a full snapshot, actor and source (UI, API, restore, settings copy, initial) each time a save creates, changes or deletes a rule; the last 50 per rule and the 100 most recently deleted rules per site and for the platform are kept |
bulk_redirect | A site's bulk redirects: source (path or domain plus path, unique per site), target, status code, whether the query string is kept, order |
cluster_port_pool | A cluster's layer-4 port pools: protocol (TCP, UDP, both) and port range (1024-65535, no overlap per protocol) |
l4_app | Layer-4 applications: cluster, name, protocol, port (unique per cluster, protocol and port), enabled, PROXY protocol (accepted, version sent to origins), passive health check, connect and idle timeouts, allow and block list references, concurrency and new-connection limits |
l4_origin | Origins of a layer-4 application: address, port, weight, backup, order |
ip_list | IP lists (normalized CIDRs, unique names); allow / block lists apply to every site |
ip_ban | Dynamic bans: scope (platform / site), normalized CIDR, reason code, source (manual / auto; auto bans keep the node and trigger), expiry and removal time, seq (sequence ip_ban_seq), whether it is delivered |
site_protection | Site protection: Under Attack and its challenge type, pass lifetime, proof-of-work difficulty, CC policy (template or custom), JA4 logging; no row means the defaults |
site_waf | A site's OWASP CRS: mode (off, detect, block), paranoia level, anomaly threshold, excluded rule ids, request body limit; no row means off |
site_error_page | A site's error pages: one template per status (403, 429, 502, 503, 504) |
challenge_key | Challenge keys of a cluster (next, current, previous), secrets envelope-encrypted |
site_certificate | A site's further certificates (positions 1–3; the first is site.certificate_id); a referenced certificate cannot be deleted |
session_ticket_key | TLS session ticket keys of a cluster (next, current, previous), secrets envelope-encrypted and generated when first fetched |
config_revision | Revisions per cluster: number, content hash, binary IR, reason code |
node_config_status | Node apply receipts and heartbeats, with the receipt verification flag |
cluster_rollout | Configuration canary of a cluster: policy (switch, observation window, auto promotion, 5xx thresholds) and the current rollout (stable and candidate revisions, window, outcome) |
extension_key | Trusted publisher keys of node extensions: kid (RFC 7638 thumbprint), publisher, public key x, label |
extension | Installed node extensions: active version, enabled, failure mode, global configuration |
extension_version | Uploaded versions of an extension: package bytes, SHA-256 (unique), size, signature, signing kid, manifest |
site_extension | A site's extensions: enabled and site configuration |
Certificates, DNS, and domains
| Table | Contents |
|---|---|
certificate | Chain, fingerprint, expiry, renewal state, and the ACME account that issued it; private key and the request's EAB key envelope-encrypted |
acme_account | ACME accounts (shared per directory, EAB key id, and email), account key envelope-encrypted |
acme_challenge | Short-lived public HTTP-01 responses |
dns_credential | DNS provider credentials and zone for ACME DNS-01, envelope-encrypted |
dns_challenge_lease | Cleanup obligations of DNS-01 TXT records |
platform_dns_provider | DNS steering provider accounts and their zones, credentials envelope-encrypted |
dns_binding | A cluster's DNS binding: mode, provider account, cluster domain, TTL, lines (node group, resolution line, ordered backup node groups, minimum healthy IPs), desired / applied DNS revision, since when reconciliation has kept failing |
dns_revision | A cluster's DNS revisions: binding settings, record set (with resolution lines), managed names, status, reason code and parameters |
scheduling_rule | A cluster's scheduling rules: optional line, conditions (metric, aggregate, comparator, threshold, duration, region), and / or, action, hold and recovery times |
scheduling_state | Each rule's state per node: since when each condition holds, when the action started, since when it is clear |
dns_managed_name | Registered managed DNS names and the cluster they belong to |
dns_lease | Leases for DNS work (cluster bindings, DNS-01 credentials): one process at a time handles a binding or credential |
cname_retired | Old CNAME prefixes of sites and L4 apps kept for 24 hours after a change: cluster, site or app, prefix (unique), expiry |
origin_client_certificate | A cluster's origin client certificates: chain, fingerprint, serial, validity, private key envelope-encrypted |
origin_certificate | Certificates the Origin CA issued for origins: host names, key type, source, serial, validity, revocation time (no private key) |
Statistics, logs, tasks, and alerts
| Table | Contents |
|---|---|
node_minute_stats | Traffic per node, site, and minute, with top URLs, top IPs, matched CRS rules and statistics dimensions (country, network, referrer, client, protocol, block reason, challenges) |
asn_name | AS numbers and names nodes report (network names of the statistics dimensions) |
node_hour_stats | Hourly rollups |
node_day_stats | Daily rollups |
stats_rollup_dirty | Time buckets waiting for a rollup (hours, days, usage windows) |
node_stats_cursor | Per-node high-water mark of statistics batch sequences and the statistics watermark (complete_until) |
l4_minute_stats | Per node, layer-4 application and minute: new and refused connections, peak concurrency, bytes in / out, kept 7 days |
site_usage | Recomputable usage per site and UTC 5-minute window (requests, bytes out and in, exact decimals), revision and global seq (sequence site_usage_seq) |
site_usage_guard | A site's usage protection: period (calendar day / month) and time zone, limits on bytes sent / requests / bandwidth, warning threshold, action and recovery, and the current period's state the worker keeps (metrics at the warning threshold / limit, bandwidth peak, the action it applied, how long a manual restore pauses it, the error code of an action that could not be published) |
site_auto_mitigation | A site's automatic mitigation: switch, trigger level, hold in minutes, and the state the worker keeps (since when, until when, trigger level, the pause after the operator took over, error code of the last change that failed); no row means off |
access_log | Sampled and forced access logs (request id, User-Agent, Referer, protocol, region, origin, block reason and rule; JA4, the query string, chosen request headers and the peer address while the site records them; matched CRS rules and whether CRS blocked the request), one partition per UTC day, kept as the retention setting says |
security_event | CC mitigation events reported by nodes: level changes, escalated paths, automatic bans, with the top addresses and paths of the moment |
node_log_cursor | Per-node high-water mark of access log batches |
node_log_entry | Nodes' warnings, errors and whitelisted events (time, level, source, component, message, structured fields, folded count, truncation, event); rows with kind = dropped record how many entries the node dropped; deduplicated by (node, batch, index) |
node_log_entry_cursor | Per-node high-water mark of ReportNodeLogs batches |
node_debug_log | Pulls of a node's debug logs: filters, state (pending, handed out, succeeded, failed), deadline and lease, the uploaded entries (jsonb); at most one unfinished per node, the last 10 kept |
origin_health | Origin health and error codes reported by nodes, one row each for the passive and the active check |
cache_task | Purge and prefetch tasks |
cache_task_node | Delivery and result of a task on each node |
node_upgrade | Node upgrade jobs |
node_upgrade_delivery | Phase, state, deadline, and health observation of an upgrade on each node |
alert_channel | Alert channels, configuration envelope-encrypted |
alert_subscription | One subscription per channel: alert kinds, all sites or a set of sites |
alert_subscription_site | The sites a subscription covers (removed with the site) |
alert_state | Current alert state (site and platform alerts) |
alert_event | Alert events with an ordinal |
alert_delivery | Delivery and retries of an event on a channel |
The view traffic_hour_stats combines hourly rollups with minute data not rolled up yet, without double counting.
Migrations
| Migration | Change |
|---|---|
0000_init | Initial schema: better-auth tables, clusters, node groups, nodes, enrollment tokens, sites, domains, origin pools, origins, cache rules, revisions, node status, per-minute statistics, internal CA, audit log |
0001_m1 | region, organization_settings, system_setting, node_certificate_revocation; revision reason codes; actor and target names in the audit log; node group region |
0002_site_star | site_star |
0003_m2 | origin_credential, origin_health, cache_task, cache_task_node; origin pool timeouts, keepalive, and TLS verification; cache rule extensions; site cache key, slicing, and WebSocket |
0004_wrapup_auth | rate_limit |
0005_wrapup_console | Cache rule cache_authorized; task source; error codes of tasks and origin health |
0006_m3_certificates | certificate, dns_credential, acme_challenge; node capabilities; site certificate and TLS settings |
0007_m3_challenge_attempts | acme_challenge.operation_started_at |
0008_m3_dns_cleanup | dns_challenge_lease |
0009_m4_rules | edge_rule, ip_list |
0010_m5_stats | node_stats_cursor, node_hour_stats, node_day_stats, stats_rollup_dirty, view traffic_hour_stats; top URLs and top IPs in per-minute statistics |
0011_m5_domain_ownership | domain_ownership; site_domain.verified |
0012_m5_dns | platform_dns_provider, dns_state, dns_revision, dns_managed_name |
0013_m5_dns_managed_names | dns_revision.managed_names |
0014_m5_alerts | alert_channel, alert_subscription, alert_state, alert_event, alert_delivery |
0015_m5_alert_order | alert_event.ordinal |
0016_m5_alert_privacy_default | alert_channel.platform defaults to false (platform-wide notifications off by default) |
0017_m6_logs | access_log, node_log_cursor; site.log_sample_rate |
0018_retain_node_traffic | Traffic statistics tables drop their foreign key to node; deleting a node keeps site statistics |
0019_m6_upgrades | node_upgrade, node_upgrade_delivery |
0020_m6_upgrade_health | node_upgrade_delivery.healthy_since |
0021_authenticated_revision_floor | node_config_status.revision_receipt_verified |
0022_bound_traffic_counters | Existing traffic counters clamped to 0 through 2^53−1 |
0023_p0_site_state | Four site state columns (dropped by 0034) |
0024_p0_organization_limits | organization_limit |
0025_p0_service_accounts | service_account, service_account_key, idempotency_key; invitation.inviter_id nullable, new inviter_service_account_id |
0026_p0_usage | site_usage, sequence site_usage_seq, node_stats_cursor.complete_until; marks usage windows for existing minute statistics |
0027_p0_config_canary | cluster_rollout; alert_event.site_id and alert_state.site_id nullable (platform alerts) |
0028_g1_dynamic_bans | ip_ban, sequence ip_ban_seq; node.ban_status; organization_limit.max_bans |
0029_g2_challenges | site_protection, challenge_key, security_event; node.security_state; access_log.ja4 |
0030_g3_waf | site_waf; waf_rules in minute, hour and day statistics and the view traffic_hour_stats; access_log.waf_rule_ids, waf_blocked |
0031_g4_cache_origins_error_pages | site_error_page; origin_pool.active_health_check, session_affinity; site.keep_cache_tag, intercept_origin_errors, error_pages_updated_at; origin_health.source (joins the primary key, existing rows are passive); access_log.request_id |
0032_g5_rules | bulk_redirect; origin.group_name; cache_rule.browser_ttl_seconds, list_ids; the structured conditions of existing cache rules are rewritten as equivalent expressions and the structured columns cleared |
0033_domains_without_ownership | Drops domain_ownership and site_domain.verified; of duplicate pending domains one row stays; site_domain (name, wildcard) is unique |
0034_sites_without_suspension | Drops the 0023 site state columns; sites they took offline become disabled; service accounts lose the matching scope |
0035_without_organization_limits | Drops organization_limit; service accounts lose limits:read, limits:write |
0036_single_operator | Keeps only the earliest platform administrator who is not disabled (the other accounts' alert subscriptions move to it); IP list names become unique (organization lists with a taken name get a suffix and their rules follow), former organization lists become collections; drops organization, member, invitation, organization_settings, every organization_id, session.active_organization_id and alert_channel.available_to_tenants; service accounts lose the organization scopes |
0037_dns_cluster_bindings | dns_binding, dns_lease; dns_revision.cluster_id, dns_managed_name.cluster_id; the DNS steering policy becomes one binding per cluster; drops dns_state |
0038_certificate_chains | PEM blocks other than certificates (such as a private key) are removed from stored chains |
0039_certificate_accounts | acme_account; certificate.renewal_info_at |
0040_node_lifecycle | node.previous_cert_serial; node_upgrade_delivery.deadline_at (deliveries already released keep the deadline of 30 minutes after creation) |
0041_g6_probes_scheduling | probe, probe_token, probe_result, node_address_state, scheduling_rule, scheduling_state; node.metrics, node.probe_enabled; node_ip.source and level (unique by node, source, address); dns_revision.reason_params |
0042_g7_layer4 | cluster_port_pool, l4_app, l4_origin, l4_minute_stats |
0043_stats_marker_generation | stats_rollup_dirty.generation (rollups clear only the marker generation they read) |
0044_node_offline_per_node | Drops the per-site node offline alert states (one per node now) |
0045_rollout_policy_updated_at | cluster_rollout.policy_updated_at (the canary policy's own version; existing rows take updated_at) |
0046_dns_error_params | dns_revision.last_error_params (the failure code's parameters, such as the conflicting DNS name) |
0047_alert_subscription_sites | alert_subscription_site, alert_subscription.all_sites; drops alert_subscription.site_id, the unique key becomes account and channel; a channel's subscriptions merge into one (the sites and alert kinds of the enabled ones when any is enabled, otherwise of all) |
0048_rule_log_stats | logged_rules (matches of Log rules) in the minute, hour and day statistics and the traffic_hour_stats view |
0049_dns_lease_attempts | dns_challenge_lease.attempts (failed cleanups of a TXT record, for the retry backoff) |
0050_node_remote_address | node.remote_address (source address of the node's enrollment and latest heartbeat connection) |
0051_node_last_auth_error | node.last_auth_error, last_auth_error_at (why the node channel last refused the node's own certificate, e.g. CERT_HAS_EXPIRED) |
0052_retention_indexes | Indexes: alert_event (occurred_at, ordinal); security_event (received_at), site level events above normal only; cache_task_node (node_id), failed and skipped deliveries not made up only |
0053_origin_protocol | origin_pool.protocol (HTTP version towards the origins, http1 or http2), origin_pool.grpc (gRPC proxied over HTTP/2 end to end) |
0054_edge_ports | cluster.extra_http_ports, cluster.extra_https_ports (listener ports besides 80 / 443), cluster.client_ip (the client address source, jsonb, null for direct); site.http_ports, site.https_ports (the ports a site is bound to, default 80 / 443); l4_app.port_end (port ranges), l4_app.origin_port_mode (fixed / same), l4_app.certificate_id, l4_app.tls_minimum_version (TLS termination) |
0055_site_content | site_secret; cluster.cache_max_size_gb, cluster.cache_inactive_days (cache zone); node.cache_max_size_gb (node size override), node.cache_usage (reported usage); site.hide_x_cache, site.purge_method, site.maintenance, site.maintenance_updated_at, site.charset, site.request_body_limit; origin_pool.tries, origin_pool.status_retry; cache_rule.cache_set_cookie; site_error_page.redirect_url, site_error_page.response_status |
0056_domain_forms_cname_prefix | site_domain.kind replaces wildcard, unique by (name, kind); site.cname_prefix, l4_app.cname_prefix (their id for existing rows: CNAMEs do not change); cname_retired; cluster.unknown_hosts, cluster.default_site_id |
0057_g11_certificates_sessions | site_certificate, session_ticket_key; certificate.acme_account_id |
0058_g12_access_auth | site_auth_rule; site.auth_updated_at; auth_failures in node_minute_stats, node_hour_stats, node_day_stats (the traffic_hour_stats view rebuilt) |
0059_g13_access_control | site.access_control, site.block_list_ids, site.allow_list_ids, site.access_control_updated_at |
0060_g14_waf_actions | site.rules_body_limit; site_waf.exclusions (replacing excluded_rule_ids; the site-wide exclusions migrate to one exclusion without a path); allow_verified_bots, challenge_text, failure_ban_enabled, failure_threshold, failure_ban_seconds of site_protection; access_log.rule_ids; ip_ban_auto_uq unique per (node, site, CIDR, source), including source rule |
0061_g16_access_logs_stats | asn_name; statistics dimensions in minute, hour and day statistics and the view traffic_hour_stats (country_requests, country_bytes, asns, referers, browsers, oses, devices, http_versions, tls_versions, block_reasons, challenges_issued, challenges_passed); site.log_blocked, log_query, log_headers, log_peer; access_log columns for User-Agent, Referer, protocol, region, origin, block reason and the optional fields |
0062_g17_site_tags | tag, site_tag |
0063_g18_image_convert | site.image_convert; image_bytes_saved in minute, hour and day statistics and the view traffic_hour_stats |
0064_hidden_cards | hidden_cards |
0065_cache_rule_respect_default | respect as the default of cache_rule.origin_cache_control |
0066_auth_identity_headers | site.auth_identity_headers (filled from the stored access authentication rules, disabled ones included) |
0067_node_certificate_failures | node_config_status.certificate_failures (certificates a node reports it cannot load) |
0068_node_channel_status | node.channel, probe.channel (the node channel address a node or probe uses, its fallbacks, why a switch failed, and the TLS server name and WebSocket entry the console sees) |
0069_site_usage_guard | site_usage_guard; an index of site_usage by site and window |
0070_node_logs | node_log_entry, node_log_entry_cursor |
0071_origin_protection | origin_client_certificate, origin_certificate; origin_pool.tls_trust, origin_pool.client_certificate, pki_authority.crl_pem |
0072_site_auto_mitigation | site_auto_mitigation |
0073_origin_stats | origin_stats (fetches per origin) in minute, hour and day statistics and the view traffic_hour_stats |
0074_node_clock_dns_failures | node.clock_offset_ms, node.clock_measured_at (node clock offset); dns_binding.failing_since (since when DNS reconciliation has kept failing) |
0075_alert_channel_send_times | alert_channel.send_times (per-channel send limits) |
0076_rule_versions | edge_rule_version (rule version history), with an initial version for each existing rule |
0077_node_debug_log | node_debug_log (pulls of a node's debug logs) |
0078_greylist_connection_limits | ip_ban.action, challenge, rate_limit_requests, rate_limit_window_seconds (greylist entries; unique indexes split between bans and greylist entries); cluster.connection_limits (kernel connection limits) |
0079_origin_proxy_protocol | origin.proxy_protocol_version (PROXY protocol to the origin: 0 off, 1, 2) |
0080_origin_ca_rotation | pki_authority.kind, status, generation (CA rotation; (kind, status) unique, existing rows take their id as kind); origin_certificate.authority_id, origin_client_certificate.authority_id (the issuing CA) |
0081_node_location | node.location (where the node's public address is, from its own GeoIP data: country, subdivision, City MMDB coordinates) |
0082_node_key_decommission | node.key_sha256 (SHA-256 of the certificate key's SPKI, unique; the same key enrolling again gets the same node), machine_id (digest of the host's machine-id, a hint only), decommission_requested_at, decommission_task_id, decommission_error (decommission without SSH, ADR-0067) |
0083_site_development_mode | site.development_mode_until (when development mode ends; null while off) |
0084_external_probe_sources | external_probe_source, external_probe_mapping, external_probe_observation (external probe sources, monitors mapped to nodes, each location's latest result, ADR-0069); cluster.probe_mode (a cluster's own decision mode, null follows the global one) |
0085_markdown_agents | site.markdown (Markdown for Agents); markdown_responses in minute, hour and day statistics and the view traffic_hour_stats |
0086_challenges_v3 | challenge_provider (the global and sites' third-party CAPTCHA providers, secrets envelope-encrypted); site_protection.interactive_provider; challenge_outcomes in minute, hour and day statistics and the view traffic_hour_stats |
0087_ai_crawl_control | site_ai_crawl (a site's AI crawler actions, managed robots.txt, pay per crawl, ADR-0070); access_log.crawler, crawler_verification, crawler_charged_micros; crawler_stats, crawler_paths in minute, hour and day statistics and the view traffic_hour_stats |
0088_tiered_cache | site.tiered_cache; tier_latency, tier_selection; access_log.tier; tier_stats in minute, hour and day statistics and the view traffic_hour_stats |
0089_node_extensions | extension_key, extension, extension_version, site_extension (node extensions); node.extension_status (per extension state reported by the node) |
0090_extension_secrets_data | extension.secret_envelope, extension.secret_version (console-generated extension secrets); site_extension_data (per-site data items of extensions) |
0091_oauth_mcp | The OAuth authorization server of MCP: oauth_client, oauth_resource, oauth_client_resource, oauth_consent, oauth_access_token, oauth_refresh_token, oauth_client_assertion |
Build output
| Step | Output |
|---|---|
vite build | apps/console/dist/web (SPA) |
node scripts/build-server.mjs (esbuild) | apps/console/dist/server/main.js: the server and all dependencies in one ESM file; dist/server/recover.js: the account recovery command, also with all dependencies, without a source map; install/ copied to dist/server/install, migrations to dist/migrations |
Dockerfile stage certd | golang:1.27.2-alpine cross-compiles edgeweir-certd on the build machine's platform ($BUILDPLATFORM, no QEMU) |
Dockerfile stage build | node:24.22.1-alpine with pnpm 12.6.0 builds the console once on the build machine's platform; the output (JavaScript and static assets) serves every architecture |
Dockerfile stage runtime | node:24.22.1-alpine + tini; no node_modules; runs as user node; EXPOSE 3000 8443; health check edgeweir-healthcheck |
Base images are pinned by tag and multi-arch index digest. The image version is <YYYYMMDD>-<commit> (scripts/image-version.sh), written to EDGEWEIR_VERSION and the image label org.opencontainers.image.version; the full commit ID goes to org.opencontainers.image.revision. Development commands and tests: CONTRIBUTING.en.md.
Observability
| Item | Behavior |
|---|---|
| Logs | One JSON line per event; warn and error to stderr, the rest to stdout; level set by LOG_LEVEL |
/healthz | Returns status and version |
| Container health check | ROLE=worker checks only that the process is alive; other roles request http://127.0.0.1:${PORT}/healthz |
| Node state | Online state, applied revision, data plane health, and origin health come from node_config_status and origin_health |