Skip to main content
This setup is for a quick proof of concept, and for individual practitioners who want to use coding agents on a machine they control. It is not built for a team that depends on it. For that, use the Azure, AWS or Google Cloud deployments. Everything runs on one VM:
  • 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.
  • /setup is 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 from claude 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 with sudo:
The installer sets up the following:
  • Node.js and rootless Podman
  • podman-compose 1.6.0 in /opt/podman-compose
  • the slack-presence-host service and the model proxy
  • the oc-gateway user (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 by oc-gateway
  • the gateway image, pulled from ghcr.io/diggerhq/computer-gateway and pinned in compose.yaml to the build of your checkout’s gateway source (:src-<hash>, from selfhost/gateway/source-tag.sh)
  • opencomputer-imds-deny, which denies the cloud instance metadata service (169.254.169.254, and fd00:ec2::254 and fd20:ce::254 over 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.sh checks the rule.
CI publishes the gateway image only after a change to the gateway’s source reaches 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

As oc-gateway:
Set these in .env:

3. Start the gateway

Install the systemd user unit. It runs podman-compose up in the foreground and restarts it whenever it exits. Still as oc-gateway:
The installer already pulled the gateway image, so the gateway starts in seconds. Then 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:
This reads the gateway container’s 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:
Then open 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:
  1. 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.
  2. Host (required). It shows connected once step 4 is done. Select I’ll connect the host later to finish without it.
  3. Sign-in and people (optional). The WorkOS app for the dashboard. See Dashboard.
  4. Slack app (optional). See Slack.
  5. OIDC (optional). Stored only.
  6. GitHub App (optional). Stored only.
Once the Claude credential is set and the host is connected or acknowledged, set up sign-in and Slack below if you want them, then select Finish setup at the bottom of /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 at PUBLIC_URL, which must be an HTTPS origin.
  1. In the WorkOS dashboard, under Redirects, add <PUBLIC_URL>/auth/callback. /setup shows the exact value.
  2. 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.
  3. Open PUBLIC_URL and sign in with the owner’s email.
  4. 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.
Sessions start from Computer in the dashboard once the Claude credential is set and the host is connected. Anyone in a connected Slack workspace can also use @computer, whether or not they’re invited.

Slack

Slack needs PUBLIC_URL set to an HTTPS origin.
  1. In /setup, open the manifest link. At api.slack.com/apps, choose Create New App, then From a manifest, and paste it.
  2. From the app’s Basic Information page, paste the client ID, the client secret and the signing secret into /setup, then select Save.
  3. Select Install to Slack and approve.
To start a session, mention the app in a channel or DM it.

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 at PUBLIC_URL. To keep attachments in an S3-compatible store instead (Cloudflare R2, Amazon S3, MinIO), set these in .env and restart the gateway:
All four of the first values are needed; with any missing, the gateway uses its volume. The bucket’s CORS must allow 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 on 127.0.0.1. To expose it, run a Cloudflare Tunnel on a custom domain, which needs no inbound ports:
  1. In Cloudflare Zero Trust, create a named tunnel.
  2. Add a public hostname on your domain, for example computer.example.com, with the service http://gateway:8080.
  3. In .env, set CLOUDFLARE_TUNNEL_TOKEN to the tunnel’s token and PUBLIC_URL=https://computer.example.com.
  4. Enable the cloudflared profile. Run systemctl --user edit opencomputer-gateway, add the lines below, then run systemctl --user restart opencomputer-gateway.
Any other reverse proxy that terminates TLS in front of 127.0.0.1:8080 also works.

Back up and restore

All of the gateway’s state is in the opencomputer_gateway-data volume:
  • Miniflare’s data, including attachments (unless an S3-compatible store holds them)
  • keys.json, which decrypts the stored secrets
  • host-token
Store the backup encrypted. As oc-gateway:
To restore, stop the gateway first, then recreate the volume from the backup and start the gateway again:
Session workspaces live on the host under /data, outside the volume. Back them up with disk snapshots.

Upgrade

Back up the volume first. The gateway applies new database migrations when it starts.

Troubleshooting