Skip to main content
On Google Cloud the gateway runs with COMPUTER_VMS set to self-managed: it creates no VMs. You create one Compute Engine instance per organization, and the instance connects out to the gateway with that organization’s host token. The examples use app.example.com and gateway.example.com, as in On Azure.

1. Get the code

2. Create the Cloudflare resources and the apps

Follow two steps of the Azure guide unchanged:

3. Deploy the gateway Worker

Follow Deploy the gateway Worker unchanged. Keep the value of COMPUTER_HOST_TOKEN_KEY at hand: step 6 derives each organization’s host token from it.

4. Deploy the app Worker

Follow Deploy the app Worker unchanged.

5. Build and upload the Computer release

From the repository root:
The bundle holds the Computer source and the model proxy built for Linux amd64. The bucket stays private. Create a service account for the VMs that can only read the bucket:

6. Get the organization ID and make the host token

  1. Open https://app.example.com and sign in.
  2. Open Settings and copy the Organization ID.
  3. Derive the organization’s host token from COMPUTER_HOST_TOKEN_KEY:
The token is valid for that organization only, and for as long as the key does not change.

7. Create the VM

The VM is Ubuntu 24.04 on amd64 with a second, blank disk for /data. It needs outbound internet access and no inbound access: a new VPC network has no firewall rule that allows inbound traffic. Write the VM’s first-boot script with self-managed-user-data.sh. The script it prints stores the gateway URL and the token in a root-only file on the VM, downloads the release with the VM’s service account and runs its boot script:
Create the network and the instance. cloud-init runs the script in the user-data metadata key once, on the first boot:
The first boot installs the toolchains, formats the blank disk, mounts it at /data and starts the host. It takes about five minutes. The boot script formats a disk only when it is blank. The token stays in the instance’s metadata. On the VM only root can read it; in Google Cloud, anyone allowed to read the instance (compute.instances.get) can.

8. Add the Slack app and connect GitHub

  1. Open https://app.example.com. The Computer shows Online once the VM has connected.
  2. Click Add to Slack and approve.
  3. Connect GitHub and choose the repositories.
  4. Mention @computer in a channel.
Repeat steps 6 and 7 for each further organization, with another instance and disk name.

Stop, start and resize

Stop the instance with gcloud compute instances stop; the Computer shows Offline and Slack messages wait. Start it with gcloud compute instances start; the host reconnects and the workspace is still on /data. To resize, stop the instance, change its type with gcloud compute instances set-machine-type, and start it. Deleting the instance does not delete the data disk.

Check a VM

The boot log is /var/log/calvin-boot.log, and the two services are slack-presence-host and oc-modelproxy. No firewall rule allows SSH. To get a shell, allow SSH from Identity-Aware Proxy only, then connect through it:

Update a VM

A self-managed VM does not update itself. Build and upload a new bundle (step 5), download it to /opt/bootstrap/calvin.bundle on the VM, and run as root: