- The gateway runs the hosted service’s code in a container, under Miniflare. Miniflare is a local emulator of Cloudflare’s Durable Objects, D1, R2 and KV. The gateway also serves the web dashboard, with WorkOS sign-in and without billing.
- The host agent runs on the same VM. Each session runs in its own rootless Podman container.
/setupis a browser page where you add the Claude credential, connect the host, and set up sign-in and Slack.
Requirements
- Ubuntu 24.04 on x86-64. The host installer refuses arm64, and it refuses other distributions. Ubuntu 22.04 works only with Podman 4.7 or newer and
passt. - Free space under
/data: the installer warns below 20 GiB. The session image takes about 10 GiB, and every session’s workspace needs more. - A Claude credential: an Anthropic API key (
sk-ant-api…), or a subscription token fromclaude setup-token(sk-ant-oat…). - For the dashboard and Slack: a public HTTPS URL for the gateway. See HTTPS.
- For the dashboard: a WorkOS account.
1. Install the host
As a user withsudo:
- Node.js and rootless Podman
podman-compose1.6.0 in/opt/podman-compose- the
slack-presence-hostservice and the model proxy - the
oc-gatewayuser (home/var/lib/oc-gateway, lingering enabled), which runs the gateway - the gateway’s files in
/var/lib/oc-gateway/selfhost, copied from your checkout and owned byoc-gateway - the gateway image, pulled from
ghcr.io/diggerhq/computer-gatewayand pinned incompose.yamlto the build of your checkout’s gateway source (:src-<hash>, fromselfhost/gateway/source-tag.sh) opencomputer-imds-deny, which denies the cloud instance metadata service (169.254.169.254, andfd00:ec2::254andfd20:ce::254over IPv6) to every user but root, on any cloud. DNS (port 53) and NTP (UDP 123) to that address stay open, because Google Cloud serves both there. A non-root program of your own that reads the metadata service stops working; run it as root.sudo selfhost/check-imds.shchecks the rule.
main. If your checkout’s image isn’t published, for example on a branch with its own gateway changes, the installer stops and says so. Add --build-gateway to build it on the VM instead, which takes 20 to 30 minutes.
The host agent doesn’t start yet, because /etc/opencomputer/selfhost.env has no token. Step 4 adds it.
2. Configure the gateway
Asoc-gateway:
.env:
3. Start the gateway
Install the systemd user unit. It runspodman-compose up in the foreground and restarts it whenever it exits. Still as oc-gateway:
curl -s 127.0.0.1:8080/healthz returns {"ok":true,"mode":"miniflare"}.
Stop the gateway with systemctl --user stop opencomputer-gateway. If you use podman stop, systemd starts it again. To try the gateway in the foreground without the unit, run podman-compose up from ~/selfhost.
4. Connect the host
As the sudo user, from the host checkout:GATEWAY_ORG, GATEWAY_PORT and /data/host-token. It writes SP_GATEWAY_URL, SP_HOST_ID and SP_HOST_TOKEN to /etc/opencomputer/selfhost.env (root, mode 0600), then starts slack-presence-host. The token is never printed. The host dials ws://127.0.0.1:<GATEWAY_PORT>/v1/computer/host?organizationId=<GATEWAY_ORG>.
The Host step of /setup shows an equivalent command, with the token masked until you select Reveal the command with the token. That command replaces all of selfhost.env, and it puts the token on your command line. Prefer --link-gateway.
5. Set up in the browser
/setup answers only on the VM itself, never through PUBLIC_URL or a tunnel. Open it through an SSH tunnel:
http://localhost:8080/setup. To allow it through PUBLIC_URL as well, set SP_SETUP_REMOTE=1 in .env and restart the gateway. We don’t recommend it: anyone who can reach the URL gets the sign-in page.
Sign in with SETUP_TOKEN. The sign-in lasts 12 hours, and changing SETUP_TOKEN ends it. Scripts can send Authorization: Bearer <SETUP_TOKEN> instead.
The page has these sections:
- Claude credential (required). Paste the key or token. It is stored encrypted and is never shown again. Sessions never see it: only the host’s model proxy uses it.
- Host (required). It shows connected once step 4 is done. Select I’ll connect the host later to finish without it.
- Sign-in and people (optional). The WorkOS app for the dashboard. See Dashboard.
- Slack app (optional). See Slack.
- OIDC (optional). Stored only.
- GitHub App (optional). Stored only.
/setup. Saving the required steps alone never closes setup. After you finish, every /setup URL returns 404. To change something later, set SP_SETUP_OPEN=1 in .env and restart the gateway. When you’re done, clear it and restart again.
Dashboard
The dashboard is atPUBLIC_URL, which must be an HTTPS origin.
- In the WorkOS dashboard, under Redirects, add
<PUBLIC_URL>/auth/callback./setupshows the exact value. - In the Sign-in and people section of
/setup, paste the WorkOS client ID and API key, add the owner’s email, then select Save. - Open
PUBLIC_URLand sign in with the owner’s email. - To add people, go to Settings, then Members, and select Invite. WorkOS emails the invitation, and the person signs in with that address. Nobody else can sign in.
Slack
Slack needsPUBLIC_URL set to an HTTPS origin.
- In
/setup, open the manifest link. At api.slack.com/apps, choose Create New App, then From a manifest, and paste it. - From the app’s Basic Information page, paste the client ID, the client secret and the signing secret into
/setup, then select Save. - Select Install to Slack and approve.
Attachments
Files that people attach to a message are stored in the gateway’s volume, and the gateway serves them itself. Nothing needs to be set up. A browser uploads to and reads from a short-lived signed URL on the address it opened the dashboard at. Sessions read attachments atPUBLIC_URL.
To keep attachments in an S3-compatible store instead (Cloudflare R2, Amazon S3, MinIO), set these in .env and restart the gateway:
PUT, GET and HEAD from any origin, with the content-type and range headers. Files already stored in the volume are not copied to the bucket.
HTTPS
The gateway listens only on127.0.0.1. To expose it, run a Cloudflare Tunnel on a custom domain, which needs no inbound ports:
- In Cloudflare Zero Trust, create a named tunnel.
- Add a public hostname on your domain, for example
computer.example.com, with the servicehttp://gateway:8080. - In
.env, setCLOUDFLARE_TUNNEL_TOKENto the tunnel’s token andPUBLIC_URL=https://computer.example.com. - Enable the
cloudflaredprofile. Runsystemctl --user edit opencomputer-gateway, add the lines below, then runsystemctl --user restart opencomputer-gateway.
127.0.0.1:8080 also works.
Back up and restore
All of the gateway’s state is in theopencomputer_gateway-data volume:
- Miniflare’s data, including attachments (unless an S3-compatible store holds them)
keys.json, which decrypts the stored secretshost-token
oc-gateway:
/data, outside the volume. Back them up with disk snapshots.