Skip to content
Documentation
On this page

Deploy, proxy, and tune self-host

Deploy self-hosted Executor on Railway, Tailscale, a LAN, without Docker, or from source, and configure reverse proxies, app UIs, and runtime limits.

Deploy self-hosted Executor behind your own domain or private network using Railway, Tailscale, plain HTTP on a LAN, a reverse proxy, a native Bun checkout, or Docker Compose from source (Self-host only).

Set BETTER_AUTH_URL to the exact origin users open (scheme, host, and non-default port) whenever you access Executor outside http://localhost:4400 or Railway’s generated public domain.

Prerequisites: A host with Docker (for Railway, Tailscale, LAN, or source Compose) or Bun with a repository checkout (for running without Docker). On Tailscale or a reverse proxy, you need permission to configure networking/TLS on the host.

You’ll know it worked when opening <BETTER_AUTH_URL> loads Set up Executor (or the login screen) without an invalid-origin error and <BETTER_AUTH_URL>/health returns HTTP 200 with {"status":"ok"}.

Deploy on Railway

Create a Railway service from this image:

ghcr.io/usefulsoftwareco/executor-selfhost:2.0.0-beta.79
  1. Attach a persistent volume mounted at /app/data.
  2. Generate a public domain in the service’s networking settings and route it to port 8080 (which Railway provides via PORT; if you override PORT, match that port).
  3. Set the Railway healthcheck path to /health with a startup timeout of 120 seconds.
  4. Deploy (or redeploy if already started) so the server reads RAILWAY_PUBLIC_DOMAIN, then open the domain to create the first administrator.

No database service, RAILWAY_RUN_UID=0, custom start command, or secret environment variables are needed — the container prepares the root-owned volume and runs as the unprivileged executor user. Keep one replica per volume. For a custom domain, set BETTER_AUTH_URL to that exact HTTPS origin.

You’ll know it worked when Railway marks the /health check green and opening the Railway domain displays Set up Executor.

Private access with Tailscale

Tailscale Serve gives Executor a private HTTPS address on your tailnet with no public DNS, port forwarding, or certificate management. Keep Docker bound to 127.0.0.1:4400 and point Serve at it (this example uses port 4443 when 443 is already taken):

TAILNET_HOST="my-host.tail1234.ts.net" # replace with your Tailscale machine and tailnet
docker run -d --name executor-v2 --init --restart unless-stopped \
  -p 127.0.0.1:4400:4400 -v executor-v2-data:/app/data \
  -e "BETTER_AUTH_URL=https://${TAILNET_HOST}:4443" \
  ghcr.io/usefulsoftwareco/executor-selfhost:beta
tailscale serve --bg --https=4443 http://127.0.0.1:4400

Run tailscale serve status to verify the address. BETTER_AUTH_URL must match it exactly, including any non-443 port, or browser sign-in is rejected as an invalid origin. Changing Serve requires host administrator rights (on Synology, run over SSH with sudo). Every device opening the dashboard or connecting an MCP client must be on the tailnet, using https://<machine>.<tailnet>.ts.net:4443/mcp:

codex mcp add executor --url "https://${TAILNET_HOST}:4443/mcp"
codex mcp login executor
Feature Tailnet only (Serve)
Dashboard, MCP endpoint, and client sign-in Yes
Connecting a provider account by OAuth Yes (your browser on the tailnet handles the /api/oauth/callback redirect)
EXECUTOR_OAUTH_CLIENT_METADATA_URL No (remote services fetch the metadata document from the public internet)
App webhooks No (external services must reach your origin)
App web pages No (requires a wildcard domain and certificate; Tailscale certificates cover only the machine’s name)

If you need public internet reachability for webhooks or OAuth client metadata, use Tailscale Funnel instead (Funnel supports only ports 443, 8443, and 10000).

You’ll know it worked when tailscale serve status lists your HTTPS URL and opening it from a tailnet device loads the Executor setup or login screen.

Plain HTTP on a LAN

On a home or office network without TLS, bind the port on your LAN interface and set BETTER_AUTH_URL to the exact plain HTTP origin you open, for example http://192.168.1.20:4400. The dashboard does not require a browser secure context. Keep <BETTER_AUTH_URL>/api/oauth/callback reachable from your browser for OAuth provider sign-ins. App web pages still require an HTTPS wildcard origin (EXECUTOR_APP_UI_BASE_URL).

Reverse proxies and EXECUTOR_TRUSTED_PROXIES

Origins are never inferred from request headers — always set BETTER_AUTH_URL to your public origin.

Auth routes are rate-limited per client IP. Behind a reverse proxy, every request arrives from the proxy’s address unless you set EXECUTOR_TRUSTED_PROXIES to a comma-separated list of your proxy IPs or CIDRs (read by both the Docker image and Compose builds). When a request arrives from a listed proxy, Executor reads X-Forwarded-For from the right past every listed address. Each proxy must append the connecting peer address (as Caddy, Traefik, and nginx $proxy_add_x_forwarded_for do).

  • Host proxy: Connects from the Docker network’s Gateway address (inspect with docker inspect, often 172.17.0.1 for docker run). Note that all processes on the host share that gateway address.
  • Proxy container: Assign a fixed container IP and list only that IP.
  • Cloudflare Tunnel: List the exact address cloudflared connects from.

Never list a shared Docker subnet, 0.0.0.0/0, or ::/0 — any client connecting from a trusted address can spoof X-Forwarded-For.

Serving app web pages

Apps that ship a web UI need EXECUTOR_APP_UI_BASE_URL set to an HTTPS origin with no trailing slash, backed by wildcard DNS and a wildcard TLS certificate routed to container port 4400:

EXECUTOR_APP_UI_BASE_URL=https://apps.example.net

Executor serves each app UI at <app-slug>--<organization-slug>.<base>. The entire first DNS label must fit within 63 characters, so keep app and organization slugs short. On localhost, the UI origin is derived automatically.

Private network fetch, Worker, and MCP client limits

Variable Default Purpose
EXECUTOR_APPS_ALLOW_PRIVATE_FETCH false Set to true to let app isolate fetch and off-registry build downloads reach private network addresses. Requests to BETTER_AUTH_URL bypass the network either way, and downloads from EXECUTOR_NPM_REGISTRY’s own origin always work. Every app shares this setting.
EXECUTOR_APP_WORKERS 64 Maximum loaded app and data Workers kept in memory at once. Idle Workers are evicted least-recently-used; active calls are never evicted. Apps with a database can keep two Workers loaded (app + data).
EXECUTOR_APP_WORKER_IDLE_SECONDS 300 Unload an idle Worker after this many seconds even below the limit (0 keeps idle Workers loaded until the limit is hit).
EXECUTOR_MCP_CLIENTS 512 Maximum MCP client sessions kept in memory (~200 KB each; 512 uses ~120 MB). Evicted clients get 404 and must re-initialize; unused clients expire after 30 minutes. In-flight calls and paused approvals are never evicted (503 with Retry-After: 1 when full).
EXECUTOR_MCP_CLIENTS_PER_USER 256 Maximum MCP client sessions one member can hold before their own oldest session is evicted.
EXECUTOR_ENVIRONMENT self-host Environment label for this instance.
EXECUTOR_CATALOG_URL https://catalog.executor.sh/index.json Official app catalog feed; set to off for air-gapped instances to list only the built-in Executor app.
EXECUTOR_REGISTRY_URL https://api.executor.sh Public app registry origin.
EXECUTOR_NPM_REGISTRY https://registry.npmjs.org npm registry used for app package installs and daily update checks.
EXECUTOR_TOOL_LISTING_FRESH_SECONDS 30 Reuse an app’s evaluated tool list for this long before background refresh.
EXECUTOR_TOOL_LISTING_RENEW_SECONDS 86400 Renew cached tool lists in the background once this old.
EXECUTOR_TOOL_LISTING_MAX_AGE_SECONDS 604800 Maximum age of a cached tool list (0 re-evaluates every time).
EXECUTOR_TOOL_LISTING_LOAD_SECONDS 45 Stop background tool-list evaluation after this many seconds when no request is waiting.
EXECUTOR_EVALUATION_MEMORY_MB 256 Memory budget for kept tool lists and app declarations.

Running without Docker

From a checkout of the repository, you can run the native Bun development server without Docker, Postgres, DATABASE_URL, or a migration command:

bun install --frozen-lockfile
bun run hosted:dev

Data persists under .local/hosted (override with EXECUTOR_DATA_DIR). HOST defaults to 0.0.0.0 and PORT defaults to 4400. The published Docker image runs on workerd, whereas hosted:dev runs natively on Bun.

You’ll know it worked when the server listens on http://localhost:4400 and /health returns {"status":"ok"}.

Build from source

The public repository includes a Compose setup that builds this release locally:

git clone --depth 1 --branch 'executor@2.0.0-beta.79' https://github.com/UsefulSoftwareCo/executor.git executor-v2
cd executor-v2
docker compose -f apps/hosted/self-host/compose.yaml build --build-arg EXECUTOR_BUILD_VERSION=2.0.0-beta.79
docker compose -f apps/hosted/self-host/compose.yaml up -d

Docker Compose works without environment variables and uses a separate named volume (pglite-data) from the standalone docker run command’s executor-v2-data.

You’ll know it worked when docker compose -f apps/hosted/self-host/compose.yaml ps shows the container healthy and http://localhost:4400 opens the setup page.

Limits

  • Raising EXECUTOR_MCP_CLIENTS much above the default slows tool execution (around 800 kept clients made tool calls several times slower on a 16-core machine).
  • Enabling EXECUTOR_APPS_ALLOW_PRIVATE_FETCH=true grants private-network reachability to every app in the instance, not individual apps.
  • EXECUTOR_APP_UI_BASE_URL subdomain labels cannot exceed 63 characters (<app-slug>--<organization-slug>).

Was this page helpful?