Skip to content

docs: custom templates on v2 - #709

Merged
breardon2011 merged 3 commits into
mainfrom
docs/microvm-templates
Sep 3, 2026
Merged

docs: custom templates on v2#709
breardon2011 merged 3 commits into
mainfrom
docs/microvm-templates

Conversation

@breardon2011

Copy link
Copy Markdown
Contributor

Updates the templates docs for v2, and fixes the SDK export the docs depend on.

Why

The templates page said image builds were not supported on v2. They now are — parity-microvm (#703) implements them — so the page described a gap that no longer exists.

Docs

sandboxes/templates.mdx — leads with the contract being unchanged: same Image builder, same names, same Sandbox.create({ template }). Existing definitions carry over as written.

It then covers only what a customer can actually observe:

  • Build ahead of time. A build takes minutes, so it is a separate step; passing image: inline to a create is refused rather than timing out or silently returning a sandbox without the packages.
  • Template creates cold-start. The warm pool holds standard sandboxes.
  • AL2023 on ARM64. aptInstall works and common Debian names are translated (build-essentialgcc gcc-c++ make); a Debian-only package fails the build and the error names it. A step that downloads an x86-64 binary fails.
  • 10 templates per org, identical definitions deduped.

An earlier draft offered a choice between "workspace templates" and "custom images". That was wrong — there is one templates path in the API, and "workspace template" named an internal mechanism customers never see. Removed, including a pre-existing use of the term in the migration guide.

Consistency fixes — pages that would otherwise contradict the above: migrating-from-v1.mdx ("Image builds are unavailable" / "no build pipeline in v2") and reference/typescript-sdk/image.mdx, which described the base as Ubuntu 22.04 with apt-get.

SDK fix (why it is in this PR)

Image and Snapshots were exported as types only, so import { Image } from "@opencomputer/sdk" — exactly what the Image reference documents — failed at runtime with "does not provide an export named 'Image'". There was no supported way to define a template through the SDK at all.

Found by the first end-to-end template run, which could not import them. The docs here show that import, so the fix ships alongside. Also on #703; harmless if that merges first.

Validation

The flow these docs describe was run end to end against the dev cell:

snapshots.create({name, image: Image.base().aptInstall(["tree"])})
waitUntilReady(name)                → ready
Sandbox.create({template: name})    → 8.6s cold launch
exec "command -v tree"              → /usr/bin/tree

tree is absent from the base image, so its presence confirms the customer's package came from their template.

…pace templates keep the pooled create and capture the home directory (which is where pip and npm already install), custom images bake system packages into the machine image the sandbox boots from; documents what customers will actually hit: builds take minutes so they are ahead-of-time and inline image: on create is refused, custom-image creates cold-start, the base is AL2023 with dnf rather than Ubuntu with apt, everything is ARM64, and an org holds 10 images with identical definitions deduped
…han offering a choice — there is one templates path in the API (define by name with Image, create with template:), so presenting 'workspace templates' vs 'custom images' invented a decision customers cannot make and named an internal mechanism they never see; the page now states the API is the same as v1 and covers only what is actually visible to them: build ahead of time, template creates cold-start, AL2023/ARM64 package and architecture caveats, the 10-per-org cap, and rebuilding v1 rootfs templates
…ere type-only exports, so the import the Image reference documents (import { Image } from "@opencomputer/sdk") failed at runtime with 'does not provide an export named Image', and there was no supported way to define a template through the SDK at all; caught by the first end-to-end template run, which could not import them
@mintlify

mintlify Bot commented Sep 3, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
opencomputer 🟢 Ready View Preview Sep 3, 2026, 9:43 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@breardon2011
breardon2011 merged commit e6d4c13 into main Sep 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants