Executor deployment modes
Payload Bay runs configured scripts in an executor whose runtime is chosen at deployment time.
PAYLOADBAY_EXECUTOR_RUNTIME defaults to runc (Standard Docker isolation). runsc selects gVisor and kata selects Kata Containers for the executor container only; a hosted deployment requires one of the two. Compose/Coolify chooses the runtime before the container starts. Set the optional variable before first deployment, or after installing/registering runsc on the Docker host and then recreate/redeploy. Installing a runtime alone or restarting an existing container does not change its runtime. No required host setup for default deployment and no Docker socket inside the app.
Verified 2026-10-14: default bun run sandbox:check starts the runtime image as non-root under ordinary Docker. Explicit runsc on this host fails the host-side preflight with instructions to install/register it or set the variable back to runc. Direct Compose creation independently returns unknown or invalid runtime name: runsc before the executor starts. No fallback or delayed first-event container provisioning. Actual gVisor execution/resource guarantees remain unverified on this host; that is not a blocker for the approved trusted-publisher standard mode.
Instance settings expose executor readiness separately from configured mode. The notification inbox provides a dismissible standard-mode notice for instance administrators. Configured runsc is not host attestation and does not produce a verified-security badge. Additional gVisor isolation remains optional.
The executor image contains the supervisor, bounded compiler and workerd. Approved scripts can use bounded ordinary fetch, including after successful managed destination.send. Managed sends are journaled; direct calls are unjournaled and may repeat on script retry. User code controls complete/retry/fail.
Default executor protections remain non-root/read-only base filesystem, dropped capabilities, no-new-privileges, bounded resources/scratch, no host mounts or app credentials, separate executor process/container and scoped broker access. All publishers must be trusted by the instance operator; standard Docker is not advertised for hostile tenants, and a hosted instance refuses to run scripts on it. Hardened runtimes need their own deployment/compatibility tests on the real host.
References: https://docs.docker.com/reference/compose-file/services/#runtime and https://gvisor.dev/docs/user_guide/quick_start/docker/ .
What isolates a script today
User scripts do not get a container each. The executor is one long-lived service
container; inside it, every execution runs in its own short-lived workerd
process (a V8 isolate runtime). Layers, from the inside out:
| Layer | Where it is set | What it does |
|---|---|---|
| Isolate and no ambient network | apps/executor/src/workerd-config.ts, supervisor.ts | globalOutbound is deny. The only way out is a loopback bridge run by the supervisor. Direct fetch is refused outside the notification stage; notification fetches pin DNS and block private, link-local and special addresses |
| Per-execution limits | supervisor.ts | Deadline (100 ms to 60 s), memory watchdog (256 MiB default), request, response, log and result byte limits, fetch quota, concurrency of 2 for ingress and for processing |
| Non-root user | deploy/Dockerfile.executor | Runs as node |
| Container hardening | x-restricted in deploy/compose.yml | Read-only root filesystem, cap_drop: ALL, no-new-privileges, 128 MiB tmpfs, pids_limit: 128, mem_limit: 1g. Docker's default seccomp and AppArmor profiles apply; no custom profile is shipped |
| No secrets or mounts | compose.yml | No host mounts and no Docker socket. The executor holds only its own bearer token; the broker token is supplied per request |
| Service boundary | compose.yml | Separate service, not published on a host port. It shares the default Compose network with postgres and worker (no dedicated network is defined), so database access is gated by credentials, not by the network |
The container runtime (runc unless changed) is the last layer. With runc, a V8
or workerd escape reaches the host kernel through the syscall interface. gVisor
and Kata put a user-space kernel or a microVM in between; this page calls those
hardened runtimes.
Executor runtime setting
PAYLOADBAY_EXECUTOR_RUNTIME selects the Docker runtime the executor container
starts with. These are the only accepted values:
| Value | Meaning |
|---|---|
runc (default) | Ordinary Docker containment |
runsc | gVisor |
kata | Kata Containers |
The app, worker and executor all validate the value, and an unknown value stops
startup; it is never passed through to Docker. The same variable feeds the Compose
runtime: key and the executor's reported configuredMode. The name must match a
runtime registered in the Docker host's daemon.json, so register Kata under the
name kata. This reports configuration, not attestation.
PAYLOADBAY_DEPLOYMENT_MODE decides whether runc is acceptable:
| Mode | runc | runsc or kata |
|---|---|---|
self-hosted | Allowed. Warning notice, health standard | Allowed. Informational notice, health hardened |
hosted (also the value when unset) | Refused. Critical notice, health degraded | Allowed. Informational notice, health hardened |
A hosted instance without a hardened runtime fails closed. The worker refuses to
start, the web app returns executor_isolation_required (503) for compile, test,
publish and ingress script calls, the executor refuses to start when it is given
PAYLOADBAY_DEPLOYMENT_MODE=hosted, and the installation health page shows the
executor as degraded. Nothing falls back to runc.
The "Scripts use ordinary Docker containment" notification stays in the inbox for
instance administrators in every mode. It states the configured mode. It is a
warning on runc when self-hosted, critical on hosted runc, and informational
with a hardened runtime (subject "Scripts run under gVisor (runsc) containment").
A change of mode starts a fresh notice, so an old dismissal does not hide a new
state.
Installing gVisor on a Docker host
Install runsc for your distribution (https://gvisor.dev/docs/user_guide/install/),
then register it and check it:
sudo runsc install # writes the runtime into /etc/docker/daemon.json
sudo systemctl restart docker # restarts containers unless live-restore is on
docker info --format '{{json .Runtimes}}' | grep runsc
docker run --rm --runtime=runsc hello-world
docker run --rm --runtime=runsc alpine dmesg | head -3 # shows gVisor's own kernel logrunsc install adds this entry; write it by hand if you manage daemon.json
yourself:
{ "runtimes": { "runsc": { "path": "/usr/local/bin/runsc" } } }Then set PAYLOADBAY_EXECUTOR_RUNTIME=runsc and recreate the executor service
(docker compose up -d --force-recreate executor). Installing a runtime or
restarting an existing container does not change its runtime. bun run sandbox:check runs the preflight for the selected runtime on a build host.
gVisor needs a Linux host that supports its ptrace or KVM platform; some VPS
images and nested-virtualisation setups cannot run runsc, and Kata also needs
hardware virtualisation. Run the checks on the real host.
The executor runs a real script at startup and answers readiness only afterwards,
so a runtime that cannot run workerd fails the health check instead of serving.
Expect extra CPU cost on syscall-heavy work, and load test before opening a hosted
instance.
Hosted deployment on Coolify
What the shipped Compose files do:
deploy/compose.single.yml, the single-container stack the Coolify guide uses, setsPAYLOADBAY_EXECUTOR: disabled. The web server and worker share one container and no executor runs at all, in any runtime. There is no Docker socket in the app and no per-script container to harden. A hosted single-container instance therefore runs no user scripts: forwarding endpoints work and scripted endpoints returnexecutor_disabled. That is safe, and the containment advice does not apply.deploy/compose.yml, and the source-builddeploy/compose.preview.yml, run the executor as its own service whoseruntime:comes fromPAYLOADBAY_EXECUTOR_RUNTIME. This is the only supported place for hardened isolation, and a hosted instance that offers scripts must use it.
Realistic options for a Coolify-hosted instance that must run customer scripts:
- Executor on the same Coolify server. Install gVisor on that server (above),
deploy
deploy/compose.ymlas a Docker Compose resource, and setPAYLOADBAY_DEPLOYMENT_MODE=hostedandPAYLOADBAY_EXECUTOR_RUNTIME=runscon the resource. Coolify runs the stack with that host's Docker, so theruntime:key applies to the executor container only. Registering the runtime restarts Docker, which restarts everything on that server, so schedule it. Confirm on a staging resource thatdocker inspectshowsHostConfig.Runtimeasrunsc; this has not been verified against every Coolify version. - Executor on a dedicated server. If the Coolify host cannot or should not run
gVisor (shared host, no ptrace or KVM, many unrelated apps), run only the
executor on a separate Docker host that has
runsc, and point the app and worker at it withEXECUTOR_URL. The repository does not ship this today. It needs (a) a Compose file with only theexecutorservice (copy the block fromdeploy/compose.yml) on a TLS-protected port, and (b) the executor reaching the worker broker (PAYLOADBAY_BROKER_URL) across the network. Both directions use bearer tokens, but the broker is plain HTTP, so use a private network (WireGuard or the provider's private network), not the public internet. SetPAYLOADBAY_EXECUTOR_RUNTIME=runscon app, worker and executor so all three agree. This split is a proposal and has not been built or tested. - Do not offer scripts. Keep the single-container stack. This needs no new infrastructure and is the only option available on a host without gVisor.
The app, worker and executor must receive the same two variables. If the executor
starts with runc while the app was told runsc, the worker's startup probe reads
the executor's own reported mode and the instance is reported degraded.
Nothing here attests the host. Confirm HostConfig.Runtime on the running executor
container whenever the deployment changes.
Coordinated startup compatibility
The executor health response declares protocol version, SDK version and workerd compatibility date from the same constants used by compiled-stage validation and runtime configuration. The worker validates that bounded response before starting recovery, queue consumers or notification/retention producers. Missing, malformed, unsupported or not-ready responses stop worker startup with a safe configuration error; an HTTP 200 by itself is insufficient. Docker restart policy can retry startup after the deployment is corrected.
Deploy the app, worker and executor from the same release. This startup check is not per-request version negotiation or support for replacing an executor under already-running workers. Pending-job upgrades and published-release restore remain separate acceptance gates. A compatible response also does not attest the Docker host runtime or certify hostile-tenant isolation.
What the Installation page shows
The Installation page for administrators reports status in plain terms and leaves the technical detail to this document.
- Script execution: Ready, Not ready, Disabled or Needs hardened isolation. The last value means the instance is hosted and its configured runtime is the standard one (runc); hosted instances refuse to run scripts there. The isolation mode shows Standard for runc and Hardened for runsc or kata. It is the configured mode, not a host attestation; the executor reports its configuration only.
- Background delivery: Active when a delivery worker has checked in within the last 60 seconds, otherwise Not seen recently.
- Email delivery: reports whether the SMTP connection and authentication verify. A passing check does not prove mailbox delivery; only a real email flow does.
- Email delivery settings (SMTP) come from the deployment environment and cannot be edited in the dashboard. The runtime advisory is carried by the notification inbox.