Runtimes
A RunR runtime is a plugin: a declarative manifest (runtime.yaml) plus, per version, a runtime image — an existing image, one RunR builds from a Dockerfile or a Git repository, or an uploaded image. The manifest tells RunR everything it needs to run code of that language — the image per version, the starter template, how dependencies are installed, how compiled code is built, and how the process receives invocations (the run mode http, exec or persistent; the last two through RunR's universal wrapper runr-wrapper). Python, Node.js, Go, PHP, Java, .NET (C#), Ruby, TypeScript on Bun, PyTorch, TensorFlow and the WebAssembly runtimes are plugins of exactly the same kind; a runtime for C, Rust, Zig, Haskell or a language you wrote yourself goes through the same code paths, the same build pipeline and the same sandbox.
The pod isolation layer is a separate thing: the sandbox runtime (runc, gVisor or Kata Containers), i.e. the Kubernetes RuntimeClass a region maps each project type (XaaS, FaaS, CaaS) to — see Sandboxing, GPUs and RuntimeClasses.
- Sources of runtimes
- Runtime sources: RunR's catalog, OCI catalogs, Git repositories, private sources, runtime ids, sync, the Built-in runtimes setting
- Lifecycle: end of life, deprecated, sunset, orphaned runtimes, reminders
- How a function runs
- The execution contract
- The universal wrapper
- Manifest reference
- Validate a manifest locally
- Version sources and runtime image builds
- Compiled languages
- Dependencies
- Sandboxing, GPUs and RuntimeClasses
- Runtime patches: patch tags, levels, apply / pin, deadlines, notifications, end-of-life reminders, the Patches page
- Permissions
- API
- CLI
- Console
- Write your own runtime
- Examples
- Built-in catalog
- Configuration
- Testing
Sources of runtimes#
Source (source in the API) |
Where it comes from | Who sees it |
|---|---|---|
Built-in (builtin) |
RunR's signed runtime catalog ghcr.io/brf-tech/runr/runtime-catalog:stable, which BRF-Tech/runr-runtimes publishes from its runtimes/<id>/runtime.yaml next to each image's Dockerfile and language wrapper, read periodically (Runtime sources); until it has been read once, the catalog the API image ships (api/resources/runtimes/builtin.json) — see Built-in catalog |
everyone (the Built-in runtimes setting picks which); enabled / disabled and region availability are editable, the manifest follows the catalog |
Platform (platform) |
registered by a platform administrator in Build & Run → Runtimes, with runr runtimes register or with POST /api/runtimes — or synced from a platform source (an OCI catalog or a Git repository) |
everyone, in the regions it is available in |
Custom (custom) |
registered by a member of an organization when the platform allows custom runtimes — or synced from an organization source | the organization (tenant) that registered it; outside tenant context every user |
A runtime synced from a source carries source_id, source_name and source_path (its manifest in the source) and managed: true: its manifest changes in the source, not through the API (PUT /runtimes/{id} with a manifest answers 422); enabled / disabled and regions stay editable. To build an executor of your own — the contract, the manifest, the image, testing, publishing a repository or a signed catalog — see Executor development and the sample repository BRF-Tech/runr-sample-custom-executor.
Each version of a runtime names where its runtime image comes from — image, dockerfile, git or upload (versions). Bringing your own image works with every source: an image that serves the HTTP contract itself (run.mode: http), or one that uses the universal wrapper as its entrypoint.
Runtime ids are one namespace across all sources: projects.runtime stores the id (python, c, q), so an id identifies one runtime everywhere and a registration with an id that exists already is rejected (runtime ids). Every manifest is validated strictly against the JSON Schema in api/resources/runtimes/runtime.schema.json (apiVersion: runr.sh/v1) plus the rules a schema cannot express; a rejected manifest comes back with every problem and its JSON path, e.g. /run/command: is required in exec mode.
Disabling a runtime takes it out of the catalog: new projects cannot pick it and deploys of its projects are refused with a message naming the runtime; running deployments stay untouched. The same holds for a region the runtime is not offered in. A runtime with projects can be disabled, not deleted.
Runtime sources#
Runtimes come from sources RunR reads by itself, besides the ones registered one by one:
| Source | What it is | Connected by | Its runtimes |
|---|---|---|---|
| RunR runtimes (the default source) | RunR's signed OCI catalog, published by BRF-Tech/runr-runtimes | the installation (RUNR_RUNTIME_CATALOG_*, Helm runtimeCatalog.*) |
the built-in runtimes |
OCI catalog (oci-catalog) |
an OCI artifact holding a catalog of manifests, optionally cosign-signed | a platform administrator (runtimes.manage) or an organization (runtimes.use_custom, while custom runtimes are on) |
platform runtimes, or the organization's custom runtimes |
Git repository (git) |
<path>/<id>/runtime.yaml of a repository at a branch or tag |
as above | as above |
Sources are listed and connected in Build & Run → Runtimes → Sources, with runr runtimes sources …, the MCP tools runtime_sources_list, runtime_source_connect, runtime_source_sync, runtime_source_remove, the Terraform resource runr_runtime_source and /api/runtime-sources (API). A platform administrator sees every source; a member with runtimes.use_custom sees and manages the organization's own.
- RunR's catalog
- OCI catalogs
- Git sources
- Private sources
- Runtime ids
- Sync
- Patches of a source
- Built-in runtimes
RunR's catalog#
The built-in runtimes come from ghcr.io/brf-tech/runr/runtime-catalog:stable: BRF-Tech/runr-runtimes builds it from its runtimes/<id>/runtime.yaml after the images of a change are published, pushes it with oras and signs it with cosign — the same key as the patch feed (keys/patch-feed.pub there). RunR reads it like the patch feed: every 15 minutes a HEAD of the tag; the catalog itself only when its digest changed; its signature verified with RUNR_RUNTIME_CATALOG_PUBLIC_KEY before a word of it is trusted. A catalog that does not verify, or that is no valid catalog, is refused: the last good one stays and the source says why.
So a language added to runr-runtimes reaches every installation without a RunR release: the next read creates its built-in runtime, its versions are discovered from its image tags, and the Built-in runtimes setting (default: every runtime of the catalog) offers it.
The catalog the API image ships (api/resources/runtimes/builtin.json) is only the offline fallback: it is in use until RunR's catalog has been read once — an air-gapped installation, a catalog switched off on the Runtimes page, RUNR_RUNTIME_CATALOG_REF set empty (Helm runtimeCatalog.offline: true). The Runtimes page and GET /api/runtime-catalog say which one is in use (mode: source or bundle). An API without a way out reads the catalog through a region's registry (RUNR_RUNTIME_CATALOG_VIA_REGION, default the patch feed's region). A mirror of the catalog in your own registry, signed with your own key, works the same: set its reference and key.
Its source row is read-only in the console except whether it is read and how often; its reference, key and region come from the installation.
OCI catalogs#
An OCI catalog is an artifact with one layer of media type application/vnd.runr.runtime-catalog.v1+json (artifactType the same, an empty config), pushed with oras push:
{
"schema": 1,
"generated_at": "2026-11-07T12:00:00Z",
"source": {"repository": "https://github.com/acme/runtimes", "revision": "<git commit>"},
"runtimes": [
{"path": "runtimes/lua/runtime.yaml", "manifest": {"apiVersion": "runr.sh/v1", "kind": "Runtime", "id": "lua", "...": "..."}},
{"path": "runtimes/q/runtime.yaml", "manifest": {"...": "..."}, "files": {"Dockerfile": "FROM …", "main.go": "…"}}
],
"patches": []
}
runtimes[].manifestis the runtime.yaml as JSON (versions quoted as strings),@filebuild files inlined;filesonly for a runtime with adockerfile:version — its build context.patches(optional): patch entries of the catalog's own runtimes.- With a public key on the source (a cosign PEM), the catalog must be signed with it (
cosign sign --key, the classicsha256-<digest>.sig); without one it is read unsigned and carries no patches. RunR's own catalog always needs its key. - The catalog is read only when its digest changed (one HEAD per check), at most 8 MiB and 200 runtimes.
runr-sample-custom-executor builds, pushes and signs one from its repository with GitHub Actions.
Git sources#
A Git source is a repository with one directory per runtime: <path>/<id>/runtime.yaml (path default runtimes), the directory named like the runtime's id, read at a branch or tag (default: the default branch). RunR runs git ls-remote on every check and a shallow clone only when the commit changed. The clone has no submodules, no hooks and no symbolic links (checked out as plain files); @file build files and the build context of a dockerfile: runtime (every other file of its directory, at most 50 files and 900 KB) are read from the runtime's directory only — nothing outside the clone.
URLs: https://host/path, ssh://[user@]host[:port]/path or user@host:path. http:// and git:// only with RUNR_RUNTIME_SOURCES_ALLOW_INSECURE=true (an internal Git server without TLS); file:// never. A version's own git: source (a runtime image RunR builds) is cloned by the region's Kaniko build as before.
Private sources#
A source can be private; its credentials are write-only — stored encrypted at rest with the application key (runtime_sources.credentials, like a region's kubeconfig), never in an answer (the API says which are set and shows the last four characters of a token), masked in every error, log line and problem RunR writes:
| Credential | API field | Used for |
|---|---|---|
| HTTPS token of a Git source (GitHub / GitLab / Gitea token) | git_token, git_username (default x-access-token) |
ls-remote and clone, as an Authorization header in the git process's environment — never in the URL or a command line; also the region build of a version whose git: URL is on the source's host (Kaniko's GIT_USERNAME / GIT_PASSWORD from a Secret) |
| SSH deploy key of a Git source | ssh_private_key, ssh_known_hosts (without it the host key is accepted on first use) |
ls-remote and clone through GIT_SSH_COMMAND, the key in a 0600 file removed after the read |
| Registry username and password / token | registry_username, registry_password, registry_host (default: the catalog's registry; required for a Git source) |
a private OCI catalog and patch feed; version discovery of private images; every pull of the source's runtime images |
Where RunR pulls a private runtime image of a source (an image on registry_host):
| Pull | How the credentials reach it |
|---|---|
| Function pods (Knative Service, CronJob) of a code-mounted version | imagePullSecrets: a kubernetes.io/dockerconfigjson Secret runr-rtsrc-<source> RunR applies into the project namespace before the workload (label runr.sh/runtime-source) |
| Function builds (dependencies, compiled runtimes) | Kaniko's docker config (DOCKER_CONFIG=/kaniko/.docker, the same Secret); the private FROM images are pulled from their registry directly, not through the region registry's pull-through |
Runtime image builds (dockerfile: / git: versions) |
the same docker config for the Dockerfile's FROM; the source's Git token for a git: version on its host |
| WebAssembly toolchain Jobs, sandboxes and warm pools | imagePullSecrets with the same Secret |
| The node pre-pull at registry setup | crictl pull --creds from a Secret runr-image-prepull-creds (removed with the DaemonSet) |
| The registry pre-warm | left out: the pull-through has no credentials; the first build pulls the image |
The Secret's value is never part of a deployment's manifests, its logs or the audit log; new credentials reach the next deploy or build.
Runtime ids#
Runtime ids are one namespace across the platform, because projects store the id:
- RunR's catalog keeps the built-in ids. No other source and no registration takes an id of the built-in catalog in use or of the catalog the API image ships.
- The first registration wins. An id already held — by another source, by a runtime registered by hand, by another organization — is a sync problem of the source that comes later, naming the holder (another organization's source is not named: "already taken on this platform"); that runtime is skipped, the others are read.
- Orphans are adopted by the same owner. A runtime that left its source (orphaned) is taken over by another source of the same scope and organization; its projects follow.
- One id once per source. The same id twice in one source: the first (by path) is read, the second is a problem.
- A new built-in does not take an existing id. When RunR's catalog gains an id a platform or organization runtime holds already, that runtime keeps it and the built-in is not offered on this installation (a problem of RunR's source).
- An organization's manifests may not set
runtimeClass, as with registration.
Sync#
The scheduler checks every source every five minutes against its interval (RunR's catalog: 15 minutes, RUNR_RUNTIME_CATALOG_INTERVAL; a connected source: 60 by default, at least 5); Sync now (POST /api/runtime-sources/{id}/sync, runr runtimes sources sync) reads it at once, also when its revision did not change. A source is read right after it is connected or changed.
Each read:
- reads the source (above); unchanged — nothing more;
- validates every manifest strictly (the JSON Schema and the rules of Manifest reference); a bad manifest is a problem with its file and JSON path —
runtimes/lua/runtime.yaml /run/command: is required in exec mode— and does not stop the others; - applies the runtime id rules;
- creates or updates the source's runtimes: the manifest on the runtime, the versions from the manifest (or discovered from the image tags with the source's credentials), region builds of
dockerfile:/git:versions; a runtime whose manifest is bad this time keeps its last good one; - orphans the runtimes that are no longer in the source (Lifecycle);
- reads the patches of the source's runtimes.
A source's status: never, ok, partial (read, with problems), unreachable, not_found (the registry or Git host has no such catalog or repository, or refused a read without credentials: to a reader without credentials a missing package and a private one look the same, and ghcr.io answers both with 401 / 403), auth_failed (the registry or Git host refused the source's own credentials), invalid_signature, invalid_catalog, disabled. RunR's catalog is read without credentials: while ghcr.io/brf-tech/runr/runtime-catalog is not published or not public, its status is not_found and the catalog the API image ships stays in use. A failed read changes no runtime. The source also keeps revision (the catalog's manifest digest or the commit), checked_at, synced_at (the last good read), runtimes_count, signature_verified and its problems.
Test connection (POST /api/runtime-sources/test) reads and validates a source as given — before it is saved, or changes of a connected one with its stored credentials — and answers its revision, each runtime it defines and every problem, changing nothing.
Each runtime of a source is enabled or disabled one by one (PUT /api/runtimes/{id} is_enabled, the source's runtimes on the Sources tab). Removing a source deletes its runtimes that no project uses; the others stay orphaned.
Patches of a source#
A source carries patches of its own runtimes the way RunR's patch feed carries the built-ins': patch tags (<full version>-r<n>), levels, reasons, CVEs, deadlines. Two ways:
- in its signed catalog: the catalog's
patches(patch-feed v1 entries), trusted because the catalog's signature verified with the source's key; - its own patch feed: an OCI artifact like RunR's (
application/vnd.runr.patch-feed.v1+json) whose reference is set on the source (patch_feed), verified with the source's public key and read with its registry credentials (required: a patch feed needs the key).
Patches are stored for the source's own runtimes only — an entry for another runtime is a problem and is ignored — and RunR's feed patches only the built-in runtimes, so no feed ever moves another feed's runtime. From there everything is the same: workloads run the patch by digest, each project shows its patch state, critical and zero-day patches have deadlines and migrate projects automatically (the platform policy), notifications go out, and the Patches page lists them (with the source). A source's patches are also on its detail (GET /api/runtime-sources/{id}).
Built-in runtimes#
The platform setting Built-in runtimes (Build & Run → Runtimes, runtimes.manage; PUT /api/runtime-catalog) picks which runtimes of RunR's catalog the platform offers:
- All runtimes of the catalog (default): a runtime the catalog gains is offered as soon as it is read;
- Only these: a selection; a runtime the catalog gains is not offered until it is selected.
A built-in left out is not offered for new projects; its projects keep deploying. The setting replaces the EXECUTOR_RUNTIMES variable, which is now only its first default: until a platform administrator saves the setting, EXECUTOR_RUNTIMES (empty: all) decides.
Lifecycle#
Every runtime and version has the same lifecycle, whatever its source — built-in, platform, organization, registered by hand or synced from a source:
| State | Comes from | What RunR does |
|---|---|---|
End of life (eol) |
a version's eol date, else endoflife.date for a versionDiscovery.eol product |
after the date: the version leaves the picker; its projects can no longer be saved or deployed until they move to another version |
| Deprecated | deprecated of a version or of the whole runtime: a date, or true (from the first read that saw it) |
a badge on the runtime, the version, the picker and the project; a one-time notice to the owners of its projects and the organization's owners and admins; everything keeps working |
| Sunset | sunset of a version or of the runtime: a date; for an orphaned runtime, the end of its grace period |
like the end of life — after the date the version leaves the picker and its projects can no longer be saved or deployed; a runtime whose sunset passed takes no new projects |
| Orphaned | the runtime left its source | see Orphaned runtimes |
The version ends at the earlier of its end of life and its sunset (ends_at, ends_by: eol | sunset in the API). The reminders count down to that date: 13, 4 and 1 week(s) before it the owners of its projects and the organization's owners and admins hear about it — in-app, by mail a week ahead (End of life). Running deployments are never stopped: an ended version's functions keep serving; only saves and deploys are refused (422 with a message naming the upgrade).
deprecated: "2026-12-01" # the whole runtime (or true)
sunset: "2027-06-30"
replacement: python # suggested in the notices and the console
notice: "Lua 5.1 support ends with this runtime; use lua 5.4."
versions:
- version: "5.3"
image: ghcr.io/acme/lua:5.3
eol: "2027-01-31"
deprecated: true
sunset: "2027-01-31"
versionDiscovery: # discovered versions take theirs by version label
repository: ghcr.io/acme/exec-lua
image: ghcr.io/acme/exec-lua:{version}
lifecycle:
"5.3": {eol: "2027-01-31", deprecated: true}
Dates are quoted YYYY-MM-DD strings (YAML reads an unquoted date as something else). A sunset before its deprecated date is refused; replacement must name another runtime.
Pinned and unpinned projects. A project pinned to a version (runtime_version) stays on it until it ends, then saves and deploys are refused until it moves. A project without a version runs the runtime's default version: when the manifest names a newer default, its next deploy moves to it; when the whole runtime is sunset, the default version ends with it. A version removed from a manifest is retired: its projects run on the default version. Patch pins and the automatic migration at a patch deadline work as described in Runtime patches, for the runtimes of every source.
Orphaned runtimes#
A runtime that is no longer in its source (removed from the repository or catalog, or its source removed while projects use it) is orphaned, not deleted — its projects store its id and their deployments keep running:
- it leaves the catalog: no new project picks it, a new project or sandbox on it is refused;
- its projects keep saving and deploying on its last manifest for the grace period (
RUNR_RUNTIME_ORPHAN_GRACE_DAYS, 90 days), which becomes its sunset: the reminders count down to it and after it saves and deploys are refused — running deployments stay; - the owners of its projects and the organization's owners and admins are told once;
- the console marks it (Orphaned, with the sunset date) on the runtime, the project and the source;
- it comes back unchanged when it returns to its source, or is adopted by another source of the same owner (runtime ids); a platform administrator can delete it once no project uses it.
A built-in that RunR's catalog drops is orphaned the same way.
How a function runs#
- Save. Each save in the editor is a commit in the project's internal git repository and a new version. When the runtime has a
buildstep, or a FaaS project contains the runtime's dependency file, the version is built: RunR generates a Dockerfile from the manifest and runs it as a Kaniko Job in the project's region; the image lands in the region registry (runr-builds/<project>:v<N>). - Deploy. RunR renders a Knative Service (http and queue triggers) or a CronJob (schedule trigger). Without a build, the code is mounted from a ConfigMap at
/app/codeinto the runtime version's image; with a build, the image already contains it. - Invoke. In
httpmode the runtime's own process serves requests on$PORT. Inexecandpersistentmode RunR's universal wrapper (runr-wrapper, a small static Go binary in the spirit of the OpenFaaS classic watchdog) is the container's entrypoint: it receives HTTP requests, CloudEvents from the queue consumer and schedule ticks, and hands each invocation to your program over stdin/stdout. Code-mounted functions get the wrapper through an init container (runr-wrapper install) that copies it into anemptyDirmounted at/runr; built images carry it at/runr/runr-wrapper.
The pods run under the RuntimeClass the region maps the project's type to — runc, gVisor or Kata — exactly like built-in runtimes (details).
The execution contract#
Container environment#
Every function container of a code runtime gets:
| Variable | Value |
|---|---|
RUNR_MODE |
http (http and queue triggers) or schedule |
RUNR_TRIGGER |
http, schedule or queue — the trigger the workload runs as (triggers.md): http next to an HTTP trigger, queue for a project only the event gateway calls (webhooks, topics, platform events …), schedule for a schedule alone |
RUNR_HANDLER |
the handler function name (handler) |
RUNR_FILENAME |
the handler file (main.py, main.c, main.q) |
RUNR_CODE_DIR |
/app/code |
RUNR_RUNTIME, RUNR_RUNTIME_VERSION |
runtime id and the version the project runs on (the default version when the project has none) |
RUNR_TIMEOUT |
the project's timeout in seconds |
PORT |
the port to listen on (8080, set by Knative) |
plus run.env of the manifest and the project's environment variables (which win over the variables above when they use the same name). A built image also carries dependencies.env when the dependency file was installed. Runtimes that run through the wrapper additionally get RUNR_WRAPPER_MODE, RUNR_COMMAND and RUNR_INPUT / RUNR_WORKERS (wrapper reference).
Run modes#
http mode#
The process listens on $PORT and answers every path. A code-mounted function starts run.command (or the image's entrypoint when there is none); a built function's image has run.command as its ENTRYPOINT. RunR sends it:
- http trigger: the client's request as it arrived (Knative's queue-proxy sits in front).
- queue trigger: the queue consumer reads the Redis stream and POSTs every entry as a CloudEvent in binary mode:
ce-specversion: 1.0,ce-type: dev.runr.queue.message,ce-source: /redisstream/<stream>/<group>,ce-id: <entry id>,ce-time,X-RunR-Delivery-Attempt,Content-Type: application/jsonand the entry's fields as a JSON object in the body. A 2xx answer acknowledges the entry; anything else is retried with exponential backoff and, after the retry limit, moved to the dead-letter stream<stream>-dlq. - schedule trigger, two ways (
run.schedule):invoke(default): the CronJob runs the wrapper, which startsrun.commandwithPORT, waits until127.0.0.1:$PORTaccepts connections (up to 60 s), POSTs one schedule CloudEvent in binary mode (ce-type: dev.runr.schedule.tick,ce-source: /runr/schedule,Content-Type: application/json, body{"trigger":"schedule"}), prints the response body, stops the server (SIGTERM, SIGKILL after 5 s) and exits 0 for a status below 400, 1 otherwise. The server's own stdout goes to the logs.run.commandis required for this.native: the image itself runs the handler once and exits whenRUNR_MODE=schedule— what the built-in images do.
exec mode#
The wrapper starts run.command once per invocation:
stdin: the request envelope as JSON (
run.input: json, default) or the raw request body (run.input: raw, handy for shell scripts and C).environment: the container environment plus, per invocation:
Variable Value RUNR_TRIGGERhttp,queueorscheduleRUNR_REQUEST_IDthe envelope idRUNR_METHOD,RUNR_PATHrequest method and path RUNR_QUERYthe raw query string ( name=RunR&x=1)RUNR_CONTENT_TYPEthe request's Content-Type RUNR_HEADER_<NAME>every request header; the name upper-cased, every character other than A–Z and 0–9 replaced by _(X-Api-Key→RUNR_HEADER_X_API_KEY)RUNR_EVENT_ID,RUNR_EVENT_TYPE,RUNR_EVENT_SOURCEthe CloudEvent attributes (queue and schedule) stdout: the response.
stderr: streamed to the function's logs.
exit code: non-zero without a response envelope on stdout answers 500
{"error":"handler exited with status N"}; a command that cannot be started answers 500{"error":"handler failed to start"}.
The process runs in its own process group, in /app/code when that directory exists.
persistent mode#
Starting a process per request is cheap for a static binary and expensive for an interpreter. In persistent mode the wrapper starts run.workers processes (1–16, default 1) once and keeps them running; each gets RUNR_WORKER (its slot, from 0) in its environment. For every invocation the wrapper writes the request envelope as one JSON line to an idle process's stdin and reads its stdout until a line parses as JSON — that line is the response. Lines that are not JSON are written to the logs and skipped, so a stray debug print does not break the protocol. Requests queue for a free worker; each worker handles one request at a time. The per-invocation variables of exec mode are not set here: everything about the request is in the envelope.
A worker that exits is restarted — after 100 ms when it served a request or ran for at least 10 s, otherwise with a delay doubling up to 5 s — and the request it was handling answers 502 {"error":"handler process exited"}. A request that exceeds the timeout, waiting for a worker included, answers 504; a worker that ran into the timeout is killed and restarted.
Request envelope#
{
"runr": 1,
"trigger": "queue",
"id": "1728561234567-0",
"method": "POST",
"path": "/",
"query": {},
"rawQuery": "",
"headers": {"content-type": "application/json", "ce-type": "dev.runr.queue.message", "host": "orders.fn.svc.cluster.local"},
"body": "{\"item\":42}",
"isBase64Encoded": false,
"event": {
"specversion": "1.0",
"id": "1728561234567-0",
"type": "dev.runr.queue.message",
"source": "/redisstream/orders/orders-api",
"time": "2026-10-10T12:00:00Z",
"datacontenttype": "application/json",
"data": {"item": 42}
}
}
| Field | Meaning |
|---|---|
runr |
contract version, 1 |
trigger |
http, queue or schedule |
id |
the X-Request-Id header, else the ce-id header, else the CloudEvent id, else a generated UUID |
method, path |
the request line |
query |
query parameters, first value per name; rawQuery is the raw string |
headers |
request headers, lower-case names, repeated values joined with , , plus host |
body |
the body as a UTF-8 string; base64 with isBase64Encoded: true when it is not valid UTF-8 |
event |
present for CloudEvents and schedule ticks: binary mode (any request with a ce-specversion header, i.e. queue deliveries) or structured mode (Content-Type: application/cloudevents+json). data is the parsed JSON payload, else the payload string, null for an empty body; subject appears when the event has one |
A schedule invocation carries method: POST, path: /, the schedule CloudEvent headers, body: {"trigger":"schedule"} and an event of type dev.runr.schedule.tick with source /runr/schedule — the same request an http-mode server receives for a tick.
Responses#
What the program writes to stdout (exec) or as its response line (persistent) becomes the HTTP response:
A JSON object with a numeric
statusCodeis a response envelope:{"statusCode": 201, "headers": {"Content-Type": "text/html"}, "body": "<b>created</b>", "isBase64Encoded": false}A string
bodyis written as it is, withContent-Type: text/plain; charset=utf-8unlessheaderssets one; withisBase64Encoded: trueit is base64-decoded and defaults toapplication/octet-stream. Any otherbodyvalue is JSON-encoded withContent-Type: application/jsonunless set. Header values that are arrays become repeated headers, numbers and booleans are written as text. AstatusCodeoutside 100–999 answers 500. This is the samestatusCode/headers/bodyshape the built-in runtimes' handlers return.Anything else is the raw body with status 200:
Content-Type: application/jsonwhen the output is valid JSON,text/plain; charset=utf-8otherwise. In persistent mode any JSON value other than an envelope is the body (a JSON string is sent as text).
Every response carries Access-Control-Allow-Origin: * unless the handler sets it, and the wrapper answers CORS preflights (OPTIONS) with 204 and the same CORS headers the built-in runtimes send (Allow-Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS, Allow-Headers: Content-Type, Authorization, Max-Age: 86400). Knative probe requests (K-Network-Probe, K-Kubelet-Probe) are answered 200 ok by the wrapper without invoking your program.
Timeouts, limits and logs#
- Each invocation may run for
RUNR_TIMEOUTseconds (the project's timeout); the wrapper then kills the process group and answers 504{"error":"handler timed out after Ns"}. - Request bodies above 10 MiB answer 413; handler output above 10 MiB answers 502.
- stderr of your program — and in persistent mode every non-JSON stdout line — shows up in the project's logs next to the wrapper's own lines, which start with
[runr-wrapper]. - On SIGTERM (scale-down, new revision) the wrapper stops accepting requests, drains the ones in flight for up to 25 s and stops the workers (SIGTERM, SIGKILL after 5 s).
The universal wrapper#
runr-wrapper lives in wrapper/ of BRF-Tech/runr-runtimes (Go, standard library only) and ships as the image ghcr.io/brf-tech/runr/wrapper:<version> (FROM scratch, the binary at /runr-wrapper). RunR configures it through the environment; an image that wants the wrapper as its own entrypoint sets the same variables.
| Variable | Default | Meaning |
|---|---|---|
RUNR_WRAPPER_MODE |
exec, persistent or http (required) |
|
RUNR_COMMAND |
the runtime command as a JSON array (["q", "/app/code/main.q"]); any other string runs through /bin/sh -c (required) |
|
RUNR_TRIGGER |
http |
http and queue listen on $PORT; schedule invokes once and exits |
RUNR_INPUT |
json |
exec mode stdin: json or raw |
RUNR_WORKERS |
1 |
persistent mode processes, clamped to 1–16 |
RUNR_TIMEOUT |
30 |
per invocation, seconds or a Go duration (500ms) |
RUNR_MAX_BODY |
10485760 |
request body and handler output limit in bytes |
PORT |
8080 |
listen port; in http mode the port of the runtime's server |
RUNR_CODE_DIR |
/app/code |
working directory of the runtime command when it exists |
RUNR_TRACING |
1: a server span per invocation, exported over OTLP/HTTP (tracing) |
|
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT |
where the spans go (/v1/traces is appended to the second); tracing stays off without one |
|
OTEL_TRACES_SAMPLER_ARG |
1 |
sampling ratio: a sampled incoming traceparent is always followed, otherwise the trace id ratio decides (OTEL_TRACES_SAMPLER=always_on / always_off: 1 / 0) |
OTEL_SDK_DISABLED, OTEL_TRACES_EXPORTER=none |
switch the wrapper's spans off | |
RUNR_REPLAY_URL, RUNR_REPLAY_TOKEN |
failed requests (5xx, timeouts) are posted there (request replay) | |
RUNR_REPLAY_MAX_BODY |
65536 |
request / response body bytes kept per capture |
RUNR_REPLAY_PER_MINUTE |
60 |
captures per minute and pod |
RUNR_REPLAY_REDACT_HEADERS, RUNR_REPLAY_REDACT_QUERY |
comma-separated names on top of the built-in lists (never captured / value replaced by REDACTED) |
|
RUNR_UPSTREAM_PORT |
$PORT + 1 |
observed http mode: the port the runtime's own server listens on |
In http mode with the http or queue trigger the wrapper replaces itself with RUNR_COMMAND (exec), so it adds nothing on that path; with the schedule trigger it runs the invoke sequence.
When tracing or replay capture is on, http mode runs as an observed proxy instead: the wrapper starts RUNR_COMMAND with PORT=$RUNR_UPSTREAM_PORT, listens on $PORT itself and forwards every request, so each one gets the wrapper's server span (the runtime's own instrumentation continues the trace from the traceparent the proxy sends) and failed ones are captured. RunR fronts built-in http runtimes this way only for projects that switched tracing or replay on. With tracing on, every invocation logs an access line with its trace id:
[runr-wrapper] trace_id=4bf92f3577b34da6a3ce929d0e0e4736 span_id=00f067aa0ba902b7 sampled=true GET /orders 500 41.3ms cold_start=false
Subcommands: runr-wrapper or runr-wrapper serve runs as configured, runr-wrapper install <dest> copies the binary to <dest> (what the init container and the build Job do; it works in the scratch image), runr-wrapper tick waits until a server listens on 127.0.0.1:$PORT (or RUNR_TICK_URL), sends it one schedule CloudEvent, prints the response and exits 0 for a status below 400 (the schedule trigger of WebAssembly functions), runr-wrapper version prints the version.
Manifest reference#
apiVersion: runr.sh/v1
kind: Runtime
id: c
name: C
extensions: [c, h]
versions:
- version: "17"
image: ghcr.io/brf-tech/runr/reqs/alpine:3.21
default: true
build:
command: "apk add --no-cache gcc musl-dev >/dev/null && gcc -O2 -static -o /build/out/handler {file}"
runImage: ghcr.io/brf-tech/runr/reqs/alpine:3.21
source: false
run:
mode: exec
input: raw
command: ["/app/handler"]
Unknown fields are rejected everywhere in the manifest.
Top-level fields#
| Field | Required | Default | Meaning |
|---|---|---|---|
apiVersion |
yes | runr.sh/v1 |
|
kind |
yes | Runtime |
|
id |
yes | ^[a-z][a-z0-9-]{0,31}$ (single letters such as c or q are valid); stored on projects. docker, caas, custom, runtime, runtimes and validate are reserved |
|
name |
yes | display name, 1–64 characters | |
description |
up to 500 characters, shown in the runtime picker | ||
icon |
the built-in icon for built-in ids, else a generic code icon | data:image/svg+xml;base64,… (also png, jpeg, webp) or an https:// URL, up to 64 KiB |
|
language |
plaintext |
Monaco editor language id (python, c, rust, shell, …) for files with the runtime's extensions |
|
extensions |
yes | 1–10 distinct file extensions without the dot (^[a-z0-9]{1,10}$); the first is the handler file's |
|
category |
general |
general or ml |
|
versions |
yes¹ | see versions | |
versionDiscovery |
catalogs only (the built-in catalog, runtime sources), see versions | ||
handler |
see handler and template | ||
template |
{"{file}": ""} |
starter code, see handler and template | |
dependencies |
see Dependencies | ||
build |
see Compiled languages | ||
run |
yes | see run | |
triggers |
[http, schedule, queue] |
the triggers projects of this runtime may use; creating a project, changing its trigger and deploying check it | |
sandbox |
[runc, gvisor, kata] |
the sandboxes the runtime works under, see Sandboxing | |
resources |
defaults for new projects, see resources | ||
runtimeClass |
built-in and platform runtimes only, see RuntimeClasses | ||
wagi |
runtimes on the Spin shim (requires runtimeClass: wasmtime-spin-v2): argv (default ${SCRIPT_NAME} ${ARGS}), files (map the project's files into the module, default false), environment (extra static variables) — RunR generates a spin.toml with Spin's WAGI executor for the module the build produces (wasm-exec) |
||
deprecated |
the whole runtime is deprecated from this date ("YYYY-MM-DD"), or now (true) — Lifecycle |
||
sunset |
after this date ("YYYY-MM-DD") the runtime takes no new projects and its projects can no longer be saved or deployed; running deployments stay |
||
replacement |
the runtime id RunR suggests instead | ||
notice |
why and what to do (up to 500 characters), shown with the lifecycle state |
¹ unless versionDiscovery is set.
versions#
versions:
- version: "1.0" # ^[0-9A-Za-z][0-9A-Za-z._-]{0,31}$, quoted
image: ghcr.io/acme/q:1.0 # exactly one of image | dockerfile | git | upload
default: true
eol: "2027-06-30"
deprecated: "2027-01-01" # or true
sunset: "2027-06-30"
gpu: false
- version: "2.0"
dockerfile: Dockerfile # a file uploaded with the runtime
buildArgs: {Q_VERSION: "2.0"}
- version: "3.0"
git: {url: "https://github.com/acme/q.git", ref: main, path: runtime/, dockerfile: Dockerfile}
- version: "4.0"
upload: q:4.0 # an uploaded image (docs/images.md)
| Field | Meaning |
|---|---|
version |
version label shown in the picker and stored on projects (runtime_version); a string, so quote numbers ("1.0"); unique within the runtime |
image |
an existing image that runs the code |
dockerfile |
RunR builds the image in each region from this uploaded file, with all uploaded files as the build context; the file must be among the uploaded files |
git |
RunR builds the image in each region from a Git repository: url (https://), ref (a branch name, or a full ref such as refs/tags/v1.0; default the repository's default branch), path (context directory inside the repository), dockerfile (path relative to the context, default Dockerfile) |
upload |
an uploaded image of the runtime's owner: repository[:tag], repository@sha256:<digest> or the upload id. Resolved in each region to that region's upload of the name, pinned by digest — so an air-gapped region runs the runtime from an image that came through RunR. Platform runtimes name platform uploads, custom runtimes their organization's. Registering or changing the runtime requires the image in every region the runtime is offered in (active regions with a registry; a platform runtime offered in every region is checked in the platform's regions, not in an organization's own regions); a deploy or build in a region without it is refused naming the region. A WebAssembly runtime with upload versions sets build.image (its toolchain): the uploaded module reaches the build as RUNR_WASM_MODULE (wasm.md) |
buildArgs |
--build-arg values, dockerfile and git versions only |
default |
the version new projects get; at most one per runtime, the last version when none is marked |
eol |
end-of-life date (YYYY-MM-DD): the version past it leaves the picker, its projects are flagged in the UI, and saving or deploying them asks for an upgrade |
deprecated |
the version is deprecated from this date, or now (true): a badge and a one-time notice (Lifecycle) |
sunset |
like eol, set by the runtime's maintainer: after this date the version leaves the picker and its projects can no longer be saved or deployed |
gpu |
the version needs a GPU node (with resources.gpu) |
template |
{files} as the runtime's template: the starter files of a new project on this version, instead of the runtime's — for an SDK generation whose code differs from the other versions' |
build |
{files} only, as the runtime's build.files: the files the build adds on this version, instead of the runtime's (the runtime's build.command builds them); needs the runtime's build. @path references in a catalog may point into a directory of the version (@4.2/Cargo.toml) |
Up to 50 versions. Removing a version from the manifest retires it: projects pinned to it run on the default version, as with any retired version.
SDK generations side by side. A version with template and build of its own is a new SDK next to the old one, as wasm-rust 4.1 (Spin Rust SDK 5) and 4.2 (Spin Rust SDK 8) are (wasm.md): the projects of the old version keep building with its files and image, new projects pick either, and GET /runtimes/{id}/template?version= (the console's starter preview) gives the version's starter. Keep handler.pattern matching every version's starter. A project without a version runs the default one, so moving default to the new generation moves those projects to code they were not written for: pin them first (RunR 0.7.0 pins its wasm-rust and wasm-js projects without a version to 4.1 as 4.2 becomes their default). A project moves to another version of its runtime with PUT /projects/{id} {"runtime_version": "4.2"} once its code is ported.
versions:
- version: "4.1"
image: ghcr.io/brf-tech/runr/exec-wasm-rust:4.1 # the runtime's template and build.files
- version: "4.2"
default: true # new projects
image: ghcr.io/brf-tech/runr/exec-wasm-rust:4.2
template:
files:
"{file}": |
#[http_service]
async fn handle(req: Request) -> anyhow::Result<impl IntoResponse> { … }
build:
files:
Cargo.toml: "@4.2/Cargo.toml"
spin.toml: "@4.2/spin.toml"
versionDiscovery (catalogs: the built-in catalog and runtime sources) replaces a static list with the image tags: executor:sync lists the clean X.Y[.Z] tags of the image repository (ghcr.io/brf-tech/runr/exec-python) in its own registry, maps each to image (ghcr.io/brf-tech/runr/exec-python:{version}), marks the newest as default, deactivates tags that left the repository, reads end-of-life dates for the eol product from endoflife.date and, with filter: lts-even-major, keeps the newest minor of each even major (Node.js LTS lines). A X.Y-gpu tag next to a listed version is that version's GPU build: a version of its own (2.14-gpu, gpu_required), listed after it and never the default (ML runtimes). The tags come from the registry's OCI distribution API (GET /v2/<name>/tags/list, every page of its Link header), read anonymously with a pull token from the registry's token service; a repository without a registry host is on Docker Hub (registry-1.docker.io). A runtime whose registry does not answer keeps its versions, and a partial tag list deactivates none. A runtime of a private source reads the tags with the source's registry credentials. versionDiscovery.lifecycle gives discovered versions their eol (instead of endoflife.date), deprecated and sunset by version label; a GPU build follows its version.
handler and template#
handler:
file: main # entry file base name → main.<extensions[0]>
function: handler # function name for languages with function handlers
pattern: 'def\s+{handler}\s*\(' # checked on every save of the entry file
template:
files:
"{file}": |
def {handler}(event, context):
return {"statusCode": 200, "body": "Hello, World!"}
| Field | Default | Meaning |
|---|---|---|
handler.file |
main |
base name of the entry file (^[A-Za-z0-9_-]{1,64}$); XaaS projects store <file>.<extension> as their file name, FaaS handlers are written <file>.<function> (main.handler) — a FaaS handler without a dot names only the function and keeps the default file |
handler.function |
handler |
the default handler name (RUNR_HANDLER), ^[A-Za-z_][A-Za-z0-9_]{0,63}$ |
handler.pattern |
a regular expression (up to 500 characters) the entry file must match on save; {handler} stands for the escaped handler name. A mismatch rejects the save with a clear message; without a pattern any content is accepted |
|
template.files |
{"{file}": ""} |
the code a new project starts with, 1–20 files; the key {file} is the entry file. XaaS projects get the entry file, FaaS projects every template file plus the dependency template |
run#
| Field | Default | Meaning |
|---|---|---|
run.mode |
http, exec or persistent (run modes) |
|
run.command |
image entrypoint (http) | the command as an argument list (1–32 items); required for exec and persistent, and for http with schedule: invoke when schedule is among the triggers |
run.schedule |
invoke |
http mode only: invoke (the wrapper starts the server and sends one event) or native (the image handles RUNR_MODE=schedule) |
run.input |
json |
exec mode only: stdin is the request envelope (json) or the request body (raw) |
run.workers |
1 |
persistent mode only: number of long-lived processes, 1–16 |
run.env |
extra environment variables of the function container (up to 50) |
resources#
resources:
cpu: "500m" # default CPU of new projects (request == limit), "250m" or "0.5"
memory_mb: 512 # default memory of new projects, 64–65536
gpu:
count: 1 # 1–8
resource: nvidia.com/gpu
cpu and memory_mb replace the project type's default size for new projects of this runtime; an explicit size on the project wins, and the region capacity check uses the resulting size. gpu sets a limit of count units of the extended resource resource (default nvidia.com/gpu) on the function container, so the scheduler places the pods on nodes that offer it.
Placeholders#
Manifest strings may use these placeholders:
| Placeholder | Value |
|---|---|
{version} |
the runtime version the project runs on (3.14) |
{semver} |
the version when it is numeric X.Y or X.Y.Z, else empty |
{image} |
the version's image (build stage strings) |
{file} |
the entry file with extension (main.c) |
{handler} / {Handler} |
the handler function name / with an upper-case first letter (Go) |
{mode} |
http or schedule |
{trigger} |
http, schedule or queue |
Where they apply:
template.files(names and contents):{file},{handler},{Handler}— rendered once when the starter code is created.dependencies.image,dependencies.install,dependencies.env,build.image,build.command,build.runImageandrun.envof a build: every placeholder.FROMlines then go through the region's registry (pull-through cache).run.commandandrun.envat deploy: every placeholder except{image}.versionDiscovery.image:{version}.
{if:NAME}…{end} keeps its content only when the placeholder NAME is non-empty. The PHP runtime pins Composer's platform to numeric versions only:
install: "cd /build/code && {if:semver}composer config platform.php {semver} && {end}composer install --no-dev --no-interaction"
Only the names above are replaced; anything else in braces — ${HOME}, {"statusCode": 200}, format!("{}", x) — stays as written. dependencies.template is used as written.
Validate a manifest locally#
The same checks POST /api/runtimes runs (JSON Schema and rules) are available in the API container:
php artisan runtimes:validate path/to/runtime.yaml [more/runtime.yaml …] [--files=dir]
Files in --files count as the files uploaded with the runtime, so a dockerfile version is checked against them:
php artisan runtimes:validate ../examples/runtimes/q/runtime.yaml --files=../examples/runtimes/q/interpreter
# ../examples/runtimes/q/runtime.yaml: valid (q, persistent mode, 1 version(s))
Every problem is printed with its JSON path; the exit code is 1 when a manifest is invalid. The schema itself (api/resources/runtimes/runtime.schema.json) also works in editors: with the YAML language server, a # yaml-language-server: $schema=<path to runtime.schema.json> line at the top of runtime.yaml gives completion and inline errors.
Version sources and runtime image builds#
A version with image runs that image (through the region registry's mirror when the region has one). A version with dockerfile or git is built by RunR in each region it is used in: a Kaniko Job (rt-<id>-<version>-<digest>, up to 15 minutes) in the region's project namespace pushes runr-runtimes/<id>:<version>-<digest> to the region's registry. The digest covers the version source, the build args and — for dockerfile versions — the uploaded files, so a changed Dockerfile builds a new image and an unchanged one is reused: the image is cached in the region registry for every function of that runtime. Git sources are cloned by Kaniko (git://<host>/<path>#<ref>, path as the context sub-directory). Deleting the runtime deletes its images (runr-runtimes/<id>, every version and earlier source) from the registries of the regions it was built in.
Builds start when a runtime is registered, changed or re-enabled (in every active region with a registry it is available in), from Build & Run → Runtimes → Builds or POST /api/runtimes/{id}/builds (which rebuilds), and when a deploy or function build needs the image in a region that has none for the current source:
- a function build (compiled runtime, dependency build) waits for the runtime image — it checks every 10 s for up to 15 minutes — and then runs;
- a deploy of a code-mounted function answers that the runtime image is being built in the region and is deployed again once the build is ready.
Build status (pending, building, ready, failed) and the Kaniko error of a failed build are listed per region and version (GET /api/runtimes/{id}/builds).
A version with upload runs the uploaded image (<registry>/runr-uploads/<owner>/<repository>@sha256:…) like an image version: as the image of code-mounted functions and as the FROM of function builds — nothing is built for it. Build & Run → Runtimes → Version from an uploaded image adds such a version to the manifest.
Uploaded files are part of the runtime: up to 50 files with ConfigMap-key names (letters, digits, ., -, _; no folders), at most 900 KB together, since they reach the build as a Kubernetes ConfigMap. Use git for larger build contexts. A region needs a container registry for runtime image builds and function builds alike.
Compiled languages#
A build section makes every saved version a build — the same pipeline Go uses:
build:
image: "{image}" # build image (default: the version image)
command: "gcc -O2 -static -o /build/out/handler {file}"
runImage: ghcr.io/brf-tech/runr/reqs/alpine:3.21 # final image (default: the version image)
source: false # copy the code into /app/code of the final image (default true)
files: # extra files placed next to the code before the build
runr_wrapper_.go: {http: "…", schedule: "…"}
RunR generates a two-stage Dockerfile and runs it with Kaniko in the project's region (activeDeadlineSeconds: BUILD_DEADLINE_SECONDS, 900 by default):
FROM <build.image> AS build: the project's files plusbuild.filesin/build/code— a{http, schedule}pair picks the variant for the project's trigger (queue useshttp) — and oneRUNwithmkdir -p /build/out, the dependency install (when the project contains the dependency file) andbuild.command, with the placeholders resolved. The command runs in/build/code; everything it writes to/build/outis the build output.FROM <build.runImage>:/build/outcopied to/app, the code to/app/codeunlesssource: false, thedependencies.copypaths, the wrapper at/runr/runr-wrapperfor runtimes that use it (exec,persistent, orhttpwithschedule: invoke), the environment (RUNR_MODE,RUNR_HANDLER,RUNR_FILENAME,dependencies.env,run.envand the wrapper variables),EXPOSE 8080and the entrypoint:run.commandin http mode, the wrapper in exec and persistent mode.
The base images come through the region registry's pull-through cache (Zot), which fetches an image it does not hold yet from its upstream before it answers — for a large image that took 4.5 to 5 minutes on a test region. region:reconcile (run after every install and upgrade) has the registry of each region fetch the base images of the release's function builds ahead of the first build: the default version of every built-in and platform runtime that builds, through a Job runr-registry-prewarm-<hash> in the registry namespace that logs how long each image took. The Job waits while the registry restarts and tries each image three times; a Job that failed is started again by the next region:reconcile. A registry operation of a build that fails — the manifest of a FROM image, the layers Kaniko unpacks, the push — is tried up to five more times, Kaniko waiting 1, 2, 4, 8 and 16 seconds before them (--image-download-retry, --image-fs-extract-retry, --push-retry; runtime image builds too). Zot answers 503 or 404 when its fetch from upstream fails and refuses connections while it restarts; the build fails only when the last try fails as well (unable to complete operation after 5 attempts). The registry tries a failed fetch from ghcr.io again in the background (regions.md); on the pinned Zot a build's next try waits for that fetch. A build that still runs past its deadline while Kaniko waits for its base image (Kaniko's last log line Retrieving image …, or that line followed only by its retry warnings) is built once more; meanwhile its build_error says so. If the second build runs out of time too, the version fails.
The image is pushed to the region registry as runr-builds/<project>:v<N> and old build images are trimmed by the registry retention. A build that fails leaves nothing in the registry (Kaniko runs with --skip-push-permission-check, so it contacts the registry only to push the finished image). Once a day, build repositories without a tag (runr-builds/…, runr-runtimes/…) are handed to Zot's garbage collection, which removes them after its delay (one hour by default). Build errors appear on the version. Kaniko builds run under the region's build sandbox (sandbox_build_runtime). A manifest change applies to the versions built after it.
Dependencies#
dependencies:
file: requirements.txt
template: "redis>=5.0\n" # starter content of new FaaS projects
image: "{image}" # install image (default: the version image)
install: "pip install --no-cache-dir --target=/build/vendor -r /build/code/requirements.txt"
copy:
- {from: /build/vendor, to: /app/vendor}
env:
PYTHONPATH: /app/vendor
A FaaS project that contains dependencies.file is built: install runs in image with the project's files in /build/code, each copy entry (up to 10, absolute paths) is copied from the build stage into the final image (the version image), and env is set on it. Projects without the file deploy without a build. Runtimes with a build section run the install in the build image, before build.command. file must differ from the handler file; file and install are required.
Sandboxing, GPUs and RuntimeClasses#
Function pods of every runtime — built-in, platform or custom — run with the sandbox runtime (RuntimeClass) the region maps the project's type to (Administration → Regions & settings → Knative Regions → (region) → Isolation: runc, gVisor or a Kata hypervisor), and Kaniko builds with the region's build sandbox. A runtime cannot lower that isolation: the manifest's sandbox list only declares which sandboxes the runtime works under (default all three; every Kata hypervisor counts as kata). A deploy into a region whose sandbox for the project type is not in the list is refused with a message naming the runtime and the sandbox, instead of running the code under a different isolation. The wrapper's init container runs in the same pod, under the same RuntimeClass.
resources.gpu requests GPUs as a container limit, see resources.
runtimeClass names a Kubernetes RuntimeClass the function pods run with instead of the region's sandbox mapping for the project type — for example a WebAssembly shim such as wasmtime or spin installed on the nodes. Only built-in and platform-registered runtimes may set it; a custom (organization) runtime manifest with runtimeClass is rejected, so members never choose their own isolation. RunR's own WebAssembly runtimes (wasm-rust, wasm-go, wasm-js, wasm-python, wasm-exec) work this way on the Spin shim RunR installs per region (RuntimeClass wasmtime-spin-v2) — see wasm.md. A runtime whose runtimeClass is one of the WebAssembly RuntimeClasses (wasmtime-spin-v2, wasmtime-v1) is offered only in regions whose WebAssembly support is ready with that shim.
Runtime patches#
The images of the built-in runtimes get immutable patch tags: exec-php:8.3.36-r1 is PHP 8.3.36, RunR's first image of it (-r2 would rebuild the same upstream release, e.g. for a fix of the base image). The floating tag of the version (exec-php:8.3) always points to the newest patch, and the registry keeps the last five patch tags of every minor version. executor:sync does not mistake patch tags for versions (only X.Y, X.Y.Z and their -gpu builds are).
One signed feed tells every RunR installation which patches exist and why each came: its level, a reason (English and Turkish), the CVEs it fixes, a link, the upstream release, when it was published and — for critical and zero-day patches — until when projects may stay on an older one. RunR reads it every five minutes and verifies its signature before it trusts a word of it (Runtime patch feed). Each project then shows why a patch came, and its members decide: apply it now, pin one of the last five patches, or wait — until a critical or zero-day patch's deadline, when RunR moves the project on itself.
- What runs on which patch
- Levels
- Patch state of a project
- Apply, pin or wait
- Deadlines
- Patch notifications
- End of life
- The Patches page
- Runtime patch API, MCP and CLI
What runs on which patch#
Workloads run a patch by digest, never by the floating tag, as soon as the feed lists patches for their runtime version:
| Workload | Image |
|---|---|
| A version that runs on the runtime image (code mounted from a ConfigMap): Knative Service, the CronJob of a schedule trigger | <image>@sha256:… of the project's pin, else of the newest patch, resolved when the deployment is applied and recorded on it (runtime_image, runtime_digest, runtime_patch_id) |
| A version RunR builds into an image (a dependency file, a compiled runtime) | built FROM the patch's image by digest (through the region registry's ghcr.io pull-through when it has one); the version records the base it was built from |
| Sandboxes and warm pools of the Sandbox API | the newest patch by digest |
A deployment that becomes active writes its patch onto the project: that is what the project "runs". The deployments of the API show it as runtime (image, digest, patch_id). Moving a version that was built into an image to another patch builds it again from that patch first (a queued deploy, as a rebuild for the region's registry: the live deployment keeps running until the new one starts) and deploys it when the build is ready.
Without a known patch — the feed is off, the feed does not list the runtime version, a version RunR builds in the region from a Dockerfile or Git repository, an uploaded image, a custom runtime, a CaaS project — workloads run the version image as before (the floating tag).
Levels#
| Level | Console | Notifications | Deadline |
|---|---|---|---|
routine |
a badge on the project | none | none |
security |
a colored badge | in-app: the owner and the last deployer of each project behind, the organization's owners and admins | none |
critical |
a colored badge; a banner while a project of the user runs behind | the same plus the platform administrators, in-app and by mail | the feed's deadline_at, else 14 days after publication |
zero-day |
a red badge; a banner that stays until no project of the user runs behind | everyone above, whatever their notification preferences, in-app, by mail and on the organization's alert channels (Slack, Teams, Telegram, webhook, e-mail) | the feed's deadline_at, else 3 days after publication |
Details of the audiences: Patch notifications.
Patch state of a project#
runtime_patch of a project (API, project_get, runr projects get) is one of:
| State | Meaning |
|---|---|
up_to_date |
the live deployment runs the newest patch (or nothing is deployed: the next deploy uses it) |
patch_available |
newer patches exist; level is the most urgent of them |
pinned |
the project is pinned to a patch (pin; pin.available false when it is no longer one of the last five) |
overdue |
a critical or zero-day patch the project runs behind is past its deadline (it wins over pinned) |
A project runs behind a patch when its live deployment runs an older one. A deployment made before patches were known has no recorded patch: every patch published after it went live counts as newer. A project without an active deployment, or a stopped one, runs behind nothing. The state also names the patch the project runs (current), the newest one (latest), the patches it runs behind (pending) and the earliest deadline among them (deadline_at).
Apply, pin or wait#
- Apply redeploys the live version — with the overrides it was deployed with — onto the newest patch of its runtime version and removes a pin. It is refused (409) when nothing is deployed, the project is stopped, it runs the newest patch already, or a patch migration of it is still running; it goes through every deploy check (an end-of-life runtime, the region's status, the supply-chain policy, admission).
- Pin fixes a project on one of the last five patches of its runtime version and, by default, redeploys the live version onto it (
deploy: false: the next deploy uses it). When the pinned patch leaves the last five, the next deploy uses the newest patch instead, the pin is removed and the project's owner and last deployer get a notice. Unpin lets the next deploy use the newest patch again. - Wait: nothing happens until the next deploy, which uses the newest patch (or the pin) — or, for a critical or zero-day patch, until its deadline.
Apply and pin need projects.deploy on the project; the state is visible with projects.view.
Deadlines#
Every five minutes RunR looks at the critical and zero-day patches whose deadline — the feed's, or the one a platform administrator set — has passed. While the platform policy allows it (Migrate at deadlines on the Patches page; default from the Helm value runtimePatches.autoMigrate), it redeploys every project that still runs behind such a patch onto the newest patch of its runtime version, in every organization:
- A pin gives way at the deadline: it is removed, the project moves to the newest patch.
- A migration whose new revision does not become ready — the deployment fails its readiness check, the build onto the patch fails, or it is not live within 60 minutes — is rolled back: a new deployment of the same version on the digest the project ran before (a version built into an image is built again from that digest), and the project is pinned there (pinned by RunR) so later deploys stay on what worked. Owners, the last deployer and the organization's owners and admins get a critical notification (in-app and by mail; for a zero-day patch whatever their preferences). A project deployed before patches were known goes back to the newest patch older than the failed one, or stays on the revision Knative keeps serving when there is none.
- RunR tries a patch once per project: after a rollback the project stays overdue until someone unpins and deploys it (or applies the patch), or a newer patch's deadline passes.
- A migration a user started (apply, pin) that fails is not rolled back: the failed deployment shows why, and Knative keeps serving the last ready revision.
With the policy off, projects past a deadline stay overdue: the notifications and the banner remain until they are moved. A platform administrator can also move a deadline (Extend deadline) or migrate every project behind a patch at once (Force now). RunR's own migrations and rollbacks are in the audit log as runtime_patch.migrate and runtime_patch.rollback.
Patch notifications#
| Who | security |
critical |
zero-day |
|---|---|---|---|
| Owner (payer) of each project behind, and whoever deployed it last | in-app | in-app, mail | in-app, mail |
| The organization's owners and admins (in a multi-tenant installation: the tenant's) | in-app | in-app, mail | in-app, mail |
Platform administrators (users.is_admin; single-tenant: the holders of platform.manage, the Owners), with the number of projects behind |
— | in-app, mail | in-app, mail |
| The organization's enabled alert channels | — | — | one alert each, resolved when no project runs behind |
- A notice goes out once per patch: one in-app notification per user and organization, one mail per user, one alert per channel. Remind on the Patches page sends it again.
- The notification preference of runtime patches (Account → Notifications, type
runtime_patch) turns the in-app and mail notices off — zero-day patches ignore it. - Notifications have the type
runtime_patch(data.event:patch,migrated,migration_failed,pin_dropped),runtime_eolfor end-of-life reminders andruntime_patch_feedfor a refused feed (platform administrators; single-tenant: the holders ofplatform.manage);datacarries the patch, its reasons in both languages, the CVEs, the deadline, the projects and the console path. - The console keeps a banner on screen for every critical or zero-day patch a project the user can see runs behind (
GET /api/runtime-patches/banners) until none does; platform administrators (single-tenant: the holders ofplatform.manage) also see a newer RunR release the feed announces ("RunR 0.5.11 available (zero-day): …"), a feed that is off or was refused, and a console certificate cert-manager cannot issue. - Routine patches only change the badge.
End of life#
Thirteen, four and one week(s) before a runtime version ends — its end of life (eol_at, from endoflife.date or the manifest) or its sunset (sunset_at), the earlier (Lifecycle) — the owners of its projects (pinned to it, or on no version while it is the default) and the organization's owners and admins hear about it — in-app, and by mail a week ahead (daily at 09:00). Only the nearest threshold that has been reached is sent, once per user (a moved sunset is a new reminder). After the date the version leaves the picker and its projects can no longer be saved or deployed until they move to a newer version; running deployments stay.
The Patches page#
Build & Run → Patches, for platform administrators — in a single-tenant installation, which has none, for the holders of platform.manage: the Owners, and custom roles that include it (permissions.md):
- the feed: reference, whether a public key is configured, the last check and the last good read, the signature,
status(ok,invalid_signature,invalid_schema,unreachable,disabled) and the error; Check now reads it at once; - Migrate at deadlines: the platform policy of deadlines;
- every patch of the feed (and those it dropped in the last 30 days) with its level, deadline, the projects behind it per organization and the state of its migrations — Remind, Force now, Extend deadline;
- the RunR releases the feed announces, the ones newer than the running version marked.
Runtime patch API, MCP and CLI#
| Method & path | Needs | Purpose |
|---|---|---|
GET /runtime-patches |
a login | the feed's patches (?runtime=, ?version=), newest first: {data: Patch[], feed: {enabled, status, fetched_at}, keep} |
GET /runtime-patches/banners |
a login | what the console keeps on screen: {data: [{kind: runtime_patch | platform_advisory | feed_disabled | feed_invalid | console_tls, level, …}]} |
GET /projects/{project}/runtime-patches |
projects.view |
{data: {state, patches (the last five), keep, auto_migrate, migrations}} |
POST /projects/{project}/runtime-patches/apply |
projects.deploy |
redeploy onto the newest patch → 202 {data: migration, message} |
PUT /projects/{project}/runtime-patches/pin |
projects.deploy |
{patch_id, deploy?} → 200 {data: state}, 202 with migration when it redeploys |
DELETE /projects/{project}/runtime-patches/pin |
projects.deploy |
unpin → {data: state} |
GET /admin/runtime-patches |
platform administrator; single-tenant platform.manage |
the Patches page: {data: {feed, key_configured, running_version, patches (with organizations), advisories}} |
POST /admin/runtime-patches/check |
platform administrator; single-tenant platform.manage |
read the feed now → {data: feed} (502 when it was refused or is unreachable) |
PUT /admin/runtime-patches/policy |
platform administrator; single-tenant platform.manage |
{auto_migrate} |
POST /admin/runtime-patches/{patch}/remind |
platform administrator; single-tenant platform.manage |
notify everyone again → {data: {told}} |
POST /admin/runtime-patches/{patch}/force |
platform administrator; single-tenant platform.manage |
migrate every project behind it now → 202 {data: {started}} |
PUT /admin/runtime-patches/{patch}/deadline |
platform administrator; single-tenant platform.manage |
{deadline_at} (in the future) |
A patch:
{
"id": "php-8.3-8.3.36-r1", "runtime": "php", "version": "8.3", "tag": "8.3.36-r1",
"image": "ghcr.io/brf-tech/runr/exec-php", "digest": "sha256:…", "level": "zero-day",
"reason": "Remote code execution in …", "reasons": {"en": "Remote code execution in …", "tr": "…"},
"cves": ["CVE-2026-…"], "url": "https://…", "upstream": "PHP 8.3.36",
"published_at": "2026-10-21T08:00:00+00:00", "deadline_at": "2026-10-24T08:00:00+00:00",
"deadline_extended": false, "in_feed": true
}
reason is in the request's language (Accept-Language, English or Turkish). A refusal answers 409 / 422 {message, code} with the code not_applicable, no_patch, not_pinnable, not_deployed, project_stopped, already_running, migration_running or deploy_refused.
MCP (mcp.md): runtime_patches_get (state, the last five patches with why each came, migrations), runtime_patch_apply (waits for the redeploy), runtime_patch_pin (patch by id or tag, unpin, deploy); project_get has runtime_patch, runtimes_list the newest patch of each version.
CLI (cli.md):
runr projects get orders # Runtime patch: patch available (security): 8.3.35-r1 → 8.3.36-r1
runr projects patches orders # state, the last five patches: level, CVEs, reason, link; migrations
runr projects patch apply orders --wait # onto the newest patch
runr projects patch pin orders 8.3.35-r2 # pin (and redeploy; --no-deploy: the next deploy)
runr projects patch unpin orders
runr runtimes patches --runtime php --version 8.3
Permissions#
| Ability | Grants |
|---|---|
runtimes.manage |
register platform runtimes; edit, enable / disable, delete any registered runtime; enable / disable and set regions of built-in runtimes; list disabled runtimes; trigger runtime image builds and test deploys of any runtime; switch custom runtimes on or off for the platform; connect, change, read and remove platform runtime sources, see every source, switch RunR's catalog off and set the Built-in runtimes |
runtimes.use_custom |
register custom runtimes for the own organization and edit, enable / disable, delete, build and test-deploy them; create projects on custom runtimes; connect, change, read and remove the organization's own runtime sources |
Both are permissions of the role model (Roles and permissions). runtimes.manage exists in the single-tenant edition and belongs to its Owner and Admin roles, so runtimes registered there are platform runtimes; in a multi-tenant installation platform runtimes are shared by every tenant and only platform administrators manage them. runtimes.use_custom belongs to the Owner, Admin and Developer roles (and custom roles that include it) and takes effect while the platform setting Custom Runtimes (Administration → Regions & settings, custom_runtimes_enabled, off by default) is on; holders of runtimes.manage always have it. Creating a project on a built-in or platform runtime needs no permission beyond projects.create.
API#
All endpoints are under /api, authenticated with a session or an API token.
| Method & path | Ability | Purpose |
|---|---|---|
GET /runtimes |
catalog: {data: Runtime[], abilities: {manage, use_custom}, custom_enabled} — the enabled runtimes the current organization can use; ?region=<id> filters by availability, ?all=1 (manage or use_custom) adds disabled runtimes (all of them for manage, the custom ones for use_custom) |
|
GET /runtimes/{id} |
one runtime with manifest (normalized, every default filled in), manifest_source (as submitted; built-ins rendered as YAML) and files ({name: content}); disabled runtimes for manage / use_custom only |
|
GET /runtimes/{id}/template |
starter files: ?service_type=xaas|faas&handler=main.handler&version=4.2 → {files: {name: content}}; version: the starter of a version with its own template (default: the runtime's default version) |
|
POST /runtimes/validate |
manage or use_custom | {manifest, files?} → {valid: true, manifest} or 422 |
POST /runtimes |
manage or use_custom | {manifest, files?, regions?} → 201 {data}; holders of manage register platform runtimes, use_custom-only members custom runtimes of their organization |
PUT /runtimes/{id} |
manage, or use_custom for a custom runtime of the own organization | {manifest?, files?, regions?, is_enabled?} → {data}; the id cannot change; built-in runtimes accept regions and is_enabled only |
DELETE /runtimes/{id} |
as PUT | 204; 409 while projects use the runtime; 403 for built-in runtimes |
GET /runtimes/{id}/builds |
runtime image builds per region and version: {data: [{version, knative_region_id, region_name, status, image, error, updated_at}]} |
|
POST /runtimes/{id}/builds |
as PUT | {knative_region_id, version?} → 202 with the build list; (re)builds the runtime image of every dockerfile / git version, or of version, in the region; 422 when the runtime has none |
POST /runtimes/{id}/test-deploy |
as PUT | {knative_region_id, version?} → 201 {data: Project}: an XaaS project rt-<id>-<random> with the HTTP trigger and the starter template, built when needed and deployed as soon as its version is ready |
GET /settings, PATCH /settings |
manage for custom_runtimes_enabled |
custom_runtimes_enabled (bool) |
GET /runtime-sources |
manage or use_custom | {data: Source[], catalog: {mode: source|bundle, runtimes}, abilities: {manage, organization}, custom_enabled} — every source for manage, the organization's for use_custom |
POST /runtime-sources |
manage (platform) or use_custom (organization) | {name, kind: git|oci-catalog, url, ref?, path?, public_key?, patch_feed?, registry_host?, interval_minutes?, is_enabled?, git_token?, git_username?, ssh_private_key?, ssh_known_hosts?, registry_username?, registry_password?} → 201 {data: Source}, read once |
POST /runtime-sources/test |
manage or use_custom | the same fields (and source: a connected source's id) → {data: {ok, status, error, revision, signature_verified, runtimes: [{id, path, valid}], problems}}, nothing saved |
GET /runtime-sources/{id} |
as the source's scope | {data: {source, runtimes: Runtime[], patches: Patch[], patch_feed}} |
PUT /runtime-sources/{id} |
as above | the same fields (credentials: omitted keeps, null / "" removes); RunR's catalog: is_enabled, interval_minutes only → {data: Source}, read once |
DELETE /runtime-sources/{id} |
as above | 204: its runtimes without projects deleted, the others orphaned; 422 for RunR's catalog |
POST /runtime-sources/{id}/sync |
as above | read now → {data: Source}; 502 when it could not be read or did not verify, 409 while a read runs |
GET /runtime-catalog, PUT /runtime-catalog |
manage | {data: {mode, source, bundle: [ids], builtin_runtimes: null|[ids], saved, runtimes: [{id, name, offered, in_bundle}]}}; PUT {builtin_runtimes: null | [ids]} (Built-in runtimes) |
Request limits: manifest (YAML or JSON text) up to 256 KiB; files as described in Version sources; regions a list of region ids or null for every region.
An invalid manifest answers 422:
{
"message": "The runtime manifest is not valid.",
"errors": {"manifest": ["/run/command: is required in exec mode"]},
"problems": [{"path": "/run/command", "message": "is required in exec mode"}]
}
A runtime in the catalog:
{
"id": "q", "name": "Q", "description": "…", "icon": "data:image/svg+xml;base64,…",
"language": "plaintext", "extensions": ["q"], "category": "general",
"source": "custom", "run_mode": "persistent", "compiled": false,
"triggers": ["http", "schedule", "queue"], "sandbox": ["runc", "gvisor", "kata"],
"runtime_class": null, "wasm": null, "gpu": null,
"handler": {"file": "main", "function": "handler", "filename": "main.q", "pattern": null},
"dependency_file": null,
"versions": [{"version": "1.0", "is_default": true, "eol_at": null, "gpu_required": false, "image": null, "upload": null, "built": true}],
"regions": null, "is_enabled": true, "tenant_id": null, "created_by": "1",
"source_id": null, "source_name": null, "source_path": null, "managed": false,
"lifecycle": {"state": "active", "deprecated_at": null, "sunset_at": null, "orphaned_at": null, "replacement": null, "notice": null},
"projects_count": 3, "updated_at": "2026-10-10T12:00:00Z"
}
A version also has deprecated_at, sunset_at, ends_at (the earlier of its end of life and its sunset) and lifecycle (active, deprecated, eol, sunset); a project has runtime_lifecycle (state, version, the dates, ends_by, orphaned_at, replacement, notice). A source:
{
"id": "01JC…", "name": "acme-runtimes", "kind": "git", "scope": "platform", "tenant_id": null,
"is_default": false, "url": "https://github.com/acme/runtimes.git", "ref": "main", "path": "runtimes",
"public_key": null, "patch_feed": null, "registry_host": "ghcr.io",
"credentials": {"git": "token", "git_username": null, "git_token_hint": "••••••1a2b", "ssh_key_set": false,
"known_hosts_set": false, "registry_username": "acme-bot", "registry_password_set": true},
"is_enabled": true, "interval_minutes": 60, "status": "partial", "error": null,
"problems": [{"file": "runtimes/lua/runtime.yaml", "runtime": "lua", "path": "/run/command", "message": "is required in exec mode"}],
"revision": "4f1c…", "signature_verified": false, "runtimes_count": 3,
"checked_at": "…", "synced_at": "…", "next_check_at": "…"
}
wasm names the WebAssembly shim a runtime needs in a region ("spin"), null for every other runtime; a version's upload is its uploaded-image reference and built is true for dockerfile and git versions, which RunR builds per region.
Projects reference runtimes as before: POST /api/projects with "runtime": "q" and an optional "runtime_version": "1.0". The request is refused when the runtime is unknown, disabled, not offered in the project's region, does not support the trigger, or is a custom runtime and the user lacks runtimes.use_custom.
CLI#
runr runtimes works with the catalog (CLI reference):
runr runtimes ls [--all] [--region eu-1] # versions, kind (built-in, plugin, wasm), run mode, image
runr runtimes get q [--manifest]
runr runtimes validate -f runtime.yaml [--files interpreter/]
runr runtimes register -f runtime.yaml [--files interpreter/] [--region eu-1] [--wait]
runr runtimes update q -f runtime.yaml --files interpreter/ # or --enable / --disable / --region / --all-regions
runr runtimes template q --type faas --out ./qfn
runr runtimes builds q
runr runtimes build q --region eu-1 [--version 1.0] [--wait]
runr runtimes test-deploy q --region eu-1
runr runtimes rm q --yes
# runtime sources (cli.md#runtime-sources)
runr runtimes sources ls
runr runtimes sources add --name acme --kind git --url https://github.com/acme/runtimes.git --ref main --path runtimes \
--git-token-env GITHUB_TOKEN --registry-host ghcr.io --registry-username acme-bot --registry-password-env GHCR_TOKEN
runr runtimes sources add --name acme-catalog --kind oci-catalog --url ghcr.io/acme/runr/catalog:stable --public-key-file cosign.pub
runr runtimes sources test --kind git --url https://github.com/acme/runtimes.git
runr runtimes sources sync acme
runr runtimes sources get acme # its runtimes with their lifecycle, problems, patches
runr runtimes sources rm acme --yes
runr runtimes catalog # RunR's catalog in use (or the bundle) and the offered built-ins
runr runtimes catalog set --only python,go
runr dev runs a project of a runtime plugin locally in Docker the way its manifest tells the cluster to: the version's image (dockerfile and git versions built locally with docker build), the universal wrapper as entrypoint for exec and persistent runtimes, built functions from the same generated Dockerfile, and runr dev invoke for queue and schedule events (runtime plugins in runr dev). WebAssembly runtimes run on a region's shim only: runr dev names the shim and points to runr deploy.
Console#
- New project: the runtime picker comes from the catalog — icon, name, versions — filtered by the chosen region; runtimes that do not support the chosen trigger are shown greyed out. A collapsible preview shows the starter template. The editor opens with the manifest's starter template, checks the entry file against
handler.pattern, and highlights files with the runtime's extensions in the manifest's Monacolanguage. - Build & Run → Runtimes (holders of
runtimes.manageorruntimes.use_custom): every runtime with its icon, source, run mode, versions, regions, project count and an enabled toggle; Add runtime with a manifest editor that validates as you type and lists each problem with its path, file uploads for Dockerfile builds, and region availability; Edit, View manifest, Builds per region (with rebuild), Delete, and Test deploy, which creates a project from the starter template in a region, deploys it and opens it. - Build & Run → Runtimes → Sources (holders of
runtimes.manage; the organization's own forruntimes.use_custom): every source with its kind, scope, status, last read, revision and runtimes; Add source with the credentials of a private one and Test connection; Sync now; a source's problems with their file and JSON path, its runtimes with an enabled toggle each and their lifecycle, its patches. RunR's catalog shows whether it or the bundled catalog is in use. The Built-in runtimes card (runtimes.manage) picks the offered built-ins. - Lifecycle badges — Deprecated, Sunset, Orphaned, End of life with their dates, the replacement and the notice — on runtimes and versions, in the runtime picker (ended versions are left out) and on projects.
- Administration → Regions & settings → Custom Runtimes (holders of
runtimes.manage) switchesruntimes.use_customon for members.
Write your own runtime#
The goal: run Bash scripts as functions. No image to build — the official bash image has everything — and no wrapper code to write.
1. Write the handler (main.sh). In exec mode with raw input, RunR runs it once per invocation: the body on stdin, metadata in RUNR_* variables, stdout becomes the response.
#!/usr/bin/env bash
set -euo pipefail
case "${RUNR_TRIGGER:-http}" in
schedule) echo "tick from bash" ;;
queue) printf 'processed %s (from bash)' "$(cat)" ;;
*) printf 'Hello from bash! You called %s %s' "$RUNR_METHOD" "$RUNR_PATH" ;;
esac
2. Write the manifest (runtime.yaml):
apiVersion: runr.sh/v1
kind: Runtime
id: bash
name: Bash
language: shell
extensions: [sh, bash]
versions:
- version: "5.2"
image: docker.io/library/bash:5.2
default: true
template:
files:
"{file}": |
#!/usr/bin/env bash
printf 'Hello from bash!'
run:
mode: exec
input: raw
command: ["bash", "/app/code/{file}"]
3. Validate and register it (Build & Run → Runtimes → Add runtime, runr runtimes validate -f runtime.yaml and runr runtimes register -f runtime.yaml, or):
jq -n --rawfile manifest runtime.yaml '{manifest: $manifest}' > body.json
curl -sS -X POST "$API/runtimes/validate" -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' -H 'Accept: application/json' -d @body.json
curl -sS -X POST "$API/runtimes" -H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' -H 'Accept: application/json' -d @body.json
4. Use it. Create a project, pick Bash, paste main.sh into the editor, save and deploy. curl https://<project>.<region>.<domain>/hello answers Hello from bash! You called GET /hello. Switch the trigger to schedule and the CronJob logs tick from bash on every run; switch it to queue, XADD an entry to the stream, and the entry comes back as processed {"msg":"hi"} (from bash) — the same script serves all three triggers because the wrapper speaks the same contract for each.
From here, examples/runtimes/ shows the other shapes: a compiled language (C), a binary that is its own HTTP server (Rust), and a language with its own interpreter image (Q).
Examples#
| Example | Shape |
|---|---|
examples/runtimes/c |
compiled with gcc in a build step (/build/out/handler → /app/handler), exec mode with raw input |
examples/runtimes/rust |
compiled with rustc, http mode — the binary serves $PORT itself; schedule ticks reach it through the wrapper (schedule: invoke) |
examples/runtimes/bash |
interpreted, exec mode, the official bash image |
examples/runtimes/q |
Q, a toy language with an interpreter written in Go; the runtime image is built per region from the uploaded Dockerfile, persistent mode |
examples/wasm/q-exec |
Q on WebAssembly: the same interpreter compiled with TinyGo, an upload: version on the Spin shim with a wagi section |
The Q handler that answers all three triggers is five lines:
# main.q: hello world in Q, for every trigger
set name = query.name or "World"
if trigger == "schedule" then return "tick from Q"
if trigger == "queue" then return "processed {data.msg} (from Q)"
print "Hello, {name}! (from Q)"
The MCP server runtimes mcp-python and mcp-node (examples/mcp) are http-mode runtimes whose starter template is a Model Context Protocol server; the console registers them for hosted MCP servers (AI agents).
examples/runtimes/README.md shows how to register each one; examples/runtimes/q/README.md is the Q language reference.
Built-in catalog#
The built-in runtimes are manifests in runtimes/<id>/runtime.yaml of BRF-Tech/runr-runtimes, next to each image's Dockerfile and language wrapper. That repository builds, smoke-tests and publishes the images with GitHub Actions, under the names and tags below: ci.sh build the python, nodejs, go, php, java, dotnet, ruby and bun images (skipping versions past their end of life), ci.sh ml-runtimes the PyTorch and TensorFlow images (ML runtimes) and ci.sh wasm the build images of the WebAssembly runtimes. Built-in manifests may use versionDiscovery and @path references in build.files (a file next to the manifest, inlined when the catalog is bundled).
RunR reads them from the signed catalog runr-runtimes publishes (RunR's catalog). The API also ships them as api/resources/runtimes/builtin.json, the offline fallback in use until that catalog has been read once. With RUNR_RUNTIME_CATALOG naming their directory (runtimes/ of a runr-runtimes checkout, development) the fallback is read from there instead of the bundle. Before a release, regenerate the bundle in this repository:
cd api
export RUNR_RUNTIME_CATALOG=../../runr-runtimes/runtimes # a checkout next to this one
php artisan runtimes:bundle # writes api/resources/runtimes/builtin.json
php artisan runtimes:bundle --check # exit 1 when the bundle differs from the manifests
| Runtime | Mode | Notes |
|---|---|---|
python, nodejs, php |
http, schedule: native |
the image's own server (server.py, server.js, server.php) loads RUNR_FILENAME from /app/code and calls RUNR_HANDLER(event, context); requirements.txt, package.json, composer.json trigger a dependency build in FaaS projects (Composer in the composer image, pinned to the runtime's PHP version) |
pytorch, tensorflow |
http, schedule: native |
Python 3.12 images with the ML stack preinstalled (category: ml), the same handler server as python; a CPU and a -gpu version each (ML runtimes) |
go |
http, schedule: native, build |
the project's .go files are compiled together with RunR's Go wrapper for the trigger (wrapper_http.go / wrapper_schedule.go of the runtime, as build.files) into a static binary, /app/handler on ghcr.io/brf-tech/runr/reqs/alpine:3.20 |
java |
http, schedule: native, build |
Eclipse Temurin, the LTS lines (21.0, 25.0: a version is the JDK's major, .0). Every save is built in the version image, the JDK: the project's .java files compiled with javac (runr-build; annotation processors such as Lombok run), the jars of a FaaS project's pom.xml (its compile and runtime dependencies) copied in by Maven's dependency plugin (runr-deps), the files of src/main/resources next to the classes. The function's image is the version image plus /app/classes and /app/lib; the image's handler server calls public static Object handler(Map<String, Object> event, Map<String, Object> context) of the class named like the entry file (Main.java, in any package), static or on an instance |
dotnet |
http, schedule: native, build |
C# on .NET (10.0; a version that is out, not a preview). Every save is built with the version's SDK (runr-build): the project's .cs files, its Function.csproj (the NuGet packages it names; RunR sets the target framework to the runtime version, whatever the project names) and RunR's handler server (Kestrel) into a self-contained application, /app/handler on Microsoft's chiseled runtime-deps image (ghcr.io/brf-tech/runr/reqs/dotnet-runtime-deps:<version>-chiseled-extra: no shell, ICU and time zones included). The server calls public static object Handler(JsonNode? input, IDictionary<string, object?> context): the first parameter may also be a JsonElement, the raw body as a string, or any type the JSON body is deserialized into; the result may be a Task, and is serialized with System.Text.Json (camelCase) |
ruby |
http, schedule: native |
CRuby (3.3, 3.4, 4.0) with RunR's handler server (server.rb): def handler(event, context), def handler(event), or def handler(event:, context:) as on AWS Lambda; event has string keys, the result's keys may be symbols. A FaaS project's Gemfile (and Gemfile.lock) is installed with Bundler into /app/gems, standalone: the server puts the gems on the load path without Bundler resolving the Gemfile at every start. The image has no compiler: a gem with a C extension needs a precompiled platform gem |
bun |
http, schedule: native |
TypeScript and JavaScript on Bun (the newest minor of each major, 1.4: Bun supports only its latest release): export async function handler(event, context) (also export const handler, export { handler }, a default export, CommonJS); Bun strips the types, it does not check them. A FaaS project's package.json (and bun.lock or package-lock.json) is installed with bun install --production into /app/code/node_modules |
wasm-rust, wasm-go, wasm-js, wasm-python |
http, schedule: native, build, runtimeClass: wasmtime-spin-v2 |
WebAssembly: built into a Spin OCI artifact and run on the Spin shim; offered in regions with WebAssembly support — wasm.md |
wasm-exec |
http, schedule: native, build, runtimeClass: wasmtime-spin-v2, wagi |
any WASI preview 1 command module — C / C++ (wasi-sdk), Zig, Go (TinyGo), a build.sh, an uploaded .wasm — on Spin's WAGI executor (CGI on stdin / stdout) — wasm.md |
The images of java, ruby and bun run as the user runr (10001), the .NET functions as app (1654), not as root, and so do their function builds: the build working directory /build belongs to that user. Builds write only below /build (/build/out, a copy of the code), so /build/code may be read-only.
Built-in versions come from executor:sync (at API start and on its schedule): it creates the built-in rows, discovers versions through versionDiscovery and syncs the versions of platform and custom runtimes from their manifests. php artisan runtimes:sync [--builds] does the latter two on demand, with --builds also starting region builds of dockerfile / git versions.
ML runtimes#
The PyTorch and TensorFlow runtimes are Python 3.12 with the framework and the ML essentials preinstalled — NumPy, SciPy, pandas, Matplotlib, scikit-learn, Pillow, and Keras with TensorFlow — and run handlers exactly like python (def handler(event, context), its server.py and runner.py). A FaaS project's requirements.txt is installed on top in a dependency build that runs in the version's own image.
| Version | Image | Framework | Unpacked |
|---|---|---|---|
pytorch 2.14 (default) |
ghcr.io/brf-tech/runr/exec-pytorch:2.14 |
torch 2.14.1 and torchvision 0.29.1, CPU wheels | 1.5 GB |
pytorch 2.14-gpu |
ghcr.io/brf-tech/runr/exec-pytorch:2.14-gpu |
the same torch and torchvision built for CUDA 12.6 (PyTorch's cu126 wheels), the torch hf-serve runs |
7.0 GB |
tensorflow 2.21 (default) |
ghcr.io/brf-tech/runr/exec-tensorflow:2.21 |
TensorFlow 2.21.0, Google's CPU build (tensorflow-cpu), Keras 3.15 |
2.0 GB |
tensorflow 2.21-gpu |
ghcr.io/brf-tech/runr/exec-tensorflow:2.21-gpu |
TensorFlow 2.21.0 with the CUDA 12 libraries of its and-cuda extra, Keras 3.15 |
6.9 GB |
The -gpu versions carry the CUDA libraries as NVIDIA's pip packages and need a GPU node whose driver supports CUDA 12. A project on a -gpu version is a GPU project (GPU runtime versions). In the TensorFlow -gpu image the library directories of these packages (site-packages/nvidia/*/lib) are in the dynamic loader's cache, so TensorFlow opens every CUDA library it needs whatever the entrypoint and the function's LD_LIBRARY_PATH. The images are built for linux/amd64. Being this large (the unpacked size of each image's filesystem above), they are left out of the node pre-pull (below) and pulled by the nodes their functions run on.
BRF-Tech/runr-runtimes builds them with ci.sh ml-runtimes from runtimes/pytorch and runtimes/tensorflow (Dockerfile, Dockerfile.gpu; the handler server comes from runtimes/python). A version is the major.minor of the framework pin (torch==2.14.1 in requirements-torch.txt, tensorflow-cpu==2.21.0 in requirements-cpu.txt); executor:sync picks up the published tags through versionDiscovery. Each build pulls its base image, installs the pinned packages, and fails unless pip check passes, the frameworks import and the version (and, for -gpu, the CUDA build) matches. Every build then runs a smoke test: a handler doing tensor ops (a mean and a matrix product) answers an HTTP request with JSON through the image's server, and once more as a scheduled run. On a host where docker run --gpus all gives containers a GPU, a -gpu image gets the GPU for both runs: in each, the framework has to see at least one GPU (torch.cuda.is_available(), tf.config.list_physical_devices('GPU')) and run the ops on it (cuda:0, GPU:0). On a host without one, the -gpu image is checked for its CUDA build and the output says that the GPU check was skipped. ML_SMOKE_GPU=1 makes the GPU check required (the smoke test fails without a GPU), ML_SMOKE_GPU=0 leaves it out. --push builds and smoke-tests the images the same way and pushes them only once all of them passed, each one the image its smoke test ran (docker push of that image ID); --no-smoke is for local builds only. Its publish workflow pushes the CPU images when their sources change; the heavy-images workflow (by hand and weekly) builds and pushes the -gpu images on GitHub's runners, which have no GPU: there the smoke test checks the CUDA build.
# in a checkout of BRF-Tech/runr-runtimes
./ci.sh ml-runtimes --list # the image references
./ci.sh ml-runtimes pytorch cpu # one image, built and smoke-tested locally
ML_SMOKE_GPU=1 ./ci.sh ml-runtimes gpu # the -gpu images, smoke-tested on this host's GPU
./ci.sh ml-runtimes --push # build, smoke-test and push all four (linux/amd64)
Upgrading. A migration adds the runtimes and runtime_builds tables with a built-in row each for python, nodejs, go, php, tensorflow and pytorch; executor:sync adds the rows of the other built-ins (the WebAssembly runtimes, java, dotnet, ruby and bun) and their versions. Existing projects keep their runtime / runtime_version values and run on the same images: the built-in manifests describe exactly what these runtimes did before they became plugins. Custom runtimes stay off until a holder of runtimes.manage switches Custom Runtimes on.
Configuration#
| Variable | Default | Meaning |
|---|---|---|
EXECUTOR_RUNTIMES |
— (every runtime of the catalog) | the first default of the platform setting Built-in runtimes: comma-separated ids; once a platform administrator saves the setting it is no longer read. Projects of a built-in left out keep deploying (the Wasm runtimes appear only in regions with WebAssembly support) |
RUNR_RUNTIME_CATALOG |
— (the bundle) | directory of the offline catalog's sources: runtimes/ of a BRF-Tech/runr-runtimes checkout (development) |
RUNR_WRAPPER_IMAGE |
ghcr.io/brf-tech/runr/wrapper:1.1.0 |
the universal wrapper image for init containers and build Jobs |
BUILD_DEADLINE_SECONDS |
900 |
deadline of a function build Job (Kaniko and WebAssembly toolchain builds; at least 60); the build checks give up a minute later, and a version still building two minutes after the deadline is marked failed |
These are environment variables of the API (api/config/executor.php); the Helm chart has no dedicated values for them, so a Helm installation sets them via extraEnv.
Runtime sources (api/config/runtime_sources.php; the Helm values runtimeCatalog.* set the catalog's):
| Variable | Default | Meaning |
|---|---|---|
RUNR_RUNTIME_CATALOG_REF |
ghcr.io/brf-tech/runr/runtime-catalog:stable |
OCI reference of RunR's catalog; empty: the bundled catalog only (air-gapped) |
RUNR_RUNTIME_CATALOG_PUBLIC_KEY |
the key of BRF-Tech/runr-runtimes (keys/patch-feed.pub) |
cosign public key (PEM) the catalog must be signed with |
RUNR_RUNTIME_CATALOG_VIA_REGION |
RUNR_PATCH_FEED_VIA_REGION |
read the catalog through this region's registry (id or name) |
RUNR_RUNTIME_CATALOG_INTERVAL |
15 |
minutes between two checks of RunR's catalog |
RUNR_RUNTIME_SOURCE_TIMEOUT |
20 |
seconds of one registry request of a source (catalogs, patch feeds, version discovery) |
RUNR_RUNTIME_SOURCE_GIT_TIMEOUT |
120 |
seconds of a git ls-remote or clone of a Git source |
RUNR_RUNTIME_ORPHAN_GRACE_DAYS |
90 |
days an orphaned runtime stays deployable: its sunset |
RUNR_RUNTIME_SOURCES_ALLOW_INSECURE |
false |
allow http:// and git:// Git sources (an internal Git server without TLS) |
Sources are read by php artisan runtime-sources:sync (every five minutes in the scheduler, each source at its interval; --force reads every enabled source, --source=<id or name> one) and at the API's start before executor:sync. An organization connects at most 10 sources; a catalog is at most 8 MiB and 200 runtimes.
Runtime patches (api/config/runtime_patches.php; the Helm values runtimePatches.* set the first four):
| Variable | Default | Meaning |
|---|---|---|
RUNR_PATCH_FEED |
ghcr.io/brf-tech/runr/runtime-patches:feed |
OCI reference of the patch feed |
RUNR_PATCH_FEED_PUBLIC_KEY |
the key of BRF-Tech/runr-runtimes (keys/patch-feed.pub) |
cosign public key (PEM) the feed must be signed with; another key for a feed of your own; empty switches the feed off and platform administrators see a warning |
RUNR_PATCH_FEED_VIA_REGION |
— | read the feed through this region's registry (id or name) instead of from its registry: an API without a way out |
RUNR_PATCH_AUTO_MIGRATE |
true |
migrate the projects behind a critical / zero-day patch at its deadline — the default of the platform policy, which the Patches page overrides |
RUNR_PATCH_FEED_TIMEOUT |
15 |
seconds of one request to the feed's registry |
The feed is checked every five minutes (php artisan runtime-patches:sync, --force reads it even when its digest did not change), deadlines and migrations as well, end-of-life reminders daily at 09:00 (scheduler). The number of pinnable patches (5), the default deadlines (14 days for critical, 3 for zero-day patches) and the reminder weeks (13, 4, 1; mail at 1) are in the config file.
RunR's image pre-pull on region nodes covers the wrapper image and, for every active version of the built-in and platform runtimes that has a plain image, the image its functions run on — a private image of a source with the source's credentials. That is the version image for a runtime without a build section (Python, Node.js, PHP, Ruby, Bun: its functions and their dependency builds run on it), and the build's runImage for one with a build (the last stage of the generated Dockerfile): .NET's chiseled dotnet-runtime-deps:<version>-chiseled-extra instead of the 1.3 GB SDK image, Go's Alpine instead of its toolchain, Java's own version image (runImage: "{image}"). The SDK or toolchain a build compiles with is not pre-pulled: Kaniko fetches it through the region registry, never from a node, and region:reconcile's registry pre-warm holds it there for the default versions. A Go or .NET sandbox runs on that toolchain or SDK, so a node pulls it on its first such sandbox (docs/sandbox-api.md). The WebAssembly runtimes (their image is the build toolchain) and the ML runtimes (category: ml) are left out; those, custom runtime images and region builds are pulled on first use.
Testing#
- API:
cd api && php artisan test tests/Unit/Runtimes tests/Feature/Runtimes— manifest validation, the built-in catalog and the migration of existing projects, the catalog / registration API and its abilities, build and deploy manifests per run mode, region runtime image builds andexecutor:sync;tests/Feature/Runtimes/RuntimeUploadSourceTest.phpcovers theuploadsource (validation, the image in every region, owner scoping, resolution by digest). Runtime sources:RuntimeCatalogSourceTest(RunR's catalog, the fallback, a new language without a release, the Built-in runtimes setting),RuntimeGitSourceTest(Git sources over local repositories),RuntimeSourceRulesTest(id clashes, credentials encrypted / write-only / masked, the API and its permissions),RuntimePullSecretsTest(every pull of a private image),RuntimeLifecycleTest(end of life, deprecated, sunset, reminders, refusal, per source kind) andRuntimeSourcePatchesTest(patches of a source). - UI:
cd vue && npx vitest run src/components/project/__tests__ src/components/settings/__tests__ src/utils/__tests__ src/components/__tests__(runtime picker, Build & Run → Runtimes, helpers, editor language) andnpx playwright test e2e/runtimes.spec.ts. - Wrapper and runtime images (in BRF-Tech/runr-runtimes):
cd wrapper && go vet ./... && go test -count=1 ./...(Linux; the race detector needsCGO_ENABLED=1);for t in test/*_test.sh; do bash "$t"; donechecksci.shwithout Docker (the build, smoke-test and push flow of every image, the ML runtimes' smoke tests with and without a GPU);./ci.sh build pythonbuilds and smoke-tests one runtime locally. - Q interpreter:
cd examples/runtimes/q/interpreter && go test ./.... - End to end:
bash runtime/ci.sh test-runtimescreates a Kind cluster, installs Knative, Redis and the region registry through the API (docker compose), pulls the published wrapper image (the tag pinned inruntime/lib/runtime-images.sh;RUNTIME_IMAGES_LOCAL=1takes a local build of it) and loads it into the cluster, copiesexamples/runtimesinto the API container and runs only the runtime plugin suite (php artisan test:e2e --suite=runtimes --examples=/tmp/runr-examples): the built-in Python echo function unchanged, the C example (compiled, exec mode), the Q example (persistent mode, runtime image built in the region), a schedule-triggered Bash function (the CronJob's log carriestick from bash) and a queue-triggered Q function (XADD msg=hi, the handler logsprocessed hi (from Q)). HTTP functions are called with?name=RunRand their bodies checked; once they scaled to zero they are called again and the time of that call is printed as the cold start.bash runtime/ci.sh testruns the same suite after its other phases. The flags ofci.sh testapply (--k8s=X.Y.Z,--no-cleanup,--name=…,--kubeconfig=…for an existing cluster, whereRUNR_WRAPPER_IMAGEmust be pullable). - Runtime sources end to end:
bash runtime/ci.sh test-runtime-sources(test:e2e--suite=runtime-sources): RunR's published catalog, a signed OCI catalog (a function on its runtime, then the runtime orphaned and still serving), the layout of runr-sample-custom-executor (a copy inexamples/runtime-sources/) served by git daemon in the cluster as a Git source, a private image (RUNR_E2E_PRIVATE_IMAGE,RUNR_E2E_PRIVATE_REGISTRY_USER,RUNR_E2E_PRIVATE_REGISTRY_PASSWORD; skipped without them) and a sunset refusing deploys and saves while the function keeps answering. - Shared hosts:
KIND_LOCK=/tmp/runr-kind.lock bash runtime/ci.sh test-runtimestakes the lock directory (mkdir, owner in<lock>/owner:KIND_LOCK_OWNER, the PID and the time) before creating the cluster, waits for it up toKIND_LOCK_WAITseconds (default 3600) while another run holds it, and releases it during cleanup once the cluster is gone. With--no-cleanup(or a cluster that could not be deleted) the lock stays with the cluster; the run prints thekind delete clusterandrm -rf <lock>that free both.