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 ofCOMPUTER_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:6. Get the organization ID and make the host token
- Open
https://app.example.comand sign in. - Open Settings and copy the Organization ID.
- Derive the organization’s host token from
COMPUTER_HOST_TOKEN_KEY:
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:
user-data metadata key once, on the first boot:
/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
- Open
https://app.example.com. The Computer showsOnlineonce the VM has connected. - Click Add to Slack and approve.
- Connect GitHub and choose the repositories.
- Mention
@computerin a channel.
Stop, start and resize
Stop the instance withgcloud 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: