---
title: Deploy, proxy, and tune self-host
description: "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:** Docker on Linux AMD64 or ARM64 (or Docker Desktop running Linux containers on macOS/Windows) for Railway, Tailscale, LAN, or source Compose; Git and Docker Compose for building from source; or a `2.0.0-beta.79` checkout with Bun, Node.js, and telemetry build prerequisites (Rust/Cargo) for running without Docker. On Tailscale, you need a connected Tailscale node with HTTPS enabled on the tailnet and host administrator rights for `tailscale serve`. Behind a reverse proxy, you need permission to configure routing and TLS.

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

## Deploy on Railway

Create a Railway service from this image:

```bash
ghcr.io/usefulsoftwareco/executor-selfhost:2.0.0-beta.79
```

Complete **Set up Executor** before anyone else can access the instance — the first successful setup request creates the organization and assigns the `owner` role without a pre-existing secret. Keep the setup route reachable only by you during initialization (for example, add a temporary access restriction at your proxy or complete setup through a private route before exposing a public origin).

1. Attach a persistent volume mounted at `/app/data`.
2. Generate a domain in the service's networking settings and route it to the service's `PORT`. To use `8080` explicitly, set `PORT=8080` and select `8080` as the target port.
3. Set the Railway healthcheck path to `/health` and keep the startup timeout at `300` seconds (especially on slow storage).
4. Deploy (or redeploy if already started) so the server reads `RAILWAY_PUBLIC_DOMAIN`, restrict access while initializing if needed, and complete **Set up Executor** before opening the origin to untrusted users.

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 your domain displays **Set up Executor**.

## Private access with Tailscale

On a connected Tailscale node with HTTPS enabled on your tailnet (and configured clients on the same tailnet), Tailscale Serve gives Executor a private HTTPS address 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):

```bash
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:2.0.0-beta.79
tailscale serve --bg --https=4443 http://127.0.0.1:4400
```

Run `tailscale serve status` to verify the address. Open the configured origin, including any non-default port, so cookies, browser auth redirects, and origin checks use the right address. 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`:

```bash
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) |
| Public OAuth client metadata (`EXECUTOR_OAUTH_CLIENT_METADATA_URL`) | No (external OAuth servers fetch the metadata document from the public internet) |
| Public app webhooks | No (external senders must reach your origin; senders on the same tailnet can reach Serve) |
| 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 public webhooks or public OAuth client metadata, claim the instance through `tailscale serve` and complete **Set up Executor** **before** enabling Tailscale Funnel (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 **Set up Executor** or the login screen.

## Plain HTTP on a LAN

On a trusted private LAN 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 static dashboard and password sign-in work over plain HTTP without TLS encryption (traffic is unencrypted on the LAN). Keep `<BETTER_AUTH_URL>/api/oauth/callback` reachable from your browser for OAuth provider sign-ins. App web pages still require an HTTPS origin (`EXECUTOR_APP_UI_BASE_URL`) with wildcard DNS and TLS.

## Reverse proxies and `EXECUTOR_TRUSTED_PROXIES`

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

Rate-limited auth routes (such as sign-in, setup, and invitation registration; some routes such as `/get-session` and `/organization/list` are exempt) enforce per-client-IP limits in the Docker host. 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; forwarded headers from unlisted peers are ignored. 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:

```bash
EXECUTOR_APP_UI_BASE_URL=https://apps.example.net
```

With `EXECUTOR_APP_UI_BASE_URL=https://apps.example.net`, Executor serves each app page at `<app-slug>.<organization-slug>.apps.example.net` (two labels before the configured base). For the default `executor` organization, configure wildcard DNS and a matching TLS certificate for `*.executor.apps.example.net` (a wildcard certificate for `*.apps.example.net` alone does not cover two subdomain levels). Preserve the requested `Host` header when forwarding to the container's configured `PORT` (default `4400`). Each slug can be at most 63 characters, and the whole hostname can be at most 253 characters. On `localhost` or `127.0.0.1`, a localhost app base 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. Same-origin calls to `BETTER_AUTH_URL` use internal service binding rather than normal outbound fetch, and downloads from `EXECUTOR_NPM_REGISTRY`'s own origin are allowed even when private fetch is disabled. Every app in the instance shares this setting. |
| `EXECUTOR_APP_WORKERS` | `64` | Target number of resident app and data Workers kept in memory. Executor evicts least-recently-used idle Workers when over this target; active Workers are never evicted, so concurrent active Workers can exceed it. 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 target (`0` keeps idle Workers loaded until the target is exceeded). |
| `EXECUTOR_MCP_CLIENTS` | `512` | Maximum kept MCP client handlers in memory. Idle client handlers expire after 30 minutes (on a one-minute sweep). When full, the least-recently-used eligible idle client handler is evicted — discarded protocol sessions receive `404` and must re-initialize. Active calls and paused approvals are not evicted (`503` with `Retry-After: 1` when no eligible idle handler can be evicted). |
| `EXECUTOR_MCP_CLIENTS_PER_USER` | `256` | Maximum kept MCP client handlers one member can hold before their own least-recently-used eligible idle handler 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 (independent of other outbound calls). |
| `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 (capped by `EXECUTOR_TOOL_LISTING_MAX_AGE_SECONDS`). |
| `EXECUTOR_EVALUATION_MEMORY_MB` | `256` | Memory budget for kept tool lists and app declarations. |

## Running without Docker

For source development, install the checkout's Bun, Node.js, and telemetry build prerequisites (the build compiles the bundled Rust collector and viewer). In a `2.0.0-beta.79` repository checkout, run without Docker or a separate Postgres server:

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

`hosted:dev` builds the app framework and telemetry, starts the internal Bun API on a dynamically allocated `127.0.0.1` port, and serves the HTTPS dashboard and `/health` through Portless — open the HTTPS URL printed on the `Executor self-host:` line (normally `https://self-host.executor.localhost:5394`). Development data persists under `.local/hosted` (`hosted.pglite`, override with `EXECUTOR_DATA_DIR`). The published Docker image runs on `workerd`, whereas `hosted:dev` runs natively on Bun.

You'll know it worked when `/health` on the printed `Executor self-host:` URL returns `{"status":"ok"}`.

## Build from source

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

```bash
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
```

The `--build-arg EXECUTOR_BUILD_VERSION=...` argument sets the build version embedded in the image. The quick-start Compose setup needs no other environment variables and uses a project-scoped named volume (`pglite-data`), separate from the standalone `docker run` command's `executor-v2-data`. To pass additional runtime settings not listed in `apps/hosted/self-host/compose.yaml` (such as `EXECUTOR_NPM_REGISTRY`, stall-watchdog settings, or tool-listing and declaration limits), add them to the service's `environment:` section in `compose.yaml`.

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` well above the default increases memory use and can slow tool execution under heavy concurrency.
- Enabling `EXECUTOR_APPS_ALLOW_PRIVATE_FETCH=true` grants private-network reachability to every app in the instance, not individual apps.
- With `EXECUTOR_APP_UI_BASE_URL`, each app hostname uses two labels before the base (`<app-slug>.<organization-slug>.<base>`): each label can be at most 63 characters and the whole hostname at most 253 characters.

## Related

- [Self-host with Docker](/docs/run/self-host)
- [Sign-in and OIDC SSO](/docs/run/self-host/sign-in-and-sso)
- [Operator OAuth clients](/docs/run/self-host/oauth-clients)
- [Storage, backups, and updates](/docs/run/self-host/storage-and-updates)
- [Tracing](/docs/run/tracing)
